Package com.anylogic.engine.presentation
- Field Summary
- Fields inherited from class com.anylogic.engine.presentation.Shape3D
- Constructor Summary
- Method Summary
- 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.Locatable2D
- Constructor Detail
- Method Detail
- java.lang.Object
-
- com.anylogic.engine.presentation.Shape
-
- com.anylogic.engine.presentation.Shape3D
-
- com.anylogic.engine.presentation.ShapeText
- All Implemented Interfaces:
com.anylogic.engine.internal.Child
,Locatable2D
,Locatable3D
,AggregatableAnimationElement
,HasLevel
,LevelElement
,SVGElement
,java.io.Serializable
,java.lang.Cloneable
public class ShapeText extends Shape3D
Persistent text shape.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
UNKNOWN_NAME
ShapeText() |
Constructs a text shape with default attributes.
|
ShapeText(boolean ispublic,
double x,
double y,
double rotation,
java.awt.Color color,
java.lang.String text,
java.awt.Font font,
TextAlignment alignment) |
Constructs a 2D-only text shape with specific attributes.
|
ShapeText(ShapeDrawMode drawMode,
boolean ispublic,
double x,
double y,
double z,
double rotation,
java.awt.Color color,
java.lang.String text,
java.awt.Font font,
TextAlignment alignment) |
Constructs a text shape with specific attributes.
|
Constructor | Description |
---|
ShapeText |
clone() |
Creates and returns a copy of this shape (i.e.
|
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.
|
TextAlignment |
getAlignment() |
Returns the alignment of the text shape.
|
java.awt.Color |
getColor() |
Returns the color of the text.
|
java.awt.Font |
getFont() |
Returns the font of the text shape.
|
Presentable |
getPresentable() |
Returns the Presentable object (
Agent or Experiment ) where
this shape belongs to, or null. |
java.lang.String |
getText() |
Returns the text of the text shape.
|
void |
setAlignment(TextAlignment alignment) |
Sets the alignment of the text shape.
|
void |
setColor(java.awt.Color color) |
Sets the color of the text.
|
void |
setContextReference_xjal(Presentable contextReference) |
Deprecated.
|
void |
setFont(java.awt.Font font) |
Sets the font of the text shape.
|
void |
setText(java.lang.Object text) |
Sets the text of the text shape.
|
Modifier and Type | Method | Description |
---|
canHandleClick, getDrawMode, getScaleZ, getZ, getZOffset, 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, postSVGShapeSpecificAttributes, randomPointInside, 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
initializeInternal, postInitialize
getX, getY
public ShapeText()
Constructs a text shape with default attributes.
@AnyLogicLegacyAPI public ShapeText(boolean ispublic, double x, double y, double rotation, java.awt.Color color, java.lang.String text, java.awt.Font font, TextAlignment alignment)
Constructs a 2D-only text shape with specific attributes.
- Parameters:
ispublic
- iftrue
, the shape is visible on container's presentationx
- the x coordinate of the beginning of the first line of the texty
- the y coordinate of the beginning of the first line of the textrotation
- the rotation of the text in radianscolor
- color of the texttext
- the text displayed by the text shapefont
- the font used by the text shapealignment
- the alignment of the text shape
public ShapeText(ShapeDrawMode drawMode, boolean ispublic, double x, double y, double z, double rotation, java.awt.Color color, java.lang.String text, java.awt.Font font, TextAlignment alignment)
Constructs a text shape 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 beginning of the first line of the texty
- the y coordinate of the beginning of the first line of the textz
- the z coordinate of the textrotation
- the rotation of the text in radianscolor
- color of the texttext
- the text displayed by the text shapefont
- the font used by the text shapealignment
- the alignment of the text shape
public void setColor(java.awt.Color color)
Sets the color of the text.
- Parameters:
color
- the new color, null = do not draw the text
public java.awt.Color getColor()
Returns the color of the text.
- Returns:
- the color of the text
public void setText(java.lang.Object text)
Sets the text of the text shape.
- Parameters:
text
- the new text of the text shape
public java.lang.String getText()
Returns the text of the text shape.
- Returns:
- the text of the text shape
public void setFont(java.awt.Font font)
Sets the font of the text shape.
- Parameters:
font
- the new font of the text shape
public java.awt.Font getFont()
Returns the font of the text shape.
- Returns:
- the font of the text shape
public void setAlignment(TextAlignment alignment)
Sets the alignment of the text shape.
- Parameters:
alignment
- the new alignment of the text shape, one of:
public TextAlignment getAlignment()
Returns the alignment of the text shape. Possible values are:
- Returns:
- the alignment of the text shape
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 classShape
- Parameters:
px
- the x coordinate relative to this shape's containerpy
- the y coordinate relative to this shape's container- Returns:
true
if the shape contains the point with the given coordinates
public ShapeText 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 Presentable getPresentable()
Description copied from class:
Shape
Returns the Presentable object (
Agent
or Experiment
) where
this shape belongs to, or null.- Overrides:
getPresentable
in classShape
- Returns:
- the Presentable that owns this shape, or null
@AnyLogicInternalAPI @Deprecated public void setContextReference_xjal(Presentable contextReference)
Deprecated.
-
How can we improve this article?
-