Package com.anylogic.engine.presentation
- Field Summary
- Fields inherited from class com.anylogic.engine.presentation.Shape3D
- Constructor Summary
- Method Summary
- Methods inherited from class com.anylogic.engine.presentation.ShapeMultiplePoints
- Methods inherited from class com.anylogic.engine.presentation.ShapeLineFill
- Methods inherited from class com.anylogic.engine.presentation.Shape3D
- Methods inherited from class com.anylogic.engine.presentation.Shape
- Methods inherited from class java.lang.Object
- Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement
- Methods inherited from interface com.anylogic.engine.Locatable3D
- Methods inherited from interface com.anylogic.engine.Path2D
- Methods inherited from interface com.anylogic.engine.Path3D
- Constructor Detail
- Method Detail
- java.lang.Object
-
- com.anylogic.engine.presentation.Shape
-
- com.anylogic.engine.presentation.Shape3D
-
- com.anylogic.engine.presentation.ShapeLineFill
-
- com.anylogic.engine.presentation.ShapeMultiplePoints
-
- com.anylogic.engine.presentation.ShapePolyLine
- All Implemented Interfaces:
com.anylogic.engine.internal.Child
,Locatable2D
,Locatable3D
,AggregatableAnimationElement
,HasLevel
,LevelElement
,Path2D
,Path3D
,SVGElement
,java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
ShapeCurve
public class ShapePolyLine extends ShapeMultiplePoints
Persistent polyline shape.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
UNKNOWN_NAME
ShapePolyLine() |
Constructs a polyline with default attributes.
|
ShapePolyLine(boolean ispublic,
double x,
double y,
java.awt.Paint lineColor,
java.awt.Paint fillColor,
int npoints,
double[] dx,
double[] dy,
boolean closed,
double lineWidth,
LineStyle lineStyle) |
Constructs a 2D-only polyline with specific attributes.
|
ShapePolyLine(ShapeDrawMode drawMode,
boolean ispublic,
double x,
double y,
double z,
java.awt.Paint lineColor,
java.awt.Paint fillColor,
int npoints,
double[] dx,
double[] dy,
double[] dz,
boolean closed,
double zHeight,
double lineWidth,
LineStyle lineStyle) |
Constructs a polyline with specific attributes.
|
Constructor | Description |
---|
ShapePolyLine |
clone() |
Creates and returns a copy of this shape (i.e.
|
boolean |
contains(double px,
double py) |
Tests if the polygon (based on this polyline points) contains the point with coordinates (x,y).
|
Position |
getPosition(double value,
double maxValue,
boolean reverseOffset,
Position out) |
|
Position |
getPosition(int index,
int totalNumber,
Position out) |
|
double |
getXMax() |
Returns the x coordinate of the bottom-right corner of bounding rectangle for this polyline.
|
double |
getXMin() |
Returns the x coordinate of the top-left corner of bounding rectangle for this polyline.
|
double |
getYMax() |
Returns the y coordinate of the bottom-right corner of bounding rectangle for this polyline.
|
double |
getYMin() |
Returns the y coordinate of the top-left corner of bounding rectangle for this polyline.
|
double |
length() |
Calculates and returns the length of the polyline (not scaled), respecting its closeness.
For 3D polylines this method also respects z coordinates of points. This method doesn't work for Curve. |
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.
|
Point |
randomPointInside() |
Returns the randomly chosen point inside the fill-area of the polyline (like if it was closed).
|
Point |
randomPointInside(java.util.Random rng) |
Returns the randomly chosen point inside the fill-area of the polyline (like if it was closed).
|
void |
setRotation(double r) |
Sets the rotation of the shape.
|
void |
setScale(double s) |
Sets the same scale of the shape 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
|
Modifier and Type | Method | Description |
---|
getNPoints, getPointDx, getPointDy, getPointDz, isClosed, setClosed, setNPoints, setPoint, setPoint, setPointDx, setPointDy, setPointDz
getFillColor, getFillTexture, getLineColor, getLineStyle, getLineTexture, getLineWidth, getPresentable, getZHeight, getZOffset, setContextReference_xjal, setFillColor, setFillColor, setLineColor, setLineColor, setLineStyle, setLineWidth, setZHeight
canHandleClick, getDrawMode, getScaleZ, getZ, setDrawMode, setPos, setPos, setPos, setScale, setScaleZ, setZ
executeUserAction, findSVGElement, getGroup, getLevel, getName, getRotation, getScaleX, getScaleY, getSVGId, getX, getY, isJava2DSwingPresentation, isPublic_xjal, isSVGPresentation, isVisible, onAggregatorVisibilityChanged, onClick, removeSVGFromOwner, removeSVGImage, resetSVGState, restoreOwner, setLevel, setPublic_xjal, setVisible, setX, setY, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeInternal, postInitialize
getZOffset
getX, getY
getZ
public ShapePolyLine()
Constructs a polyline with default attributes.
public ShapePolyLine(boolean ispublic, double x, double y, java.awt.Paint lineColor, java.awt.Paint fillColor, int npoints, double[] dx, double[] dy, boolean closed, double lineWidth, LineStyle lineStyle)
Constructs a 2D-only polyline with specific attributes.
- Parameters:
ispublic
- iftrue
, the polyline is visible on container's presentationx
- the x coordinate of the polyline start pointy
- the y coordinate of the polyline start pointlineColor
- line color (orTexture
) of the polylinefillColor
- fill color (orTexture
) of the polylinenpoints
- the number of points in the polylinedx
- the array of (at least npoints) polyline points x coordinates relative to the start pointdy
- the array of (at least npoints) polyline points y coordinates relative to the start pointclosed
- iftrue
, the polyline is drawn as closedlineWidth
- the polyline widthlineStyle
- the polyline stroke style (solid, dotted, dashed)
public ShapePolyLine(ShapeDrawMode drawMode, boolean ispublic, double x, double y, double z, java.awt.Paint lineColor, java.awt.Paint fillColor, int npoints, double[] dx, double[] dy, double[] dz, boolean closed, double zHeight, double lineWidth, LineStyle lineStyle)
Constructs a polyline with specific attributes.
- Parameters:
drawMode
- where to draw this shape: 2D, 3D or 2D+3Dispublic
- iftrue
, the polyline is visible on container's presentationx
- the x coordinate of the polyline start pointy
- the y coordinate of the polyline start pointz
- the z coordinate of the polyline start pointlineColor
- line color (orTexture
) of the polylinefillColor
- fill color (orTexture
) of the polylinenpoints
- the number of points in the polylinedx
- the array of (at least npoints) polyline points x coordinates relative to the start pointdy
- the array of (at least npoints) polyline points y coordinates relative to the start pointdz
- the array of (at least npoints) polyline points z coordinates relative to the start pointclosed
- iftrue
, the polyline is drawn as closedzHeight
- the height of a polyline along Z-axislineWidth
- the polyline widthlineStyle
- the polyline stroke style (only solid is supported)
public boolean contains(double px, double py)
Tests if the polygon (based on this polyline points) contains the point with coordinates (x,y).
(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 classShape
- Parameters:
px
- the x coordinate relative to this shape's containerpy
- the y coordinate relative to this shape's container- Returns:
true
if the shape contains the point with the given coordinates
public Point randomPointInside()
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)
randomPointInside(Random)
).Returned point is set to the z coordinate of the polyline (zero in case of 2D)
- Overrides:
randomPointInside
in classShape
- Returns:
- the randomly chosen point inside the polyline
public Point randomPointInside(java.util.Random rng)
Returns the randomly chosen point inside the fill-area of the polyline (like if it was closed).
This method utilises the given Random Number Generator.
Returned point is set to the z coordinate of the polyline (zero in case of 2D)
Returned point is set to the z coordinate of the polyline (zero in case of 2D)
- Overrides:
randomPointInside
in classShape
- Parameters:
rng
- the random number generator.- Returns:
- the randomly chosen point inside the polyline
public void setRotation(double r)
Description copied from class:
Shape
Sets the rotation of the shape.
- Overrides:
setRotation
in classShape3D
- Parameters:
r
- the new value of rotation in radians
public void setScaleX(double sx)
Description copied from class:
Shape
Sets the scale of the shape along x axis
- Overrides:
setScaleX
in classShape
- Parameters:
sx
- the new value of scale along x axis, 1 = keep original size
public void setScaleY(double sy)
Description copied from class:
Shape
Sets the scale of the shape along y axis
- Overrides:
setScaleY
in classShape
- Parameters:
sy
- the new value of scale along y axis, 1 = keep original size
public void setScale(double s)
Description copied from class:
Shape
Sets the same scale of the shape along all the axes
- Overrides:
setScale
in classShape3D
- Parameters:
s
- the new value of scale along all the axes, 1 = keep original size
public void setScale(double sx, double sy)
Description copied from class:
Shape
Sets the scales of the shape along both axes
- Overrides:
setScale
in classShape
- Parameters:
sx
- the new value of scale along x axis, 1 = keep original sizesy
- the new value of scale along y axis, 1 = keep original size
public double getXMin()
Returns the x coordinate of the top-left corner of bounding rectangle for this polyline.
(
Shape.getX()
is included)- Returns:
- the minimum x coordinate of the polyline
public double getXMax()
Returns the x coordinate of the bottom-right corner of bounding rectangle for this polyline.
(
Shape.getX()
is included)- Returns:
- the maximum x coordinate of the polyline
- Since:
- 6.8
public double getYMin()
Returns the y coordinate of the top-left corner of bounding rectangle for this polyline.
(
Shape.getY()
is included)- Returns:
- the minimum y coordinate of the polyline
- Since:
- 6.8
public double getYMax()
Returns the y coordinate of the bottom-right corner of bounding rectangle for this polyline.
(
Shape.getY()
is included)- Returns:
- the maximum y coordinate of the polyline
- Since:
- 6.8
public double length()
Calculates and returns the length of the polyline (not scaled), respecting its closeness.
For 3D polylines this method also respects z coordinates of points.
This method doesn't work for Curve.
For 3D polylines this method also respects z coordinates of points.
This method doesn't work for Curve.
- Returns:
- the length of the polyline, respecting its closeness
public ShapePolyLine 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 agent
Note that cloning of GIS shape, controls and charts is not supported
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 agent
Note that cloning of GIS shape, controls and charts is not supported
public Position getPosition(int index, int totalNumber, Position out)
public Position getPosition(double value, double maxValue, boolean reverseOffset, Position out)
public void postSVGShapeSpecificAttributes(java.util.List<java.lang.String> att, java.util.List<java.lang.String> val, boolean publicOnly)
Description copied from class:
Shape
Posts general properties specific to a particular shape class.
Is triggered by SVG_DIRTY_SHAPE flag.
Made public for occasional posting of additional SVG properties from outside engine
(e.g. from libraries)
- Overrides:
postSVGShapeSpecificAttributes
in classShapeLineFill
- Parameters:
att
- attribute namesval
- attribute valuespublicOnly
- TODO
-
How can we improve this article?
-