com.xj.anylogic.engine.presentation
Class ShapeEmbeddedObjectPresentation

java.lang.Object
  extended by com.xj.anylogic.engine.presentation.Shape
      extended by com.xj.anylogic.engine.presentation.ShapeEmbeddedObjectPresentation
All Implemented Interfaces:
com.xj.anylogic.engine.internal.Child, com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal, com.xj.anylogic.engine.internal.presentation.WorldObject3D_xjal, Locatable2D, Locatable3D, java.io.Serializable, java.lang.Cloneable

public class ShapeEmbeddedObjectPresentation
extends Shape
implements Locatable3D, com.xj.anylogic.engine.internal.presentation.WorldObject3D_xjal

Persistent presentation of Embedded Object shape. Contains a single shape - top-level presentation group of embedded object. May not be replicated. The user can add, remove and change shapes in the group dynamically.
Shapes contained in a group have reference to that group.

Author:
XJ Technologies Company Ltd. www.anylogic.com
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.xj.anylogic.engine.presentation.Shape
UNKNOWN_NAME
 
Constructor Summary
ShapeEmbeddedObjectPresentation(Presentable presentable, boolean ispublic, double x, double y, double z, double rotation, boolean showIn3D, ActiveObject embeddedObject)
          Constructs an embedded object presentation with specific attributes
 
Method Summary
 Shape clone()
          This method is not supported and throws exception:
Embedded object presentation cannot be cloned
 boolean contains(double px, double py)
          Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e. in the same system with the coordinates of this shape, x and y)
 void draw(Panel panel, java.awt.Graphics2D g, java.awt.geom.AffineTransform xform, boolean publicOnly)
          Draws the group of shapes in a given context
 Element3D_xjal get3DElement_xjal()
          This method is internal and shouldn't be accessed by user.
 ActiveObject getEmbeddedObject()
          Returns the embedded object drawn by this shape
 Presentable getPresentable()
          Returns the presentable (ActiveObject or Experiment) where this group belongs to.
 double getScaleZ()
          Returns the scale of the shape along z axis
 double getZ()
          Returns the z coordinate of the shape.
 double getZOffset()
          Returns the offset from z coordinate of the location base.
 boolean isShowIn3D()
          Returns true if this shape adds contents of embedded object to the 3D scene of parent active object, false otherwise
 boolean onClickAt(double px, double py, boolean publicOnly)
          Should be overridden to test if the shape contains the point with the given coordinates, and, if yes, execute 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 set3DElement_xjal(Element3D_xjal element3D)
          This method is internal and shouldn't be accessed by user.
 void setContextReference_xjal(Presentable contextReference)
          This method is internal and shouldn't be accessed by user.
 void setEmbeddedObject_xjal(ActiveObject embeddedObject)
           
 void setPos(double x, double y)
          Sets both coordinates of the shape
 void setPos(double x, double y, double z)
          Sets coordinates of the shape
 void setRotation(double rotation)
          Sets the rotation of the shape.
 void setScale(double scale)
          Sets the scale of the figure along all the axes
 void setScale(double sx, double sy)
          Sets the scales of the shape along both axes
 void setScaleX(double sx)
          Sets the scale of the shape along x axis
 void setScaleY(double sy)
          Sets the scale of the shape along y axis
 void setScaleZ(double sz)
          Sets the scale of the shape along z axis
 void setVisible(boolean visible)
          Sets the visibility of the shape.
 void setX(double x)
          Sets the x coordinate of the shape
 void setY(double y)
          Sets the y coordinate of the shape
 void setZ(double z)
          Sets the z coordinate of the figure
 
Methods inherited from class com.xj.anylogic.engine.presentation.Shape
canHandleClick, getGroup, getName, getRotation, getScaleX, getScaleY, getX, getY, isVisible, onClick
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.xj.anylogic.engine.Locatable2D
getX, getY
 

Constructor Detail

ShapeEmbeddedObjectPresentation

public ShapeEmbeddedObjectPresentation(Presentable presentable,
                                       boolean ispublic,
                                       double x,
                                       double y,
                                       double z,
                                       double rotation,
                                       boolean showIn3D,
                                       ActiveObject embeddedObject)
Constructs an embedded object presentation with specific attributes

Parameters:
presentable - the presentable object (active object) owning this shape
ispublic - if true, the shape is visible on container's presentation
x - the x coordinate of embedded presentation
y - the y coordinate of embedded presentation
z - the z coordinate of embedded presentation
rotation - the rotation of the embedded presentation in radians
showIn3D - if true all the public 3D shapes from embedded object presentation will be drawn on a parent active object, otherwise embedded object presentation will draw only 2D shapes (including 2D-projections of 3D shapes of embedded object)
embeddedObject - the embedded object
Method Detail

getPresentable

public Presentable getPresentable()
Returns the presentable (ActiveObject or Experiment) where this group belongs to.

Specified by:
getPresentable in interface com.xj.anylogic.engine.internal.presentation.WorldObject3D_xjal
Overrides:
getPresentable in class Shape
Returns:
the presentable where this group belongs to

getEmbeddedObject

public ActiveObject getEmbeddedObject()
Returns the embedded object drawn by this shape

Returns:
the embedded object drawn by this shape

setEmbeddedObject_xjal

public void setEmbeddedObject_xjal(ActiveObject embeddedObject)

restoreOwner

public void restoreOwner(java.lang.Object owner)
Description copied from class: Shape
This method normally should not be called by user
This method restores owner of this object
The method is used in snapshot saving/loading

Specified by:
restoreOwner in interface com.xj.anylogic.engine.internal.Child
Overrides:
restoreOwner in class Shape
Parameters:
owner - owner of this object, usually ActiveObject, Experiment or ShapeGroup

draw

public void draw(Panel panel,
                 java.awt.Graphics2D g,
                 java.awt.geom.AffineTransform xform,
                 boolean publicOnly)
Draws the group of shapes in a given context

Specified by:
draw in class Shape
Parameters:
panel - the panel where the drawing is done
g - the graphics where the drawing takes place
xform - the "original" transform that must be restored before drawing
publicOnly - if true, the shape is only drawn if it is public

contains

public boolean contains(double px,
                        double py)
Description copied from class: Shape
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e. in the same system with the coordinates of this shape, x and y)

Specified by:
contains in class Shape
Parameters:
px - the x coordinate relative to this shape's container
py - the y coordinate relative to this shape's container
Returns:
true if the shape contains the point with the given coordinates

onClickAt

public boolean onClickAt(double px,
                         double py,
                         boolean publicOnly)
Description copied from class: Shape
Should be overridden to test if the shape contains the point with the given coordinates, and, if yes, execute the shape's reaction on click at that point. This base implementation does nothing and return false

Overrides:
onClickAt in class Shape
Parameters:
px - the x coordinate of the click
py - the y coordinate of the click
publicOnly - if true, not public shape returns false
Returns:
true if the click has been handled AND further click processing is not needed, false otherwise

clone

public final Shape clone()
This method is not supported and throws exception:
Embedded object presentation cannot be cloned

Overrides:
clone in class Shape

setX

public void setX(double x)
Description copied from class: Shape
Sets the x coordinate of the shape

Overrides:
setX in class Shape
Parameters:
x - the new value of x coordinate

setY

public void setY(double y)
Description copied from class: Shape
Sets the y coordinate of the shape

Overrides:
setY in class Shape
Parameters:
y - the new value of y coordinate

setZ

public void setZ(double z)
Sets the z coordinate of the figure

Parameters:
z - the new value of z coordinate

getZ

public double getZ()
Returns the z coordinate of the shape.

Specified by:
getZ in interface Locatable3D
Returns:
the z coordinate of the shape

getZOffset

public double getZOffset()
Description copied from interface: Locatable3D
Returns the offset from z coordinate of the location base.
This e.g. returns getZHeight() for some 3D shapes

Specified by:
getZOffset in interface Locatable3D
Returns:
the offset from z coordinate of the location

setPos

public void setPos(double x,
                   double y)
Description copied from class: Shape
Sets both coordinates of the shape

Overrides:
setPos in class Shape
Parameters:
x - the new value of x coordinate
y - the new value of y coordinate

setPos

public void setPos(double x,
                   double y,
                   double z)
Sets coordinates of the shape

Parameters:
x - the new value of x coordinate
y - the new value of y coordinate
z - the new value of z coordinate

setScale

public void setScale(double scale)
Sets the scale of the figure along all the axes

Overrides:
setScale in class Shape
Parameters:
scale - the new value of scale

setScale

public void setScale(double sx,
                     double sy)
Description copied from class: Shape
Sets the scales of the shape along both axes

Overrides:
setScale in class Shape
Parameters:
sx - the new value of scale along x axis, 1 = keep original size
sy - the new value of scale along y axis, 1 = keep original size

setScaleX

public void setScaleX(double sx)
Description copied from class: Shape
Sets the scale of the shape along x axis

Overrides:
setScaleX in class Shape
Parameters:
sx - the new value of scale along x axis, 1 = keep original size

setScaleY

public void setScaleY(double sy)
Description copied from class: Shape
Sets the scale of the shape along y axis

Overrides:
setScaleY in class Shape
Parameters:
sy - the new value of scale along y axis, 1 = keep original size

setScaleZ

public void setScaleZ(double sz)
Sets the scale of the shape along z axis

Parameters:
sz - the new value of scale along z axis, 1 = keep original size

getScaleZ

public double getScaleZ()
Returns the scale of the shape along z axis

Returns:
the scale of the shape along z axis, 1 = keep original size

setRotation

public void setRotation(double rotation)
Description copied from class: Shape
Sets the rotation of the shape.

Overrides:
setRotation in class Shape
Parameters:
rotation - the new value of rotation in radians

setVisible

public void setVisible(boolean visible)
Description copied from class: Shape
Sets the visibility of the shape.

Overrides:
setVisible in class Shape
Parameters:
visible - visibility: true - visible, false - not

get3DElement_xjal

public Element3D_xjal get3DElement_xjal()
Description copied from interface: com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal
This method is internal and shouldn't be accessed by user.
It is public due to technical reasons.

Specified by:
get3DElement_xjal in interface com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal

set3DElement_xjal

public void set3DElement_xjal(Element3D_xjal element3D)
Description copied from interface: com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal
This method is internal and shouldn't be accessed by user.
It is public due to technical reasons.

Specified by:
set3DElement_xjal in interface com.xj.anylogic.engine.internal.presentation.Accessor3D_xjal

setContextReference_xjal

public void setContextReference_xjal(Presentable contextReference)
Description copied from interface: com.xj.anylogic.engine.internal.presentation.WorldObject3D_xjal
This method is internal and shouldn't be accessed by user.
It is public due to technical reasons.

Specified by:
setContextReference_xjal in interface com.xj.anylogic.engine.internal.presentation.WorldObject3D_xjal

isShowIn3D

public boolean isShowIn3D()
Returns true if this shape adds contents of embedded object to the 3D scene of parent active object, false otherwise

Returns:
whether this shape adds contents of embedded object to the 3D scene of parent active object, or not


Copyright © 1991-2008 XJ Technlogies. All Rights Reserved.