com.xj.anylogic.engine.presentation
Class Shape3DPolyLine

java.lang.Object
  extended by com.xj.anylogic.engine.presentation.Shape
      extended by com.xj.anylogic.engine.presentation.ShapeLineFill
          extended by com.xj.anylogic.engine.presentation.ShapeMultiplePoints
              extended by com.xj.anylogic.engine.presentation.ShapePolyLine
                  extended by com.xj.anylogic.engine.presentation.Shape3DPolyLine
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, Path2D, Path3D, java.io.Serializable, java.lang.Cloneable

public class Shape3DPolyLine
extends ShapePolyLine
implements Path3D, com.xj.anylogic.engine.internal.presentation.WorldObject3D_xjal

Persistent 3D polyline shape. Also visible on 2D animation.
3D surface is actually an extrusion of an ordinary Polyline shape by Z-Height amount along +Z axis.
Note that 3D polyline has a differen

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
Shape3DPolyLine()
          Constructs a polyline with default attributes.
Shape3DPolyLine(boolean ispublic, double x, double y, double z, java.lang.Object lineColor, java.lang.Object fillColor, int npoints, double[] dx, double[] dy, double[] dz, boolean closed, double zHeight, double lineWidth, int lineStyle)
          Constructs a 3D polyline with specific attributes.
 
Method Summary
 Shape3DPolyLine clone()
          Creates and returns a copy of this shape (i.e. new shape instance).
 void draw(Panel panel, java.awt.Graphics2D g, java.awt.geom.AffineTransform xform, boolean publicOnly)
          Draws the polyline in a given context
 Element3D_xjal get3DElement_xjal()
          This method is internal and shouldn't be accessed by user.
 double getPointDz(int i)
          Returns the z coordinate of a particular point of the shape relative to the start point.
 Presentable getPresentable()
          Returns the Presentable object (ActiveObject or Experiment) where this shape belongs to, or null.
 double getScaleZ()
          Returns the scale of the shape along z axis
 double getZ()
          Returns the z coordinate of the shape.
 double getZHeight()
          Returns the height of the polyline along Z-axis
 double getZOffset()
          Returns the offset from z coordinate of the location base.
 Point randomPointInside()
          Returns the randomly chosen point inside the fill-area of the polyline (like if it was closed).
 void set3DElement_xjal(Element3D_xjal element3D)
          This method is internal and shouldn't be accessed by user.
 void setClosed(boolean closed)
          Sets the shape closed or open.
 void setContextReference_xjal(Presentable contextReference)
          This method is internal and shouldn't be accessed by user.
 void setFillColor(java.lang.Object fillColor)
          Sets the fill color (or Texture) of the shape.
 void setLineColor(java.lang.Object lineColor)
          Sets the line color (or Texture) of the shape.
 void setLineStyle(int style)
          Does nothing: the only supported in 3D line style is solid
 void setLineWidth(double width)
          Sets the line width of the shape, 0 means thinnest possible
 void setNPoints(int n)
          Sets the number of points in the shape.
 void setPoint(int i, double ptdx, double ptdy)
          Sets the coordinates of a particular point of the shape relative to the start point.
 void setPoint(int i, double ptdx, double ptdy, double ptdz)
          Sets the coordinates of a particular point of the shape relative to the start point.
 void setPointDx(int i, double ptdx)
          Sets the x coordinate of a particular point of the shape relative to the start point.
 void setPointDy(int i, double ptdy)
          Sets the y coordinate of a particular point of the shape relative to the start point.
 void setPointDz(int i, double ptdz)
          Sets the z coordinate of a particular point of the shape relative to the start point.
 void setPos(double x, double y)
          Sets (x, y) 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
 void setZHeight(double zHeight)
          Sets the height of the polyline along Z-axis
 
Methods inherited from class com.xj.anylogic.engine.presentation.ShapePolyLine
contains, getXMax, getXMin, getYMax, getYMin, length, onClickAt, randomPointInside
 
Methods inherited from class com.xj.anylogic.engine.presentation.ShapeMultiplePoints
getNPoints, getPointDx, getPointDy, isClosed
 
Methods inherited from class com.xj.anylogic.engine.presentation.ShapeLineFill
getFillColor, getFillTexture, getLineColor, getLineStyle, getLineTexture, getLineWidth, setFillColor, setLineColor
 
Methods inherited from class com.xj.anylogic.engine.presentation.Shape
canHandleClick, getGroup, getName, getRotation, getScaleX, getScaleY, getX, getY, isVisible, onClick, restoreOwner
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.xj.anylogic.engine.Path2D
getNPoints, getPointDx, getPointDy, getX, getY
 

Constructor Detail

Shape3DPolyLine

public Shape3DPolyLine()
Constructs a polyline with default attributes.


Shape3DPolyLine

public Shape3DPolyLine(boolean ispublic,
                       double x,
                       double y,
                       double z,
                       java.lang.Object lineColor,
                       java.lang.Object fillColor,
                       int npoints,
                       double[] dx,
                       double[] dy,
                       double[] dz,
                       boolean closed,
                       double zHeight,
                       double lineWidth,
                       int lineStyle)
Constructs a 3D polyline with specific attributes.

Parameters:
ispublic - if true, the polyline is visible on container's presentation
x - the x coordinate of the polyline start point
y - the y coordinate of the polyline start point
z - the z coordinate of the polyline start point
lineColor - line color (or Texture) of the polyline
fillColor - fill color (or Texture) of the polyline
npoints - the number of points in the polyline
dx - the array of (at least npoints) polyline points x coordinates relative to the start point
dy - the array of (at least npoints) polyline points y coordinates relative to the start point
dz - the array of (at least npoints) polyline points z coordinates relative to the start point
closed - if true, the polyline is drawn as closed
zHeight - the height of a polyline along Z-axis
lineWidth - the polyline width
lineStyle - the polyline stroke style (only solid is supported)
Method Detail

draw

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

Overrides:
draw in class ShapePolyLine
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

clone

public Shape3DPolyLine clone()
Description copied from class: Shape
Creates and returns a copy of this shape (i.e. new shape instance).
The returned shape is the object of the same class
The returned copy isn't automatically added to the group this shape belongs to.
The clone is created in the context of the same experiment or active object

Note that cloning of GIS shape, controls and charts is not supported

Overrides:
clone in class ShapePolyLine

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
Specified by:
getZ in interface Path3D
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

setZHeight

public void setZHeight(double zHeight)
Sets the height of the polyline along Z-axis

Parameters:
zHeight - the new value of z-height

getZHeight

public double getZHeight()
Returns the height of the polyline along Z-axis

Returns:
the height of the polyline along Z-axis

setPointDx

public void setPointDx(int i,
                       double ptdx)
Description copied from class: ShapeMultiplePoints
Sets the x coordinate of a particular point of the shape relative to the start point.

Overrides:
setPointDx in class ShapeMultiplePoints
Parameters:
i - the index of the point (starting from 0)
ptdx - the new x coordinate of the point relative to the start point

setPointDy

public void setPointDy(int i,
                       double ptdy)
Description copied from class: ShapeMultiplePoints
Sets the y coordinate of a particular point of the shape relative to the start point.

Overrides:
setPointDy in class ShapeMultiplePoints
Parameters:
i - the index of the point (starting from 0)
ptdy - the new y coordinate of the point relative to the start point

setPointDz

public void setPointDz(int i,
                       double ptdz)
Sets the z coordinate of a particular point of the shape relative to the start point.

Parameters:
i - the index of the point (starting from 0)
ptdz - the new z coordinate of the point relative to the start point

getPointDz

public double getPointDz(int i)
Returns the z coordinate of a particular point of the shape relative to the start point.

Specified by:
getPointDz in interface Path3D
Parameters:
i - the index of the point (starting from 0)
Returns:
the z coordinate of the point relative to the start point

setPoint

public void setPoint(int i,
                     double ptdx,
                     double ptdy)
Sets the coordinates of a particular point of the shape relative to the start point.
Z-coordinate is left unchanged

Overrides:
setPoint in class ShapeMultiplePoints
Parameters:
i - the index of the point (starting from 0)
ptdx - the new x coordinate of the point relative to the start point
ptdy - the new y coordinate of the point relative to the start point

setPoint

public void setPoint(int i,
                     double ptdx,
                     double ptdy,
                     double ptdz)
Sets the coordinates of a particular point of the shape relative to the start point.

Parameters:
i - the index of the point (starting from 0)
ptdx - the new x coordinate of the point relative to the start point
ptdy - the new y coordinate of the point relative to the start point
ptdz - the new z coordinate of the point relative to the start point

setClosed

public void setClosed(boolean closed)
Description copied from class: ShapeMultiplePoints
Sets the shape closed or open.

Overrides:
setClosed in class ShapeMultiplePoints
Parameters:
closed - visibility: true - visible, false - not

setNPoints

public void setNPoints(int n)
Description copied from class: ShapeMultiplePoints
Sets the number of points in the shape. Does nothing if the number of points equals the current one. If it is different, the maximum possible portion of points keep their coordinates in the new shape.

Overrides:
setNPoints in class ShapeMultiplePoints
Parameters:
n - the new number of points

setLineWidth

public void setLineWidth(double width)
Description copied from class: ShapeLineFill
Sets the line width of the shape, 0 means thinnest possible

Overrides:
setLineWidth in class ShapeLineFill
Parameters:
width - the new line width of the shape

setLineStyle

public void setLineStyle(int style)
Does nothing: the only supported in 3D line style is solid

Overrides:
setLineStyle in class ShapeLineFill
Parameters:
style - the new style of the shape

setLineColor

public void setLineColor(java.lang.Object lineColor)
Description copied from class: ShapeLineFill
Sets the line color (or Texture) of the shape.

Overrides:
setLineColor in class ShapeLineFill
Parameters:
lineColor - the new line color, null = do not draw the shape line

setFillColor

public void setFillColor(java.lang.Object fillColor)
Description copied from class: ShapeLineFill
Sets the fill color (or Texture) of the shape.

Overrides:
setFillColor in class ShapeLineFill
Parameters:
fillColor - the new fill color, null = do not fill the shape

setPos

public void setPos(double x,
                   double y)
Sets (x, y) coordinates of the shape.
Z-coordinate is left unchanged

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

getPresentable

public Presentable getPresentable()
Description copied from class: Shape
Returns the Presentable object (ActiveObject or Experiment) where this shape belongs to, or null.

Specified by:
getPresentable in interface com.xj.anylogic.engine.internal.presentation.WorldObject3D_xjal
Overrides:
getPresentable in class Shape
Returns:
the Presentable that owns this shape, or null

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

randomPointInside

public Point randomPointInside()
Description copied from class: ShapePolyLine
Returns the randomly chosen point inside the fill-area of the polyline (like if it was closed). This method utilises Random Number Generator of the Presentable object containing this polyline. (Will throw an exception if the polyline has been created from code and hasn't been added to any group, - in such case please use #).
Returned point is set to the z coordinate of the polyline (zero in case of 2D)

Overrides:
randomPointInside in class ShapePolyLine
Returns:
the randomly chosen point inside the polyline


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