Using Text presentation shape, you can put labels with some comments or descriptions on presentation diagram.
Texts can appear not only in 2D presentation, but also in 3D animation:
To add a text onto presentation
Alternatively, navigate to the the Text section of the shape's Properties view. In the box, type the text you want to be displayed by this text shape.
Name – The name of the shape. It is used to identify and access the shape from code.
Ignore – If selected, the shape is excluded from the model.
Visible on upper agent – If selected, the shape is also visible on the upper agent where this agent lives.
Icon – If selected, the shape is considered as a part of the agent's icon. Please note that icon shapes are not shown in 3D animation.
Lock – If selected, the shape is locked. Locked shapes do not react to mouse clicks - it is impossible to select them in the graphical editor until you unlock them. It is frequently needed when you use a shape as a background image for your animation and you want to prevent editing this shape while drawing other shapes over it
Visible – Here you specify whether the shape is visible on the animation at the model runtime, or not. Choose yes or no using the control. If you expect visibility to change dynamically or to depend on some conditions, you may specify the expression defining the shape's visibility here. This expression will be dynamically re-evaluated at the model runtime. It should return boolean value. The shape is visible when the specified expression evaluates to true, and not visible otherwise.
Here you specify the content of the text shape: the text itself.
If necessary, you can specify the text directly in the graphical editor. To do this, double click the text shape and provide the required text in the text field. To apply changes, click outside of the field or press Ctrl Enter (Mac OS: Cmd Return). To discard changes, press Esc.
Color – Static value | dynamic expression of the text color. Click inside the control and choose a color using the Colors dialog box. Otherwise, specify here the expression defining the text color. The expression should return an instance of Java class Color.
Alignment – Text alignment. Using the buttons to the right, choose, whether the text should be aligned to the left, center or right.
Font – Specifies the font family for the text. You can adjust the size of the text font using the control to the right.Italic – If selected, the text is italicized.
Bold – If selected, the text is emphasized in bold.
Level – Level to which this element belongs.
X – X-coordinate of the text's upper left corner.
Y – Y-coordinate of the text's upper left corner.
Z – Z-coordinate of the text shape.
Rotation – Shape's rotation angle in XY plane.
Scale X – Here you can specify the expression returning the X-direction scale factor for the shape.*
Scale Y – Here you can specify the expression returning the Y-direction scale factor for the shape.*
* You can dynamically scale the shape at the model runtime by specifying expressions in the Scale X and Scale Y parameters.
Show in - Here you can choose whether you want this shape to be shown both In 2D and 3D animation, or in 2D only, or in 3D only.
Replication – The replication factor of the shape. Here you specify how many copies of the shape will be created (the integer number). If you leave this field empty, only one shape will be created.
On click – Here you can type Java code that will be called each time a user clicks on the shape at the model runtime. By default the code returns false. If there are several shapes overlapping in the click point, AnyLogic iterates through these shapes in their Z-order, from top to bottom and sequentially executes shape's On click actions. Iteration stops when action code returns true.
Show name – If selected, the shape's name will be displayed on the presentation diagram.
Function |
Description |
double getX() double getY() double getZ() |
Returns the X (Y, Z) coordinate of the shape (namely, the X coordinate of its upper left corner). |
void setX(double x) void setY(double y) void setZ(double z) |
Sets the X (Y, Z) coordinate of the shape.
|
void setPos(double x, double y) |
Sets new X, Y coordinates for the shape. Z coordinate stays unchanged.
Parameters: |
void setPos(double x, double y, double z) |
Sets new X, Y, Z coordinates for the shape.
Parameters: |
Function |
Description |
double getScaleX() double getScaleY() double getScaleZ() |
Returns the scale of the shape along X (Y, Z) axis. |
void setScaleX(double sx) void setScaleY(double sy) void setScaleZ(double sz) |
Sets the scale of the shape along X (Y, Z) axis.
* 1 = keep original size |
void setScale(double sx, double sy) |
Sets the scales of the shape along X and Y axes.
* 1 = keep original size |
void setScale(double sx, double sy,
double sz) |
Sets the scale of the shape.
* 1 = keep original size |
void setScale(double s) |
Sets the same scale of the shape along all axes.
|
Function |
Description |
double getRotation() |
Returns the rotation of the shape in radians, clockwise. |
void setRotation(double r) |
Sets the rotation of the shape.
Parameter: |
Function |
Description |
boolean isVisible() |
Checks the visibility of the shape. If the shape is visible, returns true, otherwise returns false. |
void setVisible(boolean v) |
Sets the visibility of the shape. Parameter: |
Function |
Description |
String getText() |
Returns the text of the text shape. |
void setText(Object text) |
Sets the text of the text shape.
|
Function |
Description |
Font getFont() |
Returns the font of the text shape. |
void setFont(Font font) |
Sets the font of the text shape.
|
Color getColor() |
Returns the color of the text. |
void setColor(Color color) |
Sets the color of the text. |
int getAlignment() |
Returns the alignment of the text shape. Possible values are: ALIGNMENT_LEFT |
void setAlignment(int alignment) |
Sets the alignment of the text shape. ALIGNMENT_LEFT |