Package com.anylogic.engine.markup
- java.lang.Object
- com.anylogic.engine.markup.AbstractMarkup
- com.anylogic.engine.markup.MarkupShape
- All Implemented Interfaces:
AggregatableAnimationElement
,HasLevel
,SVGElement
,UsdElement
,Serializable
- Direct Known Subclasses:
AbstractLevelMarkup
,AbstractRailwayMarkup
,AbstractRoadMarkup
,ConveyorMarkupElement
,LiftPortImpl
,NetworkMarkupElement
public abstract class MarkupShape extends AbstractMarkup implements HasLevel
- See Also:
- Serialized Form
Constructor | Description |
---|---|
MarkupShape() | |
MarkupShape | |
MarkupShape |
Modifier and Type | Method | Description |
---|---|---|
abstract boolean | contains |
Test if the shape contains the point with the given coordinates (relative
to this shape's container, i.e.
|
final RuntimeException | error |
Signals an error during the model run by throwing a RuntimeException
with errorText preceded by the agent full name.
|
ShapeDrawMode | getDrawMode() |
Returns the drawing mode of the shape (where to draw this shape: 2D, 3D or 2D+3D).
If the shape has been created with no-argument constructor, and has no specific limitations (like 2D-only), and drawing mode hasn't yet been set, then it is initialized to default (2D + 3D). |
String | getFullName() |
Returns the name of the markup prefixed by the path from
the top-level agent to this one.
|
abstract Level | getLevel() |
Returns level associated with this space markup element or
null
if this element has no level |
double | getOutsideLevelZ() | |
Agent | getPresentable() | |
Agent | getSpace() |
Returns the agent where the markup element is defined
|
final void | initialize() |
Deprecated.
deprecated in version 8.5.0, will be removed in the future releases
|
boolean | isClickHandled() | |
boolean | isPublic() |
Tests if the markup is public, i.e.
|
boolean | onClick |
Should be overridden to define the shape reaction on mouse click.
|
void | remove() |
Removes the markup element from the presentation, if it is not a part of the
presentation, does nothing.
|
void | setDrawMode |
Sets the drawing mode of the shape (where to draw this shape: 2D, 3D or 2D+3D).
This method may be called only for shapes created using no-argument constructor (which have no limitations like 2D-only) and only once. |
void | setOwner |
Sets the owner of the markup element
|
discardOwner, executeUserAction, findSVGElement, getName, getOrGenerateUSDId, getSVGId, initializeInternal, isVisible, onAggregatorInitialized, onAggregatorVisibilityChanged, removeSVGFromOwner, resetSVGState, setVisible, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties
public MarkupShape()
public MarkupShape(Agent owner)
public MarkupShape(Agent owner, ShapeDrawMode drawMode, boolean isPublic)
public boolean isPublic()
Description copied from class:
AbstractMarkup
Tests if the markup is public, i.e. if it should be drawn on the agent's
parent animation. If the markup is a part of a network, the markup is public
only if both the network and the markup itself are public.
- Overrides:
isPublic
in classAbstractMarkup
- Returns:
- true if the markup is public, false otherwise.
@Deprecated public final void initialize()
Deprecated.
deprecated in version 8.5.0, will be removed in the future releases
public void setOwner(Agent owner)
Sets the owner of the markup element
- Parameters:
owner
- new owner
@AnyLogicInternalAPI public boolean isClickHandled()
@AnyLogicInternalCodegenAPI public boolean onClick(double clickx, double clicky)
Should be overridden to define the shape reaction on mouse click. The
click coordinates are definitely within the shape bounds if this method
is called. By default, does nothing and returns
false
.- Parameters:
clickx
- the x coordinate of the click relative to the shapeclicky
- the y coordinate of the click relative to the shape- Returns:
- always return
false
here.
public abstract 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. in the same system with the coordinates
of this shape, x and y)
- 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 void setDrawMode(ShapeDrawMode drawMode)
Sets the drawing mode of the shape (where to draw this shape: 2D, 3D or 2D+3D).
This method may be called only for shapes created using no-argument constructor (which have no limitations like 2D-only) and only once. Any subsequent call for a shape having drawing mode already set, will throw error.
This method may be called only for shapes created using no-argument constructor (which have no limitations like 2D-only) and only once. Any subsequent call for a shape having drawing mode already set, will throw error.
- Parameters:
drawMode
- where to draw this shape: 2D, 3D or 2D+3D
public ShapeDrawMode getDrawMode()
Returns the drawing mode of the shape (where to draw this shape: 2D, 3D or 2D+3D).
If the shape has been created with no-argument constructor, and has no specific limitations (like 2D-only), and drawing mode hasn't yet been set, then it is initialized to default (2D + 3D).
If the shape has been created with no-argument constructor, and has no specific limitations (like 2D-only), and drawing mode hasn't yet been set, then it is initialized to default (2D + 3D).
- Overrides:
getDrawMode
in classAbstractMarkup
- Returns:
- the draw mode for this shape
public String getFullName()
Returns the name of the markup prefixed by the path from
the top-level agent to this one.
- Returns:
- the full name of the object including path from root
@AnyLogicInternalAPI public Agent getPresentable()
public Agent getSpace()
Description copied from class:
AbstractMarkup
Returns the agent where the markup element is defined
- Specified by:
getSpace
in classAbstractMarkup
- Returns:
- the agent associated with this element
public abstract Level getLevel()
Description copied from interface:
HasLevel
Returns level associated with this space markup element or
null
if this element has no level@AnyLogicInternalAPI public double getOutsideLevelZ()
public void remove()
Description copied from class:
AbstractMarkup
Removes the markup element from the presentation, if it is not a part of the
presentation, does nothing. Please note that removal from presentation does
not necessarily mean removing from the model logic as logical networks and
routes may have been created before the removal and survive it.
- Specified by:
remove
in classAbstractMarkup
public final RuntimeException error(String errorText)
Signals an error during the model run by throwing a RuntimeException
with errorText preceded by the agent full name.
- Specified by:
error
in classAbstractMarkup
- Parameters:
errorText
- the text describing the error that will be displayed.- Returns:
- actually this method never returns, it throws runtime exception
by itself.
But the return type is defined for some cases when you would like to use the following form of call:throw error("my message");