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 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

Field Summary

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

UNKNOWN_NAME

Constructor Summary

Constructors 
ShapeModelElementsGroup​(Presentable presentable, ModelElementDescriptor[] elementDescriptors, java.lang.Object... iconShapes)
Constructs a top-level presentation group with specific attributes and possibly with some content
Constructor Description

Method Summary

All Methods Static Methods Instance Methods Concrete Methods 
void add​(Camera3D camera)
Adds a camera to the group.
void add​(Light3D light3d)
Adds a light to the group.
void add​(ReplicatedShape<?> rshape)
Adds a replicated shape to the group.
void add​(Shape shape)
Adds a persistent shape to the group.
void addInspect​(double x, double y, Presentable p, java.lang.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.
void addInspect​(double x, double y, java.lang.String name)
Creates a new ShapeInspect and adds it to this group.
static void addInspect​(ShapeEmbeddedObjectIcon icon)
Is called when a (responsive) custom icon of the EO is being clicked.
void clear()
Removes all shapes from the group.
java.lang.Object get​(int i)
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
java.util.List<java.lang.Object> getShapes()
Returns the collection of shapes in the group (not a copy).
int indexOf​(java.lang.Object shape)
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​(ModelElementDescriptor[] elementDescriptors, boolean replaceAlways, boolean replaceWithNotEmpty, java.lang.Object... contents)
This method is internal and shouldn't be called by user.
(may be removed in the next versions)
void insert​(int index, ReplicatedShape<?> rshape)
Adds a replicated shape to the group at the specified index (which defines z-order of shape in 2D animation).
void insert​(int index, Shape shape)
Adds a persistent shape to the group at the specified index (which defines z-order of shape in 2D animation).
boolean remove​(Camera3D camera)
Tries to remove a camera from the group, returns false if the camera was not contained.
boolean remove​(Light3D light3d)
Tries to remove a light from the group, returns false if the light was not contained.
boolean remove​(ReplicatedShape<?> rshape)
Tries to remove a replicated shape from the group, returns false if the shape was not contained.
boolean remove​(Shape shape)
Tries to remove a persistent shape from the group, returns false if the shape was not contained.
void removeInspect​(java.lang.String name)  
void setIconOffsets​(double x, double y)  
void setOwner_xjal​(ShapeEmbeddedObjectIcon owner)
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.
Modifier and Type Method Description

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

clone, contains, findSVGElement, getPresentable, getRotation, getRotationX, getRotationY, getRotationZ, initialize_xjal, onDraw, postSVGShapeSpecificAttributes, resetSVGState, restoreOwner, setRotation, setRotationX, setRotationY, setRotationZ, setVisible, updateDynamicPropertiesStructural

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

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

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

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

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

ShapeModelElementsGroup

public ShapeModelElementsGroup​(Presentable presentable,
                               ModelElementDescriptor[] elementDescriptors,
                               java.lang.Object... iconShapes)
Constructs a top-level presentation group with specific attributes and possibly with some content
Parameters:
presentable - the presentable object owning this shape
ispublic - if true, the shape is visible on container's presentation
x - the x coordinate of group
y - the y coordinate of group
z - the z coordinate of group
rotationXY - the rotation of the group in radians
contents - the (possibly, empty) initial set of shapes (Shape objects, int ids, ReplicatedShape or Light3D objects)

Method Detail

initialize_xjal

@AnyLogicInternalCodegenAPI
public void initialize_xjal​(ModelElementDescriptor[] elementDescriptors,
                            boolean replaceAlways,
                            boolean replaceWithNotEmpty,
                            java.lang.Object... contents)
This method is internal and shouldn't be called by user.
(may be removed in the next versions)

getOwner

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 null in case the agent is not embedded anywhere or if this is an experiment presentation
Returns:
the owner of this presentation

setOwner_xjal

@AnyLogicInternalAPI
public void setOwner_xjal​(ShapeEmbeddedObjectIcon owner)
This method shouldn't be called by user.
It is public due to technical reasons

setIconOffsets

@AnyLogicInternalCodegenAPI
public void setIconOffsets​(double x,
                           double y)

getIconOffsetX

@AnyLogicInternalAPI
public double getIconOffsetX()

getIconOffsetY

@AnyLogicInternalAPI
public double getIconOffsetY()

getShapes

public java.util.List<java.lang.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 class ShapeGroup
Returns:
the collection of shapes in the group

size

public int size()
Description copied from class: ShapeGroup
Returns the number of shapes in the group.
Overrides:
size in class ShapeGroup
Returns:
the number of shapes in the group

get

public java.lang.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 class ShapeGroup
Parameters:
i - the index of the shape
Returns:
the shape with the given index

indexOf

public int indexOf​(java.lang.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 -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 class ShapeGroup
Parameters:
shape - the shape to find index of
Returns:
the index of the shape or -1

add

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 class ShapeGroup
Parameters:
shape - the shape to add

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 class ShapeGroup
Parameters:
rshape - the replicated shape to add

insert

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 class ShapeGroup
Parameters:
index - index at which the specified shape is to be inserted (from 0 to size(), inclusive)
shape - the shape to add

insert

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 class ShapeGroup
Parameters:
index - index at which the specified shape is to be inserted (from 0 to size(), inclusive)
rshape - the replicated shape to add

remove

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 class ShapeGroup
Parameters:
shape - the shape to remove
Returns:
true if the group contained the shape, false otherwise

remove

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 class ShapeGroup
Parameters:
rshape - the replicated shape to remove
Returns:
true if the group contained the shape, false otherwise

clear

public void clear()
Description copied from class: ShapeGroup
Removes all shapes from the group.
Overrides:
clear in class ShapeGroup

add

@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 class ShapeGroup
Parameters:
camera - the camera to add

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 class ShapeGroup
Parameters:
light3d - the light to add

remove

@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 class ShapeGroup
Parameters:
camera - the camera to remove
Returns:
true if the group contained the camera, false otherwise

remove

@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 class ShapeGroup
Parameters:
light3d - the light to remove
Returns:
true if the group contained the light, false otherwise

addInspect

public void addInspect​(double x,
                       double y,
                       java.lang.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 ShapeInspect
y - the y coordinate of the ShapeInspect
name - the name of the object being inspected

addInspect

public void addInspect​(double x,
                       double y,
                       Presentable p,
                       java.lang.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 ShapeInspect
y - the y coordinate of the ShapeInspect
p - the Presentable (experiment or agent) where the object belongs to
name - the name of the object being inspected
Since:
8.3.3

addInspect

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

removeInspect

public void removeInspect​(java.lang.String name)

updateDynamicProperties

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
Overrides:
updateDynamicProperties in class Shape
How can we improve this article?