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

public class ShapeOval
extends ShapeLineFill
Persistent oval 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

Constructor Summary

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

Method Summary

Modifier and TypeMethodDescription
ShapeOvalclone()
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.
doublegetRadiusX()
Returns the "horizontal" radius of the oval.
doublegetRadiusY()
Returns the "vertical" radius of the oval.
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.
voidsetRadius(double radius)
Sets both radiuses of the oval to the same given value, i.e.
voidsetRadiusX(double radiusX)
Sets the "horizontal" radius of the oval.
voidsetRadiusY(double radiusY)
Sets the "vertical" radius of the oval.

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

ShapeOval

public ShapeOval()
Constructs an oval with default attributes.

ShapeOval

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

ShapeOval

public ShapeOval(ShapeDrawMode drawMode,
 boolean ispublic,
 double x,
 double y,
 double z,
 double rotation,
 Paint lineColor,
 Paint fillColor,
 double radiusX,
 double radiusY,
 double zHeight,
 double lineWidth,
 LineStyle lineStyle)
Constructs an oval 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 oval center
y - the y coordinate of the oval center
z - the z coordinate of the oval center
rotation - the rotation of the oval in radians
lineColor - line color (or Texture) of the oval
fillColor - fill color (or Texture) of the oval
radiusX - the radius of the oval along X-axis
radiusY - the radius of the oval along Y-axis
zHeight - the height of the oval along Z-axis
lineWidth - the line width of the oval
lineStyle - the line stroke style of the oval (only solid is supported)

Method Details

setRadiusX

public void setRadiusX(double radiusX)
Sets the "horizontal" radius of the oval.
Parameters:
radiusX - the "horizontal" radius of the oval

getRadiusX

public double getRadiusX()
Returns the "horizontal" radius of the oval.
Returns:
the "horizontal" radius of the oval

setRadius

public void setRadius(double radius)
Sets both radiuses of the oval to the same given value, i.e. makes it a circle.
Parameters:
radius - the circle radius

setRadiusY

public void setRadiusY(double radiusY)
Sets the "vertical" radius of the oval.
Parameters:
radiusY - the "vertical" radius of the oval

getRadiusY

public double getRadiusY()
Returns the "vertical" radius of the oval.
Returns:
the "vertical" radius of the oval

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 Shape
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)
Specified by:
contains in class Shape
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 ShapeOval 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 Shape

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