AnyLogic
Expand
Font size
All Implemented Interfaces:
com.anylogic.engine.internal.Child, Locatable2D, Locatable3D, AggregatableAnimationElement, HasLevel, LevelElement, Path2D, Path3D, SVGElement, UsdElement, Serializable, Cloneable

public class ShapeCurve
extends ShapePolyLine
Persistent curve shape.
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Field Summary

Fields inherited from class com.anylogic.engine.presentation.Shape3D

UNKNOWN_NAME

Fields inherited from interface com.anylogic.engine.presentation.UsdElement

ID_NOT_SET

Constructor Summary

ConstructorDescription
ShapeCurve()
Constructs a curve with default attributes.
ShapeCurve(boolean ispublic, double x, double y, Color lineColor, Color fillColor, int npoints, double[] dx, double[] dy, boolean closed, double lineWidth, LineStyle lineStyle)
Deprecated.
use #ShapeCurve(boolean, double, double, Object, Object, int, boolean, double[], double[], boolean, double, LineStyle)
ShapeCurve(boolean ispublic, double x, double y, Paint lineColor, Paint fillColor, int npoints, boolean manualControlPoints, double[] dx, double[] dy, boolean closed, double lineWidth, LineStyle lineStyle)
Constructs a 2D-only curve with specific attributes.

Method Summary

Modifier and TypeMethodDescription
final ShapeCurveclone()
Creates and returns a copy of this shape (i.e.
booleancontains(double px, double py)
Tests if the polygon (based on this polyline points) contains the point with coordinates (x,y).
doublegetPointDx(int i)
Returns the x coordinate of a particular point of the shape relative to the start point.
In case of manual control points mode (isManualControlPoints() returns true) returns x-coordinates of control points too.
doublegetPointDy(int i)
Returns the y coordinate of a particular point of the shape relative to the start point.
In case of manual control points mode (isManualControlPoints() returns true) returns y-coordinates of control points too.
doublegetXMax()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.
doublegetXMin()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.
doublegetYMax()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.
doublegetYMin()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.
booleanisManualControlPoints()
Returns true if this curve uses manually specified control points (which are specified in the dx and dy arrays)
doublelength()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.
voidpostSVGShapeSpecificAttributes(List<String> att, List<String> val, boolean publicOnly)
Posts general properties specific to a particular shape class.
PointrandomPointInside(Random rng)
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.
voidsetManualControlPoints(boolean manualControlPoints)
Sets control points mode: manual or automatic.
In the manual mode curve uses control points specified in the dx and dy arrays
voidsetPoint(int i, double ptdx, double ptdy)
Sets the coordinates of a particular point of the shape relative to the start point.
In case of manual control points mode (isManualControlPoints() returns true) sets coordinates of control points too.
voidsetPointDx(int i, double ptdx)
Sets the x coordinate of a particular point of the shape relative to the start point.
In case of manual control points mode (isManualControlPoints() returns true) sets x-coordinates of control points too.
voidsetPointDy(int i, double ptdy)
Sets the y coordinate of a particular point of the shape relative to the start point.
In case of manual control points mode (isManualControlPoints() returns true) sets y-coordinates of control points too.

Methods inherited from class com.anylogic.engine.presentation.ShapePolyLine

getPosition, getPosition, randomPointInside, setRotation, setScale, setScale, setScaleX, setScaleY

Methods inherited from class com.anylogic.engine.presentation.ShapeMultiplePoints

getNPoints, getPointDz, isClosed, setClosed, setNPoints, setPoint, setPointDz

Methods inherited from class com.anylogic.engine.presentation.Shape3D

canHandleClick, getDrawMode, getScaleZ, getZ, setDrawMode, setPos, setPos, setPos, setScale, setScaleZ, setZ

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement

initializeInternal, postInitialize

Methods inherited from interface com.anylogic.engine.Locatable3D

getZOffset

Methods inherited from interface com.anylogic.engine.Path2D

getX, getY

Methods inherited from interface com.anylogic.engine.Path3D

getZ

Constructor Details

ShapeCurve

public ShapeCurve()
Constructs a curve with default attributes.

ShapeCurve

@Deprecated
public ShapeCurve(boolean ispublic,
 double x,
 double y,
 Color lineColor,
 Color fillColor,
 int npoints,
 double[] dx,
 double[] dy,
 boolean closed,
 double lineWidth,
 LineStyle lineStyle)
Deprecated.
use #ShapeCurve(boolean, double, double, Object, Object, int, boolean, double[], double[], boolean, double, LineStyle)

ShapeCurve

public ShapeCurve(boolean ispublic,
 double x,
 double y,
 Paint lineColor,
 Paint fillColor,
 int npoints,
 boolean manualControlPoints,
 double[] dx,
 double[] dy,
 boolean closed,
 double lineWidth,
 LineStyle lineStyle)
Constructs a 2D-only curve with specific attributes.
Parameters:
ispublic - if true, the curve is visible on container's presentation
x - the x coordinate of the curve start point
y - the y coordinate of the curve start point
lineColor - line color (or Texture) of the curve
fillColor - fill color (or Texture) of the curve
npoints - the number of points in the curve
dx - the array of (at least npoints) curve points x coordinates relative to the start point (if controlPointsIncluded == true, with control points, in triplets: p0x, p0c1x, p0c2x, p1x, p1c1x, p1c2x... )
dy - the array of (at least npoints) curve points y coordinates relative to the start point (if controlPointsIncluded == true, with control points, in triplets: p0y, p0c1y, p0c2y, p1y, p1c1y, p1c2y... )
manualControlPoints - if true curve is drawn using control points specified in the dx and dy arrays
closed - if true, the curve is drawn as closed
lineWidth - the curve width
lineStyle - the curve stroke style (solid, dotted, dashed)

Method Details

contains

public boolean contains(double px,
 double py)
Description copied from class: ShapePolyLine
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)
Overrides:
contains in class ShapePolyLine
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

length

public double length()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.
Overrides:
length in class ShapePolyLine
Returns:
the length of the polyline, respecting its closeness

getXMin

public double getXMin()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.
Overrides:
getXMin in class ShapePolyLine
Returns:
the minimum x coordinate of the polyline

getXMax

public double getXMax()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.
Overrides:
getXMax in class ShapePolyLine
Returns:
the maximum x coordinate of the polyline

getYMin

public double getYMin()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.
Overrides:
getYMin in class ShapePolyLine
Returns:
the minimum y coordinate of the polyline

getYMax

public double getYMax()
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.
Overrides:
getYMax in class ShapePolyLine
Returns:
the maximum y coordinate of the polyline

randomPointInside

public Point randomPointInside(Random rng)
This method isn't currently supported by Curve, it throws UnsupportedOperationException.
Please consider using polyline instead of curve.
Overrides:
randomPointInside in class ShapePolyLine
Parameters:
rng - the random number generator.
Returns:
the randomly chosen point inside the polyline

isManualControlPoints

public boolean isManualControlPoints()
Returns true if this curve uses manually specified control points (which are specified in the dx and dy arrays)
Returns:
true if this curve uses manually specified control points (which are specified in the dx and dy arrays)

setManualControlPoints

public void setManualControlPoints(boolean manualControlPoints)
Sets control points mode: manual or automatic.
In the manual mode curve uses control points specified in the dx and dy arrays
Parameters:
manualControlPoints - true for manually specified control points, false for automatically calculated

getPointDx

public double getPointDx(int i)
Returns the x coordinate of a particular point of the shape relative to the start point.
In case of manual control points mode (isManualControlPoints() returns true) returns x-coordinates of control points too. Each node point of curve is followed by 2 control points
Specified by:
getPointDx in interface Path2D
Overrides:
getPointDx in class ShapeMultiplePoints
Parameters:
i - the index of the point (starting from 0)
Returns:
the x coordinate of the point relative to the start point

getPointDy

public double getPointDy(int i)
Returns the y coordinate of a particular point of the shape relative to the start point.
In case of manual control points mode (isManualControlPoints() returns true) returns y-coordinates of control points too. Each node point of curve is followed by 2 control points
Specified by:
getPointDy in interface Path2D
Overrides:
getPointDy in class ShapeMultiplePoints
Parameters:
i - the index of the point (starting from 0)
Returns:
the y coordinate of the point relative to the start point

setPointDx

public void setPointDx(int i,
 double ptdx)
Sets the x coordinate of a particular point of the shape relative to the start point.
In case of manual control points mode (isManualControlPoints() returns true) sets x-coordinates of control points too. Each node point of curve is followed by 2 control points
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)
Sets the y coordinate of a particular point of the shape relative to the start point.
In case of manual control points mode (isManualControlPoints() returns true) sets y-coordinates of control points too. Each node point of curve is followed by 2 control points
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

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.
In case of manual control points mode (isManualControlPoints() returns true) sets coordinates of control points too. Each node point of curve is followed by 2 control points
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

clone

public final ShapeCurve 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
Overrides:
clone in class ShapePolyLine

postSVGShapeSpecificAttributes

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 class ShapePolyLine
Parameters:
att - attribute names
val - attribute values
publicOnly - TODO