Package com.anylogic.engine.presentation
- Field Summary
- 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 Details
- Method Details
- 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
,Serializable
,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
Constructor | Description |
---|---|
ShapePolyLine() |
Constructs a polyline with default attributes.
|
ShapePolyLine |
Constructs a 2D-only polyline with specific attributes.
|
ShapePolyLine |
Constructs a polyline with specific attributes.
|
Modifier and Type | Method | Description |
---|---|---|
ShapePolyLine | clone() |
Creates and returns a copy of this shape (i.e.
|
boolean | contains |
Tests if the polygon (based on this polyline points) contains the point with coordinates (x,y).
|
Position | getPosition | |
Position | getPosition | |
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 |
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 |
Returns the randomly chosen point inside the fill-area of the polyline (like if it was closed).
|
void | setRotation |
Sets the rotation of the shape.
|
void | setScale |
Sets the same scale of the shape along all the axes
|
void | setScale |
Sets the scales of the shape along both axes
|
void | setScaleX |
Sets the scale of the shape along x axis
|
void | setScaleY |
Sets the scale of the shape along y axis
|
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
public ShapePolyLine()
Constructs a polyline with default attributes.
public ShapePolyLine(boolean ispublic, double x, double y, Paint lineColor, 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, Paint lineColor, 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)
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(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
public void setScaleY(double sy)
Description copied from class:
Shape
Sets the scale of the shape along y axis
public void setScale(double s)
Description copied from class:
Shape
Sets the same scale of the shape along all the axes
public void setScale(double sx, double sy)
Description copied from class:
Shape
Sets the scales of the shape along both axes
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(List<String> att, List<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