Package com.anylogic.engine.presentation
- Field Summary
- Constructor Summary
- Method Summary
- Methods inherited from class com.anylogic.engine.presentation.ShapeGroup
- Methods inherited from class com.anylogic.engine.presentation.Shape3D
- Methods inherited from class com.anylogic.engine.presentation.Shape
- Methods inherited from class java.lang.Object
- Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement
- Methods inherited from interface com.anylogic.engine.Locatable2D
- Constructor Details
- Method Details
- java.lang.Object
- com.anylogic.engine.presentation.Shape
- com.anylogic.engine.presentation.Shape3D
- com.anylogic.engine.presentation.ShapeGroup
- com.anylogic.engine.presentation.ShapeModelElementsGroup
- All Implemented Interfaces:
com.anylogic.engine.internal.Child
,Locatable2D
,Locatable3D
,AggregatableAnimationElement
,HasLevel
,LevelElement
,SVGElement
,Serializable
,Cloneable
public final class ShapeModelElementsGroup extends ShapeGroup
Shape containing/drawing model elements of agent / simulation (variables, events, flowchart blocks etc.)
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Constructor | Description |
---|---|
ShapeModelElementsGroup |
Constructs a top-level presentation group with specific attributes
and possibly with some content
|
Modifier and Type | Method | Description |
---|---|---|
void | add |
Adds a camera to the group.
|
void | add |
Adds a light to the group.
|
void | add |
Adds a replicated shape to the group.
|
void | add |
Adds a persistent shape to the group.
|
void | addInspect |
Creates a new ShapeInspect on an object that belongs to a given arbitrary
Presentable (not necessarily the one this shape belongs to), and adds it to this group.
|
void | addInspect |
Creates a new ShapeInspect and adds it to this group.
|
static void | addInspect |
Is called when a (responsive) custom icon of the EO is being clicked.
|
void | clear() |
Removes all shapes from the group.
|
Object | get |
Returns the shape with the given index.
|
double | getIconOffsetX() | |
double | getIconOffsetY() | |
ShapeEmbeddedObjectIcon | getOwner() |
Returns the owner of this presentation if this is an agent
presentation and it is embedded to another agent
This method returns null in case the agent
is not embedded anywhere or if this is an experiment presentation |
List<Object> | getShapes() |
Returns the collection of shapes in the group (not a copy).
|
int | indexOf |
Returns the index of the specified shape (either object of class
Shape, or object of class ReplicatedShape) in this group, or
-1 if this group does not
contain the shape.More formally, returns the index i such that
get( i ) == shape , or -1 if
there is no such index.Note that implementation of this method is very inefficient (has linear complexity) |
void | initialize_xjal |
This method is internal and shouldn't be called by user.
(may be removed in the next versions) |
void | insert |
Adds a replicated shape to the group at the specified index (which
defines z-order of shape in 2D animation).
|
void | insert |
Adds a persistent shape to the group at the specified index (which
defines z-order of shape in 2D animation).
|
boolean | remove |
Tries to remove a camera from the group,
returns
false if the camera was not contained. |
boolean | remove |
Tries to remove a light from the group,
returns
false if the light was not contained. |
boolean | remove |
Tries to remove a replicated shape from the group,
returns
false if the shape was not contained. |
boolean | remove |
Tries to remove a persistent shape from the group,
returns
false if the shape was not contained. |
void | removeInspect | |
void | setIconOffsets | |
void | setOwner_xjal |
This method shouldn't be called by user.
It is public due to technical reasons |
int | size() |
Returns the number of shapes in the group.
|
void | updateDynamicProperties() |
Updates dynamic properties of this shape only (without structural contents, if any) in a given context.
Method should be overridden for shapes with dynamic properties. |
clone, contains, findSVGElement, getPresentable, getRotation, getRotationX, getRotationY, getRotationZ, initialize_xjal, onDraw, postSVGShapeSpecificAttributes, resetSVGState, restoreOwner, setRotation, setRotationX, setRotationY, setRotationZ, setVisible, updateDynamicPropertiesStructural
canHandleClick, getDrawMode, getScaleZ, getZ, getZOffset, setDrawMode, setPos, setPos, setPos, setScale, setScale, setScaleZ, setZ
executeUserAction, getGroup, getLevel, getName, getScaleX, getScaleY, getSVGId, getX, getY, isJava2DSwingPresentation, isPublic_xjal, isSVGPresentation, isVisible, onAggregatorVisibilityChanged, onClick, randomPointInside, randomPointInside, removeSVGFromOwner, removeSVGImage, setLevel, setPublic_xjal, setScale, setScaleX, setScaleY, setX, setY, updateSVGProperties
public ShapeModelElementsGroup(Presentable presentable, ModelElementDescriptorUtils[] elementDescriptors, Object... iconShapes)
Constructs a top-level presentation group with specific attributes
and possibly with some content
- Parameters:
presentable
- the presentable object owning this shapeispublic
- iftrue
, the shape is visible on container's presentationx
- the x coordinate of groupy
- the y coordinate of groupz
- the z coordinate of grouprotationXY
- the rotation of the group in radianscontents
- the (possibly, empty) initial set of shapes (Shape objects, int ids, ReplicatedShape or Light3D objects)
@AnyLogicInternalCodegenAPI public void initialize_xjal(ModelElementDescriptorUtils[] elementDescriptors, boolean replaceAlways, boolean replaceWithNotEmpty, Object... contents)
This method is internal and shouldn't be called by user.
(may be removed in the next versions)
(may be removed in the next versions)
public ShapeEmbeddedObjectIcon getOwner()
Returns the owner of this presentation if this is an agent
presentation and it is embedded to another agent
This method returns
This method returns
null
in case the agent
is not embedded anywhere or if this is an experiment presentation- Returns:
- the owner of this presentation
@AnyLogicInternalAPI public void setOwner_xjal(ShapeEmbeddedObjectIcon owner)
This method shouldn't be called by user.
It is public due to technical reasons
It is public due to technical reasons
@AnyLogicInternalCodegenAPI public void setIconOffsets(double x, double y)
@AnyLogicInternalAPI public double getIconOffsetX()
@AnyLogicInternalAPI public double getIconOffsetY()
public List<Object> getShapes()
Description copied from class:
ShapeGroup
Returns the collection of shapes in the group (not a copy). The
collection can contain either members of class Shape for shapes,
and of class ReplicatedShape for replicated shapes.
It may also contain 3D lights and cameras.
- Overrides:
getShapes
in classShapeGroup
- Returns:
- the collection of shapes in the group
public int size()
Description copied from class:
ShapeGroup
Returns the number of shapes in the group.
- Overrides:
size
in classShapeGroup
- Returns:
- the number of shapes in the group
public Object get(int i)
Description copied from class:
ShapeGroup
Returns the shape with the given index.
The result may be a shape, replicated shape, 3D light or camera.
- Overrides:
get
in classShapeGroup
- Parameters:
i
- the index of the shape- Returns:
- the shape with the given index
public int indexOf(Object shape)
Description copied from class:
ShapeGroup
Returns the index of the specified shape (either object of class
Shape, or object of class ReplicatedShape) in this group, or
More formally, returns the index
Note that implementation of this method is very inefficient (has linear complexity)
-1
if this group does not
contain the shape.More formally, returns the index
i
such that
get( i ) == shape
, or -1
if
there is no such index.Note that implementation of this method is very inefficient (has linear complexity)
- Overrides:
indexOf
in classShapeGroup
- Parameters:
shape
- the shape to find index of- Returns:
- the index of the shape or
-1
public void add(Shape shape)
Description copied from class:
ShapeGroup
Adds a persistent shape to the group. Note that it is your
responsibility to remove the shape from the another group, if any!
- Overrides:
add
in classShapeGroup
- Parameters:
shape
- the shape to add
public void add(ReplicatedShape<?> rshape)
Description copied from class:
ShapeGroup
Adds a replicated shape to the group. Note that it is your
responsibility to remove the shape from the another group, if any!
- Overrides:
add
in classShapeGroup
- Parameters:
rshape
- the replicated shape to add
public void insert(int index, Shape shape)
Description copied from class:
ShapeGroup
Adds a persistent shape to the group at the specified index (which
defines z-order of shape in 2D animation). Note that it is your
responsibility to remove the shape from the another group, if any!
- Overrides:
insert
in classShapeGroup
- Parameters:
index
- index at which the specified shape is to be inserted (from0
tosize()
, inclusive)shape
- the shape to add
public void insert(int index, ReplicatedShape<?> rshape)
Description copied from class:
ShapeGroup
Adds a replicated shape to the group at the specified index (which
defines z-order of shape in 2D animation). Note that it is your
responsibility to remove the shape from the another group, if any!
- Overrides:
insert
in classShapeGroup
- Parameters:
index
- index at which the specified shape is to be inserted (from0
tosize()
, inclusive)rshape
- the replicated shape to add
public boolean remove(Shape shape)
Description copied from class:
ShapeGroup
Tries to remove a persistent shape from the group,
returns
false
if the shape was not contained.- Overrides:
remove
in classShapeGroup
- Parameters:
shape
- the shape to remove- Returns:
true
if the group contained the shape,false
otherwise
public boolean remove(ReplicatedShape<?> rshape)
Description copied from class:
ShapeGroup
Tries to remove a replicated shape from the group,
returns
false
if the shape was not contained.- Overrides:
remove
in classShapeGroup
- Parameters:
rshape
- the replicated shape to remove- Returns:
true
if the group contained the shape,false
otherwise
public void clear()
Description copied from class:
ShapeGroup
Removes all shapes from the group.
- Overrides:
clear
in classShapeGroup
@AnyLogicInternalAPI public void add(Camera3D camera)
Description copied from class:
ShapeGroup
Adds a camera to the group. Note that it is your
responsibility to remove the camera from the another group, if any!
- Overrides:
add
in classShapeGroup
- Parameters:
camera
- the camera to add
@AnyLogicInternalAPI public void add(Light3D light3d)
Description copied from class:
ShapeGroup
Adds a light to the group. Note that it is your
responsibility to remove the light from the another group, if any!
- Overrides:
add
in classShapeGroup
- Parameters:
light3d
- the light to add
@AnyLogicInternalAPI public boolean remove(Camera3D camera)
Description copied from class:
ShapeGroup
Tries to remove a camera from the group,
returns
false
if the camera was not contained.- Overrides:
remove
in classShapeGroup
- Parameters:
camera
- the camera to remove- Returns:
true
if the group contained the camera,false
otherwise
@AnyLogicInternalAPI public boolean remove(Light3D light3d)
Description copied from class:
ShapeGroup
Tries to remove a light from the group,
returns
false
if the light was not contained.- Overrides:
remove
in classShapeGroup
- Parameters:
light3d
- the light to remove- Returns:
true
if the group contained the light,false
otherwise
public void addInspect(double x, double y, String name)
Creates a new ShapeInspect and adds it to this group.
Can be called by
a) a clicked model primitive
b) a clicked custom icon of the EO
c) programmatically by calling addInspect() of SVG presentation
- Parameters:
x
- the x coordinate of the ShapeInspecty
- the y coordinate of the ShapeInspectname
- the name of the object being inspected
public void addInspect(double x, double y, Presentable p, String name)
Creates a new ShapeInspect on an object that belongs to a given arbitrary
Presentable (not necessarily the one this shape belongs to), and adds it to this group.
Can be called by
a) a clicked model primitive
b) a clicked custom icon of the EO
c) programmatically by calling addInspect() of SVG presentation
- Parameters:
x
- the x coordinate of the ShapeInspecty
- the y coordinate of the ShapeInspectp
- the Presentable (experiment or agent) where the object belongs toname
- the name of the object being inspected- Since:
- 8.3.3
public static void addInspect(ShapeEmbeddedObjectIcon icon)
Is called when a (responsive) custom icon of the EO is being clicked.
- Parameters:
icon
- the icon being clicked
public void removeInspect(String name)
public void updateDynamicProperties()
Description copied from class:
Shape
Updates dynamic properties of this shape only (without structural contents, if any) in a given context.
Method should be overridden for shapes with dynamic properties. Note that you should call super.updateDynamicProperties() at the end of overridden method
Method should be overridden for shapes with dynamic properties. Note that you should call super.updateDynamicProperties() at the end of overridden method
- Overrides:
updateDynamicProperties
in classShape