Package com.anylogic.engine.presentation
- Field Summary
- Constructor Summary
- Method Summary
- 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.Area2D
- Methods inherited from interface com.anylogic.engine.Area3D
- Methods inherited from interface com.anylogic.engine.Locatable3D
- 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.ShapeRectangle
- All Implemented Interfaces:
Area2D
,Area3D
,com.anylogic.engine.internal.Child
,Locatable2D
,Locatable3D
,AggregatableAnimationElement
,HasLevel
,LevelElement
,SVGElement
,Serializable
,Cloneable
- Direct Known Subclasses:
ShapeRoundedRectangle
public class ShapeRectangle extends ShapeLineFill implements Area3D
Persistent rectangle shape.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Constructor | Description |
---|---|
ShapeRectangle() |
Constructs a rectangle with default attributes.
|
ShapeRectangle |
Constructs a 2D-only rectangle with specific attributes.
|
ShapeRectangle |
Constructs a rectangle with specific attributes.
|
Modifier and Type | Method | Description |
---|---|---|
ShapeRectangle | clone() |
Creates and returns a copy of this shape (i.e.
|
boolean | contains |
Test if the shape contains the point with the given coordinates
(relative to this shape's container, i.e.
|
Point | getCenter() |
Returns (x, y) coordinates of the rectangle center in 2D (returned z is the base-level of rectangle).
|
Point | getCenter3D() |
Returns (x, y, z) coordinates of the rectangle center.
|
double | getHeight() |
Returns the height of the rectangle.
|
double | getWidth() |
Returns the width of the rectangle.
|
void | postSVGShapeSpecificAttributes |
Posts general properties specific to a particular shape class.
|
Point | randomPointInside |
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 | setHeight |
Sets the height of the rectangle.
|
void | setSize |
Sets the width and height of the rectangle.
|
void | setSize |
Sets the width, height and height along z axis (z-height) of the rectangle.
|
void | setWidth |
Sets the width of the rectangle.
|
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, setRotation, setScale, setScale, setScaleZ, setZ
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
public ShapeRectangle()
Constructs a rectangle with default attributes.
@AnyLogicLegacyAPI public ShapeRectangle(boolean ispublic, double x, double y, double rotation, Paint lineColor, Paint fillColor, double width, double height, double lineWidth, LineStyle lineStyle)
Constructs a 2D-only rectangle with specific attributes.
- Parameters:
ispublic
- iftrue
, the shape is visible on container's presentationx
- the x coordinate of the rectangle upper left cornery
- the y coordinate of the rectangle upper left cornerrotation
- the rotation of the rectangle in radianslineColor
- line color (orTexture
) of the rectanglefillColor
- fill color (orTexture
) of the rectanglewidth
- the width of the rectangleheight
- the height of the rectanglelineWidth
- the line width of the rectanglelineStyle
- the line stroke style of the rectangle (solid, dotted, dashed)
public ShapeRectangle(ShapeDrawMode drawMode, boolean ispublic, double x, double y, double z, double rotation, Paint lineColor, Paint fillColor, double width, double height, double zHeight, double lineWidth, LineStyle lineStyle)
Constructs a rectangle with specific attributes.
- Parameters:
drawMode
- where to draw this shape: 2D, 3D or 2D+3Dispublic
- iftrue
, the shape is visible on container's presentationx
- the x coordinate of the rectangle upper left corner on the XY-projectiony
- the y coordinate of the rectangle upper left corner on the XY-projectionz
- the z coordinate of the rectangle baserotation
- the rotation of the rectangle around Z-axis from +X to +Y, in radianslineColor
- line color (orTexture
) of the rectanglefillColor
- fill color (orTexture
) of the rectanglewidth
- the width of the rectangle on the XY-projectionheight
- the height of the rectangle on the XY-projectionzHeight
- the height of a rectangle along Z-axislineWidth
- the line width of the rectanglelineStyle
- the line stroke style of the rectangle (only solid is supported)
public void setWidth(double width)
Sets the width of the rectangle.
- Parameters:
width
- the new width of the rectangle
public double getWidth()
Returns the width of the rectangle.
public void setHeight(double height)
Sets the height of the rectangle.
- Parameters:
height
- the new height of the rectangle
public double getHeight()
Returns the height of the rectangle.
public Point getCenter()
Returns (x, y) coordinates of the rectangle center in 2D (returned z is the base-level of rectangle).
- Returns:
- coordinates of the rectangle center
public Point getCenter3D()
Returns (x, y, z) coordinates of the rectangle center.
- Returns:
- coordinates of the rectangle center
public void setSize(double width, double height)
Sets the width and height of the rectangle.
- Parameters:
width
- the new width of the rectangleheight
- the new height of the rectangle
public void setSize(double width, double height, double zHeight)
Sets the width, height and height along z axis (z-height) of the rectangle.
- Parameters:
width
- the new width of the rectangleheight
- the new height of the rectanglezHeight
- the new z-height of the rectangle
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.
This method utilises the given Random Number Generator.
Throws error if this shape type doesn't support returning random point inside.
- Overrides:
randomPointInside
in classShape
- Parameters:
rng
- the random number generator.- Returns:
- the randomly chosen point inside the shape area.
public boolean contains(double px, double py)
Description copied from class:
Shape
public ShapeRectangle 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 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