public class ShapeGroup extends Shape3D implements com.anylogic.engine.internal.Child
UNKNOWN_NAME
Constructor and Description |
---|
ShapeGroup(Presentable presentable)
Constructs an empty group with default attributes.
|
ShapeGroup(Presentable presentable,
boolean ispublic,
double x,
double y,
double rotation,
java.lang.Object... contents)
Constructs a 2D-only group with specific attributes and possibly with some content
|
ShapeGroup(Presentable presentable,
ShapeDrawMode drawMode,
boolean ispublic,
double x,
double y,
double z,
double rotationZ,
java.lang.Object... contents)
Constructs a group with specific attributes and possibly with some content
|
Modifier and Type | Method and Description |
---|---|
void |
add(Camera3D camera)
Adds a camera to the group.
|
void |
add(Light3D light)
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 |
clear()
Removes all shapes from the group.
|
ShapeGroup |
clone()
Creates and returns a copy of this group (i.e. new shape instance).
|
boolean |
contains(double px,
double py)
|
SVGElement |
findSVGElement(long svgId) |
java.lang.Object |
get(int i)
Returns the shape with the given index.
|
Presentable |
getPresentable()
Returns the presentable (
Agent or Experiment ) where this group
belongs to. |
double |
getRotation()
Returns the horizontal rotation of the shape.
|
double |
getRotationX()
Returns the rotation of the shape around X axis (CW from +Y to +Z).
|
double |
getRotationY()
Returns the rotation of the shape around Y axis (CW from +Z to +X).
|
double |
getRotationZ()
Returns the rotation of the shape around Z axis (CW from +X to +Y).
|
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. |
void |
initialize_xjal(boolean replaceAlways,
boolean replaceWithNotEmpty,
java.lang.Object... contents)
This method is internal and shouldn't be called by user.
|
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).
|
void |
onDraw()
A callback called by the group before the group has drawn itself (and only if the
group drawing is needed - it is visible, etc.).
|
void |
postSVGShapeSpecificAttributes(java.util.List<java.lang.String> att,
java.util.List<java.lang.String> val,
boolean publicOnly)
Posts general properties specific to a particular shape class.
|
boolean |
remove(Camera3D camera)
Tries to remove a camera from the group,
returns
false if the camera was not contained. |
boolean |
remove(Light3D light)
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 |
resetSVGState() |
void |
restoreOwner(java.lang.Object owner)
Deprecated.
|
void |
setRotation(double rotation)
Sets the horizontal rotation of the shape.
|
void |
setRotationX(double rotationX)
Sets rotation around X axis (CW from +Y to +Z) of the shape.
|
void |
setRotationY(double rotationY)
Sets rotation around Y axis (CW from +Z to +X) of the shape.
|
void |
setRotationZ(double rotationZ)
Sets the rotation of the shape around Z-axis.
|
void |
setVisible(boolean v)
Sets the visibility of the shape.
|
int |
size()
Returns the number of shapes in the group.
|
void |
updateDynamicProperties(boolean publicOnly)
Updates dynamic properties of the shape in a given context.
|
boolean |
updateSVGProperties(java.util.List<SVGCommand> output,
ShapeDrawMode drawMode,
boolean publicOnly,
SVGElement owner,
SVGElement elbehind)
Updates SVG properties of the element that are then sent to the rendering client.
|
canHandleClick, getDrawMode, getScaleZ, getZ, getZOffset, setDrawMode, setPos, setPos, setPos, setScale, setScale, setScaleZ, setZ
executeUserAction, getGroup, getName, getScaleX, getScaleY, getSVGId, getX, getY, isJava2DSwingPresentation, isSVGPresentation, isVisible, onClick, randomPointInside, randomPointInside, removeSVGImage, setScale, setScaleX, setScaleY, setX, setY
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getX, getY
public ShapeGroup(Presentable presentable)
presentable
- the presentable object owning this shape@AnyLogicLegacyAPI public ShapeGroup(Presentable presentable, boolean ispublic, double x, double y, double rotation, java.lang.Object... contents)
presentable
- the presentable object owning this shapeispublic
- if true
, the shape is visible on container's presentationx
- the x coordinate of groupy
- the y coordinate of grouprotation
- the rotation of the group in radianscontents
- the (possibly, empty) initial set of shapes (Shape objects, int ids, or ReplicatedShape objects)public ShapeGroup(Presentable presentable, ShapeDrawMode drawMode, boolean ispublic, double x, double y, double z, double rotationZ, java.lang.Object... contents)
presentable
- the presentable object owning this shapedrawMode
- where to draw this shape: 2D, 3D or 2D+3Dispublic
- if true
, the shape is visible on container's presentationx
- the x coordinate of groupy
- the y coordinate of groupz
- the z coordinate of grouprotationZ
- the rotation of the group in radians around Z axis (CW from +X to +Y)contents
- the (possibly, empty) initial set of shapes (Shape objects, int ids, Replicated shapes, 3D Cameras or 3D Lights)@AnyLogicInternalCodegenAPI public void initialize_xjal(boolean replaceAlways, boolean replaceWithNotEmpty, java.lang.Object... contents)
public void setVisible(boolean v)
Shape
setVisible
in class Shape
v
- visibility: true
- visible, false
- notpublic java.util.List<java.lang.Object> getShapes()
public int size()
public java.lang.Object get(int i)
i
- the index of the shapepublic int indexOf(java.lang.Object shape)
-1
if this group does not
contain the shape.i
such that
get( i ) == shape
, or -1
if
there is no such index.shape
- the shape to find index of-1
public void add(Shape shape)
shape
- the shape to addpublic void add(ReplicatedShape<?> rshape)
rshape
- the replicated shape to addpublic void add(Light3D light)
light
- the light to addpublic void add(Camera3D camera)
camera
- the camera to addpublic void insert(int index, Shape shape)
index
- index at which the specified shape is to be inserted
(from 0
to size()
, inclusive)shape
- the shape to addpublic void insert(int index, ReplicatedShape<?> rshape)
index
- index at which the specified shape is to be inserted
(from 0
to size()
, inclusive)rshape
- the replicated shape to addpublic boolean remove(Shape shape)
false
if the shape was not contained.shape
- the shape to removetrue
if the group contained the shape, false
otherwisepublic boolean remove(ReplicatedShape<?> rshape)
false
if the shape was not contained.rshape
- the replicated shape to removetrue
if the group contained the shape, false
otherwisepublic boolean remove(Light3D light)
false
if the light was not contained.light
- the light to removetrue
if the group contained the light,
false
otherwisepublic boolean remove(Camera3D camera)
false
if the camera was not contained.camera
- the camera to removetrue
if the group contained the camera,
false
otherwisepublic void clear()
public boolean contains(double px, double py)
Shape
public void updateDynamicProperties(boolean publicOnly)
Shape
updateDynamicProperties
in class Shape
publicOnly
- if true
, the shape is only updated if it is publicpublic void onDraw()
public Presentable getPresentable()
Agent
or Experiment
) where this group
belongs to.getPresentable
in class Shape
@AnyLogicInternalCodegenAPI @Deprecated public void restoreOwner(java.lang.Object owner)
Shape
restoreOwner
in interface com.anylogic.engine.internal.Child
restoreOwner
in class Shape
owner
- owner of this object, usually Agent
,
Experiment
or
ShapeGroup
public ShapeGroup clone()
public void setRotation(double rotation)
setRotation
in class Shape3D
rotation
- the new value of horizontal rotation in radianssetRotationZ(double)
public void setRotationZ(double rotationZ)
rotationZ
- the new value of rotation around Z-axis in radianspublic void setRotationY(double rotationY)
rotationY
- the new value of rotation around Y axis (CW from +Z to +X),
in radianspublic void setRotationX(double rotationX)
rotationX
- the new value of rotation around X axis (CW from +Y to +Z),
in radianspublic double getRotation()
getRotation
in class Shape
public double getRotationZ()
public double getRotationY()
public double getRotationX()
@AnyLogicInternalAPI public boolean updateSVGProperties(java.util.List<SVGCommand> output, ShapeDrawMode drawMode, boolean publicOnly, SVGElement owner, SVGElement elbehind)
SVGElement
updateSVGProperties
in interface SVGElement
updateSVGProperties
in class Shape
output
- 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 irrelevantowner
. Possible cases are:@AnyLogicInternalAPI public void resetSVGState()
resetSVGState
in interface SVGElement
resetSVGState
in class Shape
public void postSVGShapeSpecificAttributes(java.util.List<java.lang.String> att, java.util.List<java.lang.String> val, boolean publicOnly)
Shape
postSVGShapeSpecificAttributes
in class Shape
att
- attribute namesval
- attribute valuespublicOnly
- TODO@AnyLogicInternalAPI public SVGElement findSVGElement(long svgId)
findSVGElement
in interface SVGElement
findSVGElement
in class Shape
Copyright © AnyLogic North America, LLC. All Rights Reserved.