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

public class StopLine<T extends Agent>
extends AbstractRoadSidePart
implements ISignalable, IStopLineDescriptor<T>
Markup element that marks a position on one or several lanes on a road. This element is determined by segment that crosses one or several guidelines within other markup elements.
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Constructor Summary

Constructors 
StopLine()
Creates a new position on road.
StopLine​(Road road, IStopLineDescriptor<T> d, ShapeDrawMode drawMode, boolean isPublic, boolean isOnForwardSide, double offset, int laneIndexFrom, int laneIndexTo, RoadSignType... roadSigns)  
StopLine​(Road road, ShapeDrawMode drawMode, boolean isPublic, boolean isOnForwardSide, double offset, int laneIndexFrom, int laneIndexTo, RoadSignType... roadSigns)
Deprecated.
deprecated in version 8.4, will be removed in the future releases
Constructor Description

Method Summary

All Methods Instance Methods Concrete Methods 
void addEndOfSpeedLimitSign()
Adds "end of speed limit" sign to this stop line
void addSpeedLimitSign​(double speedLimit, SpeedUnits units)
Adds "speed limit" sign to this stop line
void addYieldSign()
Adds "yield" sign to this stop line
double averageSpeed()
Returns the actual average speed near this stop line
double averageSpeed​(SpeedUnits units)
Returns the actual average speed near this stop line
int getLaneIndexFrom()
Returns the starting lane covered by stop line, inclusive
int getLaneIndexTo()
Returns the ending lane covered by stop line, inclusive
double getLength()  
TrafficLightSignal getSignal()
Returns current signal of stop line
double getSpeedLimit​(SpeedUnits units)
If this stop line has "speed limit" sign, returns the actual speed limit value, measured in the given units
boolean isEndOfSpeedLimitSign()
Returns true if this stop line has "end of speed limit" sign
boolean isSpeedLimitSign()
Returns true if this stop line has "speed limit" sign
boolean isYieldSign()
Returns true if this stop line has "yield" sign
void onCarPassed​(T car, int laneIndex)
Callback for "On car passed" action, executed for each car passing through this stop line
void postInitialize()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
int queueSize()
Returns size of queue before the stop line as sum of each lane's queue.
int queueSize​(int laneIndex)
Returns size of queue before the stop line on specified lane If lane index is invalid, an error will occur.
void registerListener​(SignalChangeListener stateChangeListener)
Allows to register a CarSettings instance as a listener of signal change events
void setLaneIndexFrom​(int laneIndexFrom)
Sets the starting lane covered by stop line, inclusive
void setLaneIndexTo​(int laneIndexTo)
Sets the ending lane covered by stop line, inclusive
void setSignal​(TrafficLightSignal signal)
Changes the current signal.
void updateDynamicProperties()
Updates dynamic properties of this shape only (without structural contents, if any) in a given context.
Method should be overridden for shapes with dynamic properties.
Modifier and Type Method Description

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

isOnForwardSide, setOnForwardSide

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

getOffset, getOffset, getRoad, setOffset, setOffset, setRoad

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

contains, getLevel, getRoadNetwork, setDebugInfoVisible, setRoadNetwork

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

error, getDrawMode, getFullName, getOutsideLevelZ, 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, updateDynamicPropertiesStructural, updateSVGProperties

Methods inherited from class java.lang.Object

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

Constructor Detail

StopLine

public StopLine()
Creates a new position on road.

StopLine

@Deprecated
public StopLine​(Road road,
                ShapeDrawMode drawMode,
                boolean isPublic,
                boolean isOnForwardSide,
                double offset,
                int laneIndexFrom,
                int laneIndexTo,
                RoadSignType... roadSigns)
Deprecated.
deprecated in version 8.4, will be removed in the future releases
Creates a new position on road. The position is set by by segment crossing one or several guidelines within other markup elements.
Parameters:
road - Road segment on which the stop line is created.
drawMode - Where to draw this space markup shape: 2D, 3D or 2D+3D.
isPublic - If true, the markup shape is visible on container's presentation.
isOnForwardSide - Flag specifying whether the stop line is created on forward or backward side of road segment.
offset - Offset (measured by guideline of lane adjacent to stop line) from beginning of road axis to stop line, in pixels.
laneIndexFrom - starting lane covered by stop line, inclusive, where 0 is lane at the road side
laneIndexTo - ending lane covered by stop line, inclusive, where 0 is lane at the road side
roadSigns - comma-separated road signs, e.g. RoadSignType.newYield(), RoadSignType.newSpeedLimit(60, SpeedUnits.MPH)

StopLine

@AnyLogicInternalCodegenAPI
public StopLine​(Road road,
                IStopLineDescriptor<T> d,
                ShapeDrawMode drawMode,
                boolean isPublic,
                boolean isOnForwardSide,
                double offset,
                int laneIndexFrom,
                int laneIndexTo,
                RoadSignType... roadSigns)

Method Detail

addSpeedLimitSign

public void addSpeedLimitSign​(double speedLimit,
                              SpeedUnits units)
Adds "speed limit" sign to this stop line
Parameters:
speedLimit - speed limit value, measured in the given units
units - speed units

isSpeedLimitSign

public boolean isSpeedLimitSign()
Returns true if this stop line has "speed limit" sign

getSpeedLimit

public double getSpeedLimit​(SpeedUnits units)
If this stop line has "speed limit" sign, returns the actual speed limit value, measured in the given units
Parameters:
units - speed units
Returns:
speed limit, measured in the given units, or +infinity if there is no speed limit sign at this stop line

addYieldSign

public void addYieldSign()
Adds "yield" sign to this stop line

isYieldSign

public boolean isYieldSign()
Returns true if this stop line has "yield" sign

addEndOfSpeedLimitSign

public void addEndOfSpeedLimitSign()
Adds "end of speed limit" sign to this stop line

isEndOfSpeedLimitSign

public boolean isEndOfSpeedLimitSign()
Returns true if this stop line has "end of speed limit" sign

averageSpeed

public double averageSpeed​(SpeedUnits units)
Returns the actual average speed near this stop line
Parameters:
units - speed units
Returns:
average speed value

averageSpeed

public double averageSpeed()
Returns the actual average speed near this stop line
Returns:
average speed value, meters per second

queueSize

public int queueSize()
Returns size of queue before the stop line as sum of each lane's queue. See queueSize(int).
Returns:
size of queue before the stop line as sum of each lane's queue

queueSize

public int queueSize​(int laneIndex)
Returns size of queue before the stop line on specified lane If lane index is invalid, an error will occur.
Parameters:
laneIndex - - index of the lane
Returns:
size of queue before the stop line on specified lane

onCarPassed

@AnyLogicInternalCodegenAPI
public void onCarPassed​(T car,
                        int laneIndex)
Callback for "On car passed" action, executed for each car passing through this stop line
Specified by:
onCarPassed in interface IStopLineDescriptor<T extends Agent>
Parameters:
car - the car
laneIndex - the index of lane the car is located on, where 0 is lane at the road side

postInitialize

@AnyLogicInternalAPI
public void postInitialize()
Description copied from interface: AggregatableAnimationElement
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Specified by:
postInitialize in interface AggregatableAnimationElement

getLaneIndexFrom

public int getLaneIndexFrom()
Returns the starting lane covered by stop line, inclusive
Returns:
lane number, where 0 is lane at the road side

setLaneIndexFrom

public void setLaneIndexFrom​(int laneIndexFrom)
Sets the starting lane covered by stop line, inclusive
Parameters:
laneIndexFrom - lane number, where 0 is lane at the road side

getLaneIndexTo

public int getLaneIndexTo()
Returns the ending lane covered by stop line, inclusive
Returns:
lane number, where 0 is lane at the road side

setLaneIndexTo

public void setLaneIndexTo​(int laneIndexTo)
Sets the ending lane covered by stop line, inclusive
Parameters:
laneIndexTo - lane number, where 0 is lane at the road side

setSignal

public void setSignal​(TrafficLightSignal signal)
Changes the current signal. Use when stop line isn't controlled by traffic light.
Specified by:
setSignal in interface ISignalable
Parameters:
signal - New signal

getSignal

public TrafficLightSignal getSignal()
Returns current signal of stop line
Specified by:
getSignal in interface ISignalable
Returns:
Current signal of stop line

registerListener

@AnyLogicInternalAPI
public void registerListener​(SignalChangeListener stateChangeListener)
Allows to register a CarSettings instance as a listener of signal change events
Specified by:
registerListener in interface ISignalable
Parameters:
listener - Add instance of SignalChangeListener interface that will listen to the event.

getLength

@AnyLogicInternalLibraryAPI
public double getLength()
Specified by:
getLength in class AbstractRoadSidePart

updateDynamicProperties

@AnyLogicInternalCodegenAPI
public void updateDynamicProperties()
Description copied from class: AbstractMarkup
Updates dynamic properties of this shape only (without structural contents, if any) in a given context.
Method should be overridden for shapes with dynamic properties. Note that you should call super.updateDynamicProperties() at the end of overridden method
Overrides:
updateDynamicProperties in class AbstractMarkup
How can we improve this article?