public class ShapeRectangle extends ShapeLineFill implements Area3D
UNKNOWN_NAME
Constructor and Description |
---|
ShapeRectangle()
Constructs a rectangle with default attributes.
|
ShapeRectangle(boolean ispublic,
double x,
double y,
double rotation,
java.awt.Paint lineColor,
java.awt.Paint fillColor,
double width,
double height,
double lineWidth,
LineStyle lineStyle)
Constructs a 2D-only rectangle with specific attributes.
|
ShapeRectangle(ShapeDrawMode drawMode,
boolean ispublic,
double x,
double y,
double z,
double rotation,
java.awt.Paint lineColor,
java.awt.Paint fillColor,
double width,
double height,
double zHeight,
double lineWidth,
LineStyle lineStyle)
Constructs a rectangle with specific attributes.
|
Modifier and Type | Method and Description |
---|---|
ShapeRectangle |
clone()
Creates and returns a copy of this shape (i.e. new shape instance).
|
boolean |
contains(double px,
double py)
|
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(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.
|
void |
setHeight(double height)
Sets the height of the rectangle.
|
void |
setSize(double width,
double height)
Sets the width and height of the rectangle.
|
void |
setSize(double width,
double height,
double zHeight)
Sets the width, height and height along z axis (z-height) of the rectangle.
|
void |
setWidth(double width)
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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getZ, getZHeight
getZOffset
initializeInternal, postInitialize
public ShapeRectangle()
@AnyLogicLegacyAPI public ShapeRectangle(boolean ispublic, double x, double y, double rotation, java.awt.Paint lineColor, java.awt.Paint fillColor, double width, double height, double lineWidth, LineStyle lineStyle)
ispublic
- if true
, 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 (or Texture
) of the rectanglefillColor
- fill color (or Texture
) 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, java.awt.Paint lineColor, java.awt.Paint fillColor, double width, double height, double zHeight, double lineWidth, LineStyle lineStyle)
drawMode
- where to draw this shape: 2D, 3D or 2D+3Dispublic
- if true
, 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 (or Texture
) of the rectanglefillColor
- fill color (or Texture
) 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)
width
- the new width of the rectanglepublic double getWidth()
public void setHeight(double height)
height
- the new height of the rectanglepublic double getHeight()
public Point getCenter()
public Point getCenter3D()
public void setSize(double width, double height)
width
- the new width of the rectangleheight
- the new height of the rectanglepublic void setSize(double width, double height, double zHeight)
width
- the new width of the rectangleheight
- the new height of the rectanglezHeight
- the new z-height of the rectanglepublic Point randomPointInside(java.util.Random rng)
Shape
randomPointInside
in class Shape
rng
- the random number generator.public boolean contains(double px, double py)
Shape
public ShapeRectangle clone()
Shape
public void postSVGShapeSpecificAttributes(java.util.List<java.lang.String> att, java.util.List<java.lang.String> val, boolean publicOnly)
Shape
postSVGShapeSpecificAttributes
in class ShapeLineFill
att
- attribute namesval
- attribute valuespublicOnly
- TODOCopyright © AnyLogic North America, LLC. All Rights Reserved.