AnyLogic AnyLogic
Expand
Font size
All Implemented Interfaces:
AggregatableAnimationElement, IDescriptor, HasLevel, IMarkupLibraryDescriptor, IRailStopLineDescriptor<T>, RailMarkup, SVGElement, java.io.Serializable

public class PositionOnTrack<T extends Agent>
extends AbstractRailwayMarkup
implements IRailStopLineDescriptor<T>
See Also:
Serialized Form

Constructor Summary

Constructors 
PositionOnTrack()  
PositionOnTrack​(Agent owner, IRailStopLineDescriptor<T> d, ShapeDrawMode drawMode, boolean isPublic, java.awt.Paint color, RailwayTrack track, double offset)  
PositionOnTrack​(Agent owner, ShapeDrawMode drawMode, boolean isPublic, java.awt.Paint color, RailwayTrack track, double offset)
Deprecated.
deprecated in version 8.4, will be removed in the future releases
Constructor Description

Method Summary

All Methods Instance Methods Concrete Methods 
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.awt.Paint getColor()
Returns the color of this element
double getOffset()
Returns offset (measured in pixels)
double getOffset​(LengthUnits units)
Returns offset (measured in the given units)
RailwayTrack getTrack()
Returns the track that this position is located on.
double getX()
Returns the absolute x coordinate of this element
double getY()
Returns the absolute y coordinate of this element
void onTrainEnter​(T train)  
void onTrainExit​(T train)  
void setColor​(java.awt.Paint color)
Sets the color of this element
void setPointOnTrack​(RailwayTrack track, double offset)
Sets the PositionOnTrack on the specified track at the specified offset.
Modifier and Type Method Description

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

getDrawMode, getLevel, getOutsideLevelZ, getRailYard

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

error, getFullName, getPresentable, getSpace, initialize, isClickHandled, isPublic, onClick, remove, setDrawMode, setOwner

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

PositionOnTrack

public PositionOnTrack()

PositionOnTrack

@Deprecated
public PositionOnTrack​(Agent owner,
                       ShapeDrawMode drawMode,
                       boolean isPublic,
                       java.awt.Paint color,
                       RailwayTrack track,
                       double offset)
Deprecated.
deprecated in version 8.4, will be removed in the future releases
Parameters:
owner -
drawMode -
isPublic -
color -
track -
offset -

PositionOnTrack

@AnyLogicInternalCodegenAPI
public PositionOnTrack​(Agent owner,
                       IRailStopLineDescriptor<T> d,
                       ShapeDrawMode drawMode,
                       boolean isPublic,
                       java.awt.Paint color,
                       RailwayTrack track,
                       double offset)

Method Detail

setPointOnTrack

public void setPointOnTrack​(RailwayTrack track,
                            double offset)
Sets the PositionOnTrack on the specified track at the specified offset. This method is used when creating PositionOnTrack element from code and should not be used with the initialized element
Parameters:
track - track to put PositionOnTrack on
offset - offset of the PositionOnTrack

getTrack

public RailwayTrack getTrack()
Returns the track that this position is located on. The element should be initialized

getOffset

public double getOffset()
Returns offset (measured in pixels)
Returns:
offset

getOffset

public double getOffset​(LengthUnits units)
Returns offset (measured in the given units)
Parameters:
units - the units of length
Returns:
offset
Since:
7.1

getX

public double getX()
Returns the absolute x coordinate of this element
Returns:
the absolute x coordinate of this element

getY

public double getY()
Returns the absolute y coordinate of this element
Returns:
the absolute y coordinate of this element

getColor

public java.awt.Paint getColor()
Returns the color of this element
Returns:
the color of this element

setColor

public void setColor​(java.awt.Paint color)
Sets the color of this element
Parameters:
color - new color

onTrainEnter

@AnyLogicInternalCodegenAPI
public void onTrainEnter​(T train)
Specified by:
onTrainEnter in interface IRailStopLineDescriptor<T extends Agent>

onTrainExit

@AnyLogicInternalCodegenAPI
public void onTrainExit​(T train)
Specified by:
onTrainExit in interface IRailStopLineDescriptor<T extends Agent>

contains

public boolean contains​(double px,
                        double py)
Description copied from class: MarkupShape
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 class MarkupShape
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
How can we improve this article?