AnyLogic AnyLogic
Expand
Font size
All Implemented Interfaces:
AggregatableAnimationElement, HasLevel, SVGElement, java.io.Serializable
Direct Known Subclasses:
AbstractLevelMarkup, AbstractRailwayMarkup, AbstractRoadMarkup, ConveyorMarkupElement, LiftPortImpl, NetworkMarkupElement

public abstract class MarkupShape
extends AbstractMarkup
implements HasLevel
See Also:
Serialized Form

Constructor Summary

Constructors 
MarkupShape()  
MarkupShape​(Agent owner)  
MarkupShape​(Agent owner, ShapeDrawMode drawMode, boolean isPublic)  
Constructor Description

Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
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)
java.lang.RuntimeException error​(java.lang.String errorText)
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).
java.lang.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
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. if it should be drawn on the agent's parent animation.
boolean onClick​(double clickx, double clicky)
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​(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.
void setOwner​(Agent owner)
Sets the owner of the markup element
Modifier and Type Method Description

Methods inherited from class com.anylogic.engine.markup.AbstractMarkup

discardOwner, executeUserAction, findSVGElement, getName, getSVGId, initializeInternal, isVisible, onAggregatorInitialized, onAggregatorVisibilityChanged, removeSVGFromOwner, resetSVGState, setVisible, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement

postInitialize

Constructor Detail

MarkupShape

public MarkupShape()

MarkupShape

public MarkupShape​(Agent owner)

MarkupShape

public MarkupShape​(Agent owner,
                   ShapeDrawMode drawMode,
                   boolean isPublic)

Method Detail

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 class AbstractMarkup
Returns:
true if the markup is public, false otherwise.

initialize

@Deprecated
public final void initialize()
Deprecated.
deprecated in version 8.5.0, will be removed in the future releases

setOwner

public void setOwner​(Agent owner)
Sets the owner of the markup element
Parameters:
owner - new owner

isClickHandled

@AnyLogicInternalAPI
public boolean isClickHandled()

onClick

@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 shape
clicky - the y coordinate of the click relative to the shape
Returns:
always return false here.

contains

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 container
py - the y coordinate relative to this shape's container
Returns:
true if the shape contains the point with the given coordinates

setDrawMode

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.
Parameters:
drawMode - where to draw this shape: 2D, 3D or 2D+3D

getDrawMode

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).
Overrides:
getDrawMode in class AbstractMarkup
Returns:
the draw mode for this shape

getFullName

public java.lang.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

getPresentable

@AnyLogicInternalAPI
public Agent getPresentable()

getSpace

public Agent getSpace()
Description copied from class: AbstractMarkup
Returns the agent where the markup element is defined
Specified by:
getSpace in class AbstractMarkup
Returns:
the agent associated with this element

getLevel

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
Specified by:
getLevel in interface HasLevel
Returns:
the level associated with this space markup element

getOutsideLevelZ

@AnyLogicInternalAPI
public double getOutsideLevelZ()

remove

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 class AbstractMarkup

error

public final java.lang.RuntimeException error​(java.lang.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 class AbstractMarkup
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");
How can we improve this article?