AnyLogic AnyLogic
Expand
Font size
All Implemented Interfaces:
com.anylogic.engine.internal.Child, Locatable2D, Locatable3D, AggregatableAnimationElement, HasLevel, LevelElement, SVGElement, java.io.Serializable, java.lang.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

Constructors 
ShapeArc()
Constructs an arc with default attributes.
ShapeArc​(boolean ispublic, double x, double y, double rotation, java.awt.Paint lineColor, java.awt.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, java.awt.Paint lineColor, java.awt.Paint fillColor, double radiusX, double radiusY, double zHeight, double dz, double angleStart, double angle, double lineWidth, LineStyle lineStyle)
Constructs an arc with specific attributes.
Constructor Description

Method Summary

All Methods Instance Methods Concrete Methods 
ShapeArc clone()
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
boolean contains​(double px, double py)
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)
double getAngle()
Returns the angular extent of the arc in radians, clockwise.
double getAngleStart()
Returns the starting angle of the arc (0 means 3 o'clock) in radians, clockwise.
double getDz()
Returns the difference of z coordinates of the arc end and start points.
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​(java.util.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.
void setAngle​(double angle)
Sets the angular extent of the arc in radians, clockwise.
void setAngleStart​(double angleStart)
Sets the starting angle of the arc (0 means 3 o'clock) in radians, clockwise.
void setDz​(double dz)
Sets the difference of z coordinates of the arc end and start points.
Modifier and Type Method Description

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

getRadiusX, getRadiusY, setRadius, setRadiusX, setRadiusY

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

getFillColor, getFillTexture, getLineColor, getLineStyle, getLineTexture, getLineWidth, getPresentable, getZHeight, getZOffset, setContextReference_xjal, setFillColor, setFillColor, setLineColor, setLineColor, setLineStyle, setLineWidth, setZHeight

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 com.anylogic.engine.presentation.Shape

executeUserAction, findSVGElement, getGroup, getLevel, getName, getRotation, getScaleX, getScaleY, getSVGId, getX, getY, isJava2DSwingPresentation, isPublic_xjal, isSVGPresentation, isVisible, onAggregatorVisibilityChanged, onClick, randomPointInside, removeSVGFromOwner, removeSVGImage, resetSVGState, restoreOwner, setLevel, setPublic_xjal, setScale, setScaleX, setScaleY, setVisible, setX, setY, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties

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 Detail

ShapeArc

public ShapeArc()
Constructs an arc with default attributes.

ShapeArc

public ShapeArc​(boolean ispublic,
                double x,
                double y,
                double rotation,
                java.awt.Paint lineColor,
                java.awt.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,
                java.awt.Paint lineColor,
                java.awt.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 Detail

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​(java.util.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​(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 class ShapeOval
Parameters:
att - attribute names
val - attribute values
publicOnly - TODO
How can we improve this article?