AnyLogic AnyLogic
Expand
Font size
All Implemented Interfaces:
com.anylogic.engine.internal.Child, Locatable2D, Locatable3D, AggregatableAnimationElement, HasLevel, LevelElement, SVGElement, java.io.Serializable, java.lang.Cloneable

public class ShapeEmbeddedObjectPresentation
extends Shape3D
Persistent presentation of Embedded Object shape. Contains a single shape - top-level presentation group of embedded object. May not be replicated. The user can add, remove and change shapes in the group dynamically.
Shapes contained in a group have reference to that group.
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Field Summary

Fields inherited from class com.anylogic.engine.presentation.Shape3D

UNKNOWN_NAME

Constructor Summary

Constructors 
ShapeEmbeddedObjectPresentation​(Agent agent, ShapeDrawMode drawMode, boolean ispublic, double x, double y, double z, double rotation, boolean drawAgentWithOffset, boolean scaleIsAutomatic, Agent embeddedObject)
Constructs an embedded object presentation with specific attributes
Constructor Description

Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods 
Shape clone()
This method is not supported and throws exception:
Embedded object presentation cannot be cloned
boolean contains​(double px, double py)
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e. in the same system with the coordinates of this shape, x and y)
void deactivate()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Tells the shape to forget about its current embedded object.
SVGElement findSVGElement​(long svgId)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Agent getEmbeddedObject()
Returns the embedded object drawn by this shape
Agent getPresentable()
Returns the presentable (Agent) where this shape belongs to.
boolean isZeroOrigin_xjal()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
void resetSVGState()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
void restoreOwner​(java.lang.Object owner)
Deprecated.
void setActive​(boolean active)  
void setAgentVisible​(boolean v)
Hides or shows the embedded object presentation.
void setEmbeddedObject_xjal​(Agent embeddedObject)  
boolean updateDynamicPropertiesStructural​(boolean publicOnly)  
SVGElement updateSVGProperties​(java.util.List<SVGCommand> output, ShapeDrawMode drawMode, boolean publicOnly, SVGElement owner, SVGElement elbehind)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Updates SVG properties of the element that are then sent to the rendering client.
Modifier and Type Method Description

Methods inherited from class com.anylogic.engine.presentation.Shape3D

canHandleClick, getDrawMode, getScaleZ, getZ, getZOffset, setDrawMode, setPos, setPos, setPos, setRotation, setScale, setScale, setScaleZ, setZ

Methods inherited from class com.anylogic.engine.presentation.Shape

executeUserAction, getGroup, getLevel, getName, getRotation, getScaleX, getScaleY, getSVGId, getX, getY, isJava2DSwingPresentation, isPublic_xjal, isSVGPresentation, isVisible, onAggregatorVisibilityChanged, onClick, postSVGShapeSpecificAttributes, randomPointInside, randomPointInside, removeSVGFromOwner, removeSVGImage, setLevel, setPublic_xjal, setScale, setScaleX, setScaleY, setVisible, setX, setY, updateDynamicProperties

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement

initializeInternal, postInitialize

Methods inherited from interface com.anylogic.engine.Locatable2D

getX, getY

Constructor Detail

ShapeEmbeddedObjectPresentation

public ShapeEmbeddedObjectPresentation​(Agent agent,
                                       ShapeDrawMode drawMode,
                                       boolean ispublic,
                                       double x,
                                       double y,
                                       double z,
                                       double rotation,
                                       boolean drawAgentWithOffset,
                                       boolean scaleIsAutomatic,
                                       Agent embeddedObject)
Constructs an embedded object presentation with specific attributes
Parameters:
agent - the agent owning this shape
drawMode - where to draw this shape: 2D, 3D or 2D+3D
ispublic - if true, the shape is visible on container's presentation
x - the x coordinate of embedded presentation
y - the y coordinate of embedded presentation
z - the z coordinate of embedded presentation
rotation - the rotation of the embedded presentation in radians
showIn3D - if true all the public 3D shapes from embedded object presentation will be drawn on a parent agent, otherwise embedded object presentation will draw only 2D shapes (including 2D-projections of 3D shapes of embedded object)
drawAgentWithOffset - this setting is for agents which live in space coordinates: its specifies whether agent animation should be drawn with offset to this shape (AnyLogic 6 style) or not (AnyLogic 7+). This setting reflects only agents which have space set (e.g. live in environment)
scaleIsAutomatic - this setting enables automatic scaling of agent animation depending on its Scale element and the Scale of space the agent lives in
embeddedObject - the embedded object

Method Detail

getPresentable

public Agent getPresentable()
Returns the presentable (Agent) where this shape belongs to.
Overrides:
getPresentable in class Shape
Returns:
the presentable where this shape belongs to

getEmbeddedObject

public Agent getEmbeddedObject()
Returns the embedded object drawn by this shape
Returns:
the embedded object drawn by this shape

setActive

@AnyLogicInternalAPI
public void setActive​(boolean active)

deactivate

@AnyLogicInternalAPI
public void deactivate()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Tells the shape to forget about its current embedded object. The shape itself continues to render (being empty) and may reactivate with new embedded object later.

setEmbeddedObject_xjal

@AnyLogicInternalCodegenAPI
public void setEmbeddedObject_xjal​(Agent embeddedObject)

restoreOwner

@AnyLogicInternalCodegenAPI
@Deprecated
public void restoreOwner​(java.lang.Object owner)
Deprecated.
Description copied from class: Shape
This method normally should not be called by user
This method restores owner of this object
The method is used in snapshot saving/loading
Specified by:
restoreOwner in interface com.anylogic.engine.internal.Child
Overrides:
restoreOwner in class Shape
Parameters:
owner - owner of this object, usually Agent, Experiment or ShapeGroup

updateDynamicPropertiesStructural

@AnyLogicInternalAPI
public boolean updateDynamicPropertiesStructural​(boolean publicOnly)
Overrides:
updateDynamicPropertiesStructural in class Shape
Returns:
true if:
1. update was done (usually for visible elements, respecting public flag etc.)
AND
2. further update of structural changes is applicable

setAgentVisible

public void setAgentVisible​(boolean v)
Hides or shows the embedded object presentation. Works independently of setVisible().
Parameters:
v - true to show, false to hide

isZeroOrigin_xjal

@AnyLogicInternalAPI
public boolean isZeroOrigin_xjal()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.

contains

public boolean contains​(double px,
                        double py)
Description copied from class: Shape
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e. in the same system with the coordinates of this shape, x and y)
Specified by:
contains in class Shape
Parameters:
px - the x coordinate relative to this shape's container
py - the y coordinate relative to this shape's container
Returns:
true if the shape contains the point with the given coordinates

clone

public final Shape clone()
This method is not supported and throws exception:
Embedded object presentation cannot be cloned
Overrides:
clone in class Shape

updateSVGProperties

@AnyLogicInternalAPI
public SVGElement updateSVGProperties​(java.util.List<SVGCommand> output,
                                      ShapeDrawMode drawMode,
                                      boolean publicOnly,
                                      SVGElement owner,
                                      SVGElement elbehind)
Description copied from interface: SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Updates SVG properties of the element that are then sent to the rendering client. If the element is not yet in the SVG scene, generates "C" command, if it is there, but some properties are out of date, generates "U" command. If SVG drawing of this element is not needed because of public only settings, or permanently not needed, or not supported yet, returns false and does nothing.
Specified by:
updateSVGProperties in interface SVGElement
Overrides:
updateSVGProperties in class Shape
Parameters:
output - the list of commands to add to
drawMode - TODO
publicOnly - drawing context: if true, only shapes that are marked as public only are updated
owner - the SVG element that serves as a container for this element
elbehind - the SVG element behind this one, or null if none or if order is irrelevant
Returns:
the actual owner this element has been added to or null if element is not drawn (e.g. drawing of this element is not needed because of public only settings, permanently not needed or not supported - hence SVG id is not set). The actual owner may differ from the given owner when the svg element is added to a different place (e.g. GIS map).

resetSVGState

@AnyLogicInternalAPI
public void resetSVGState()
Description copied from interface: SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Specified by:
resetSVGState in interface SVGElement
Overrides:
resetSVGState in class Shape

findSVGElement

@AnyLogicInternalAPI
public SVGElement findSVGElement​(long svgId)
Description copied from interface: SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Specified by:
findSVGElement in interface SVGElement
Overrides:
findSVGElement in class Shape
How can we improve this article?