|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.presentation.ReplicatedShape<T>
public abstract class ReplicatedShape<T extends Shape>
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.
| Constructor Summary | |
|---|---|
ReplicatedShape()
|
|
| Method Summary | |
|---|---|
ReplicatedShape<T> |
clone()
Creates and returns a copy of this replicated shape (i.e. new instance). |
boolean |
contains(double px,
double py)
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(int index)
Creates a new shape with static properties already set. |
void |
draw(Panel panel,
java.awt.Graphics2D g,
java.awt.geom.AffineTransform xform,
boolean publicOnly)
Draws the replicated shape in a given context, adding and removing the shapes as needed. |
T |
get(int i)
Returns the shape with the given index. |
ShapeGroup |
getGroup()
Returns the group containing this replicated shape. |
abstract int |
getReplication()
Returns the current number of shapes in replicated shape. |
int |
indexOf(T shape)
Returns the index of a given shape in this replicated shape. |
boolean |
onClickAt(double px,
double py,
boolean publicOnly)
Tests if any of the shapes in this replicated shape contains the point with the given coordinates and, if yes, executes the shape's reaction on click at that point. |
void |
restoreOwner(java.lang.Object owner)
This method normally should not be called by user This method restores owner of this object The method is used in snapshot saving/loading |
void |
setShapeDynamicProperties(T shape,
int index)
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(). |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReplicatedShape()
| Method Detail |
|---|
public int size()
public int indexOf(T shape)
shape - the shape
public T get(int i)
i - the index
public abstract int getReplication()
public abstract T createShapeWithStaticProperties(int index)
index - the desired shape index
public void setShapeDynamicProperties(T shape,
int index)
shape - the shapeindex - the shape indexpublic ShapeGroup getGroup()
public boolean onClickAt(double px,
double py,
boolean publicOnly)
px - the x coordinate of the clickpy - the y coordinate of the clickpublicOnly - if true, not public shape returns false
public boolean contains(double px,
double py)
px - the x coordinate of the clickpy - the y coordinate of the click
public void draw(Panel panel,
java.awt.Graphics2D g,
java.awt.geom.AffineTransform xform,
boolean publicOnly)
panel - the panel where the drawing is doneg - the graphics where the drawing takes placexform - the "original" transform that must be restored before drawingpublicOnly - if true, the shape is only drawn if it is publicpublic int createShapes()
getReplication()
public void restoreOwner(java.lang.Object owner)
restoreOwner in interface com.xj.anylogic.engine.internal.Childowner - owner of this object, usually ActiveObject,
Experiment or
ShapeGrouppublic final ReplicatedShape<T> clone()
clone in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||