Package com.anylogic.engine.presentation
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- size
- indexOf
- get
- iterator
- getReplication
- getShapeClass
- createShapeWithStaticProperties_xjal
- setShapeDynamicProperties_xjal
- removeSVGFromOwner
- getGroup
- contains
- updateDynamicPropertiesStructural
- createShapes
- restoreOwner
- clone
- getLevel
- setLevel
- onAggregatorVisibilityChanged
- getSVGId
- updateSVGProperties
- resetSVGState
- findSVGElement
- executeUserAction
- java.lang.Object
- com.anylogic.engine.presentation.ReplicatedShape<T>
- All Implemented Interfaces:
com.anylogic.engine.internal.Child
,AggregatableAnimationElement
,HasLevel
,LevelElement
,SVGElement
,Serializable
,Cloneable
,Iterable<T>
public abstract class ReplicatedShape<T extends Shape> extends Object implements Serializable, Cloneable, com.anylogic.engine.internal.Child, SVGElement, Iterable<T>, LevelElement
Persistent replicated shape - a container for a number of shapes of the
same type but possibly different properties. Both the number of shapes
and their properties may change dynamically.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Constructor | Description |
---|---|
ReplicatedShape() |
Modifier and Type | Method | Description |
---|---|---|
final ReplicatedShape<T> | clone() |
Creates and returns a copy of this replicated shape (i.e.
|
boolean | contains |
Tests if any of the shapes in this replicated shape contains the point
with the given coordinates
|
int | createShapes() |
Creates missing and removes redundant shapes so that current number of
shapes in this replicated shape equals value returned by
getReplication() |
abstract T | createShapeWithStaticProperties_xjal |
Creates a new shape with static properties already set.
|
void | executeUserAction |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
SVGElement | findSVGElement |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
T | get |
Returns the shape with the given index.
Number of shapes is maintained to be equal with getReplication() : shapes are
created/deleted automatically during frame drawing requests or by explicit
createShapes() call. |
ShapeGroup | getGroup() |
Returns the group containing this replicated shape.
|
Level | getLevel() |
Returns the level containing this shape.
|
abstract int | getReplication() |
Returns the current number of shapes in replicated shape.
|
abstract Class<T> | getShapeClass() |
Returns the class of shapes in replicated shape.
|
long | getSVGId() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
int | indexOf |
Returns the index of a given shape in this replicated shape.
|
Iterator<T> | iterator() |
Returns iterator over shapes created so far.
Number of shapes is maintained to be equal with getReplication() : shapes are
created/deleted automatically during frame drawing requests or by explicit
createShapes() call. |
void | onAggregatorVisibilityChanged() |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void | removeSVGFromOwner |
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 |
Deprecated.
|
void | setLevel |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. |
void | setShapeDynamicProperties_xjal |
Sets the dynamic properties of a shape with the given index.
|
int | size() |
Returns the current number of shapes, which may not always equal to
what is returned by getReplication().
|
final void | updateDynamicPropertiesStructural |
Updates dynamic properties of the replicated shape in a given context, adding and
removing the shapes as needed.
|
SVGElement | updateSVGProperties |
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. |
public ReplicatedShape()
public int size()
Returns the current number of shapes, which may not always equal to
what is returned by getReplication().
- Returns:
- the current number of shapes
public int indexOf(T shape)
Returns the index of a given shape in this replicated shape.
- Parameters:
shape
- the shape- Returns:
- the index of the shape,
-1
if the shape is not in this replicated shape
public T get(int i)
Returns the shape with the given index.
Number of shapes is maintained to be equal with
Number of shapes is maintained to be equal with
getReplication()
: shapes are
created/deleted automatically during frame drawing requests or by explicit
createShapes()
call.- Parameters:
i
- the index- Returns:
- the shape with the given index
public Iterator<T> iterator()
Returns iterator over shapes created so far.
Number of shapes is maintained to be equal with
Number of shapes is maintained to be equal with
getReplication()
: shapes are
created/deleted automatically during frame drawing requests or by explicit
createShapes()
call.public abstract int getReplication()
Returns the current number of shapes in replicated shape. Must be defined
in a subclass.
public abstract Class<T> getShapeClass()
Returns the class of shapes in replicated shape. Must be defined
in a subclass.
@AnyLogicInternalCodegenAPI public abstract T createShapeWithStaticProperties_xjal(int index)
Creates a new shape with static properties already set. Must be defined
in a subclass.
- Parameters:
index
- the desired shape index- Returns:
- a new shape
@AnyLogicInternalCodegenAPI public void setShapeDynamicProperties_xjal(T shape, int index)
Sets the dynamic properties of a shape with the given index. By default
does nothing.
- Parameters:
shape
- the shapeindex
- the shape index
@AnyLogicInternalAPI public void removeSVGFromOwner(Shape oldOwner)
Description copied from interface:
SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
- Specified by:
removeSVGFromOwner
in interfaceSVGElement
public ShapeGroup getGroup()
Returns the group containing this replicated shape.
- Returns:
- the group containing this replicated shape
public boolean contains(double px, double py)
Tests if any of the shapes in this replicated shape contains the point
with the given coordinates
- Parameters:
px
- the x coordinate of the clickpy
- the y coordinate of the click- Returns:
true
if if any of the shapes in this replicated shape contains the point,false
otherwise
@AnyLogicInternalAPI public final void updateDynamicPropertiesStructural(boolean publicOnly)
Updates dynamic properties of the replicated shape in a given context, adding and
removing the shapes as needed.
- Parameters:
publicOnly
- iftrue
, the shape is only drawn if it is public
public int createShapes()
Creates missing and removes redundant shapes so that current number of
shapes in this replicated shape equals value returned by
getReplication()
- Returns:
- current number of shapes in this replicated shape
@AnyLogicInternalCodegenAPI @Deprecated public void restoreOwner(Object owner)
Deprecated.
This method normally should not be called by user
This method restores owner of this object
The method is used in snapshot saving/loading
This method restores owner of this object
The method is used in snapshot saving/loading
- Specified by:
restoreOwner
in interfacecom.anylogic.engine.internal.Child
- Parameters:
owner
- owner of this object, usuallyAgent
,Experiment
orShapeGroup
public final ReplicatedShape<T> clone()
Creates and returns a copy of this replicated shape (i.e. new instance).
The returned shape is the object of the same class
All shapes of this replicated shape are cloned respectively
If this shape belongs to some group, its clone will also be added to that group
The clone is created in the context of the same experiment or agent
Note that cloning of GIS shape, controls and charts is not supported
The returned shape is the object of the same class
All shapes of this replicated shape are cloned respectively
If this shape belongs to some group, its clone will also be added to that group
The clone is created in the context of the same experiment or agent
Note that cloning of GIS shape, controls and charts is not supported
public Level getLevel()
Returns the level containing this shape.
The returned value is
null
for shapes in the experiments.@AnyLogicInternalAPI public void setLevel(Level level)
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. Please use
it may be removed/renamed in future. Please use
Level.add(Shape)
instead.- Specified by:
setLevel
in interfaceLevelElement
public void onAggregatorVisibilityChanged()
Description copied from interface:
AggregatableAnimationElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
- Specified by:
onAggregatorVisibilityChanged
in interfaceAggregatableAnimationElement
@AnyLogicInternalAPI public long getSVGId()
Description copied from interface:
SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
- Specified by:
getSVGId
in interfaceSVGElement
@AnyLogicInternalAPI public SVGElement updateSVGProperties(List<SVGCommand> commands, 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.
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 interfaceSVGElement
- Parameters:
commands
- the list of commands to add todrawMode
- TODOpublicOnly
- drawing context: if true, only shapes that are marked as public only are updatedowner
- the SVG element that serves as a container for this elementelbehind
- 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 givenowner
when the svg element is added to a different place (e.g. GIS map).
@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.
it may be removed/renamed in future.
- Specified by:
resetSVGState
in interfaceSVGElement
@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.
it may be removed/renamed in future.
- Specified by:
findSVGElement
in interfaceSVGElement
@AnyLogicInternalAPI public void executeUserAction(String value)
Description copied from interface:
SVGElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
it may be removed/renamed in future.
- Specified by:
executeUserAction
in interfaceSVGElement