Package com.anylogic.engine.presentation
- Field Summary
- 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 Details
- Method Details
- 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
,Serializable
,Cloneable
public class ShapeText extends Shape3D
Persistent text shape.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
Constructor | Description |
---|---|
ShapeText() |
Constructs a text shape with default attributes.
|
ShapeText |
Constructs a 2D-only text shape with specific attributes.
|
ShapeText |
Constructs a text shape with specific attributes.
|
Modifier and Type | Method | Description |
---|---|---|
ShapeText | 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.
|
TextAlignment | getAlignment() |
Returns the alignment of the text shape.
|
Color | getColor() |
Returns the color of the text.
|
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. |
String | getText() |
Returns the text of the text shape.
|
void | setAlignment |
Sets the alignment of the text shape.
|
void | setColor |
Sets the color of the text.
|
void | setContextReference_xjal |
Deprecated.
|
void | setFont |
Sets the font of the text shape.
|
void | setText |
Sets the text of the text shape.
|
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
public ShapeText()
Constructs a text shape with default attributes.
@AnyLogicLegacyAPI public ShapeText(boolean ispublic, double x, double y, double rotation, Color color, String text, 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, Color color, String text, 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(Color color)
Sets the color of the text.
- Parameters:
color
- the new color, null = do not draw the text
public Color getColor()
Returns the color of the text.
- Returns:
- the color of the text
public void setText(Object text)
Sets the text of the text shape.
- Parameters:
text
- the new text of the text shape
public String getText()
Returns the text of the text shape.
- Returns:
- the text of the text shape
public void setFont(Font font)
Sets the font of the text shape.
- Parameters:
font
- the new font of the text shape
public 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
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.