AnyLogic
Expand
Font size
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

Field Summary

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

UNKNOWN_NAME

Constructor Summary

ConstructorDescription
ShapeModelElementsGroup(Presentable presentable, ModelElementDescriptorUtils[] elementDescriptors, Object... iconShapes)
Constructs a top-level presentation group with specific attributes and possibly with some content

Method Summary

Modifier and TypeMethodDescription
voidadd(Camera3D camera)
Adds a camera to the group.
voidadd(Light3D light3d)
Adds a light to the group.
voidadd(ReplicatedShape<?> rshape)
Adds a replicated shape to the group.
voidadd(Shape shape)
Adds a persistent shape to the group.
voidaddInspect(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.
voidaddInspect(double x, double y, String name)
Creates a new ShapeInspect and adds it to this group.
static voidaddInspect(ShapeEmbeddedObjectIcon icon)
Is called when a (responsive) custom icon of the EO is being clicked.
voidclear()
Removes all shapes from the group.
Objectget(int i)
Returns the shape with the given index.
doublegetIconOffsetX() 
doublegetIconOffsetY() 
ShapeEmbeddedObjectIcongetOwner()
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).
intindexOf(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)
voidinitialize_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)
voidinsert(int index, ReplicatedShape<?> rshape)
Adds a replicated shape to the group at the specified index (which defines z-order of shape in 2D animation).
voidinsert(int index, Shape shape)
Adds a persistent shape to the group at the specified index (which defines z-order of shape in 2D animation).
booleanremove(Camera3D camera)
Tries to remove a camera from the group, returns false if the camera was not contained.
booleanremove(Light3D light3d)
Tries to remove a light from the group, returns false if the light was not contained.
booleanremove(ReplicatedShape<?> rshape)
Tries to remove a replicated shape from the group, returns false if the shape was not contained.
booleanremove(Shape shape)
Tries to remove a persistent shape from the group, returns false if the shape was not contained.
voidremoveInspect(String name) 
voidsetIconOffsets(double x, double y) 
voidsetOwner_xjal(ShapeEmbeddedObjectIcon owner)
This method shouldn't be called by user.
It is public due to technical reasons
intsize()
Returns the number of shapes in the group.
voidupdateDynamicProperties()
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.

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

ShapeModelElementsGroup

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

initialize_xjal

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

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