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

public class ShapeArc
extends ShapeOval
Arc shape. The shape has a start angle and a angular extent, or simply angle. For angles equal to 2*PI (with a certain tolerance), a full circle is drawn. For angles greater than 2*PI, the remainder of the angle divided by 2*PI is drawn.
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

Constructor Summary

ConstructorDescription
ShapeArc()
Constructs an arc with default attributes.
ShapeArc(boolean ispublic, double x, double y, double rotation, Paint lineColor, Paint fillColor, double radiusX, double radiusY, double angleStart, double angle, double lineWidth, LineStyle lineStyle)
Constructs a 2D-only arc with specific attributes.
ShapeArc(ShapeDrawMode drawMode, boolean ispublic, double x, double y, double z, double rotation, Paint lineColor, Paint fillColor, double radiusX, double radiusY, double zHeight, double dz, double angleStart, double angle, double lineWidth, LineStyle lineStyle)
Constructs an arc with specific attributes.

Method Summary

Modifier and TypeMethodDescription
ShapeArcclone()
Creates and returns a copy of this shape (i.e.
booleancontains(double px, double py)
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e.
doublegetAngle()
Returns the angular extent of the arc in radians, clockwise.
doublegetAngleStart()
Returns the starting angle of the arc (0 means 3 o'clock) in radians, clockwise.
doublegetDz()
Returns the difference of z coordinates of the arc end and start points.
voidpostSVGShapeSpecificAttributes(List<String> att, List<String> val, boolean publicOnly)
Posts general properties specific to a particular shape class.
PointrandomPointInside(Random rng)
Returns the randomly chosen point inside the shape area.
This method utilises the given Random Number Generator.
Throws error if this shape type doesn't support returning random point inside.
voidsetAngle(double angle)
Sets the angular extent of the arc in radians, clockwise.
voidsetAngleStart(double angleStart)
Sets the starting angle of the arc (0 means 3 o'clock) in radians, clockwise.
voidsetDz(double dz)
Sets the difference of z coordinates of the arc end and start points.

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

getRadiusX, getRadiusY, setRadius, setRadiusX, setRadiusY

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

canHandleClick, getDrawMode, getScaleZ, getZ, setDrawMode, setPos, setPos, setPos, setRotation, setScale, 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.Locatable2D

getX, getY

Constructor Details

ShapeArc

public ShapeArc()
Constructs an arc with default attributes.

ShapeArc

public ShapeArc(boolean ispublic,
 double x,
 double y,
 double rotation,
 Paint lineColor,
 Paint fillColor,
 double radiusX,
 double radiusY,
 double angleStart,
 double angle,
 double lineWidth,
 LineStyle lineStyle)
Constructs a 2D-only arc with specific attributes.
Parameters:
ispublic - if true, the shape is visible on container's presentation
x - the x coordinate of the arc center
y - the y coordinate of the arc
rotation - the rotation of the arc in radians
lineColor - line color (or Texture) of the arc
fillColor - fill color (or Texture) of the arc
radiusX - "horizontal" radius of the arc
radiusY - "vertical" radius of the arc
angleStart - the starting angle of the arc (0 means 3 o'clock) in radians, clockwise
angle - the angular extent of the arc in radians, clockwise
lineWidth - the line width of the arc
lineStyle - the line stroke style of the arc (solid, dotted, dashed)

ShapeArc

public ShapeArc(ShapeDrawMode drawMode,
 boolean ispublic,
 double x,
 double y,
 double z,
 double rotation,
 Paint lineColor,
 Paint fillColor,
 double radiusX,
 double radiusY,
 double zHeight,
 double dz,
 double angleStart,
 double angle,
 double lineWidth,
 LineStyle lineStyle)
Constructs an arc with specific attributes.
Parameters:
drawMode - where to draw this shape: 2D, 3D or 2D+3D
ispublic - if true, the shape is visible on container's presentation
x - the x coordinate of the arc center
y - the y coordinate of the arc center
z - the z coordinate of the arc center
rotation - the rotation of the arc in radians
lineColor - line color (or Texture) of the arc
fillColor - fill color (or Texture) of the arc
radiusX - the radius of the arc along X-axis
radiusY - the radius of the arc along Y-axis
zHeight - the height of the arc along Z-axis
dz - the difference of z coordinates of the arc end and start points
angleStart - the starting angle of the arc (0 means 3 o'clock) in radians, clockwise
angle - the angular extent of the arc in radians, clockwise
lineWidth - the line width of the arc
lineStyle - the line stroke style of the arc (only solid is supported)

Method Details

setAngleStart

public void setAngleStart(double angleStart)
Sets the starting angle of the arc (0 means 3 o'clock) in radians, clockwise.
Parameters:
angleStart - the starting angle of the arc

getAngleStart

public double getAngleStart()
Returns the starting angle of the arc (0 means 3 o'clock) in radians, clockwise.
Returns:
the starting angle of the arc

setAngle

public void setAngle(double angle)
Sets the angular extent of the arc in radians, clockwise. For angles equal to 2*PI (with a certain tolerance), a full circle is drawn. For angles greater than 2*PI, the remainder of the angle divided by 2*PI is drawn.
Parameters:
angle - the angular extent of the arc

getAngle

public double getAngle()
Returns the angular extent of the arc in radians, clockwise.
Returns:
the angular extent of the arc

setDz

public void setDz(double dz)
Sets the difference of z coordinates of the arc end and start points.
Parameters:
dz - the new difference of z coordinates of the arc end and start points

getDz

public double getDz()
Returns the difference of z coordinates of the arc end and start points.
Returns:
the difference of z coordinates of the arc end and start points

randomPointInside

public Point randomPointInside(Random rng)
Description copied from class: Shape
Returns the randomly chosen point inside the shape area.
This method utilises the given Random Number Generator.
Throws error if this shape type doesn't support returning random point inside.
Overrides:
randomPointInside in class ShapeOval
Parameters:
rng - the random number generator.
Returns:
the randomly chosen point inside the shape area.

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)
Overrides:
contains in class ShapeOval
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

clone

public ShapeArc 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 ShapeOval

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