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

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

Field Summary

Fields inherited from interface com.anylogic.engine.presentation.UsdElement

ID_NOT_SET

Constructor Summary

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

Method Summary

Modifier and TypeMethodDescription
booleancontains(double px, double py)
Test if the shape contains the point with the given coordinates (relative to this shape's container, i.e.
PaintgetColor()
Returns the color of this element
doublegetOffset()
Returns offset (measured in pixels)
doublegetOffset(LengthUnits units)
Returns offset (measured in the given units)
RailwayTrackgetTrack()
Returns the track that this position is located on.
doublegetX()
Returns the absolute x coordinate of this element
doublegetY()
Returns the absolute y coordinate of this element
voidonTrainEnter(T train) 
voidonTrainExit(T train) 
voidsetColor(Paint color)
Sets the color of this element
voidsetPointOnTrack(RailwayTrack track, double offset)
Sets the PositionOnTrack on the specified track at the specified offset.

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

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

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

postInitialize

Constructor Details

PositionOnTrack

public PositionOnTrack()

PositionOnTrack

@Deprecated
public PositionOnTrack(Agent owner,
 ShapeDrawMode drawMode,
 boolean isPublic,
 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,
 Paint color,
 RailwayTrack track,
 double offset)

Method Details

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 Paint getColor()
Returns the color of this element
Returns:
the color of this element

setColor

public void setColor(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