AnyLogic
Expand
Font size
All Implemented Interfaces:
AggregatableAnimationElement, IDescriptor, HasLevel, IMarkupLibraryDescriptor, ISignalable, IStopLineDescriptor<T>, SVGElement, UsdElement, 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

Field Summary

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

ID_NOT_SET

Constructor Summary

ConstructorDescription
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

Method Summary

Modifier and TypeMethodDescription
voidaddEndOfSpeedLimitSign()
Adds "end of speed limit" sign to this stop line
voidaddSpeedLimitSign(double speedLimit, SpeedUnits units)
Adds "speed limit" sign to this stop line
voidaddYieldSign()
Adds "yield" sign to this stop line
doubleaverageSpeed()
Returns the actual average speed near this stop line
doubleaverageSpeed(SpeedUnits units)
Returns the actual average speed near this stop line
intgetLaneIndexFrom()
Returns the starting lane covered by stop line, inclusive
intgetLaneIndexTo()
Returns the ending lane covered by stop line, inclusive
doublegetLength() 
TrafficLightSignalgetSignal()
Returns current signal of stop line
doublegetSpeedLimit(SpeedUnits units)
If this stop line has "speed limit" sign, returns the actual speed limit value, measured in the given units
booleanisEndOfSpeedLimitSign()
Returns true if this stop line has "end of speed limit" sign
booleanisSpeedLimitSign()
Returns true if this stop line has "speed limit" sign
booleanisYieldSign()
Returns true if this stop line has "yield" sign
voidonCarPassed(T car, int laneIndex)
Callback for "On car passed" action, executed for each car passing through this stop line
voidpostInitialize()
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
intqueueSize()
Returns size of queue before the stop line as sum of each lane's queue.
intqueueSize(int laneIndex)
Returns size of queue before the stop line on specified lane If lane index is invalid, an error will occur.
voidregisterListener(SignalChangeListener stateChangeListener)
Allows to register a CarSettings instance as a listener of signal change events
voidsetLaneIndexFrom(int laneIndexFrom)
Sets the starting lane covered by stop line, inclusive
voidsetLaneIndexTo(int laneIndexTo)
Sets the ending lane covered by stop line, inclusive
voidsetSignal(TrafficLightSignal signal)
Changes the current signal.
voidupdateDynamicProperties()
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.

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

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

Constructor Details

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 Details

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