Class AbstractLaneBasedObject
java.lang.Object
org.djutils.event.LocalEventProducer
org.opentrafficsim.core.object.StaticObject
org.opentrafficsim.road.network.lane.object.AbstractLaneBasedObject
- All Implemented Interfaces:
Serializable
,Remote
,nl.tudelft.simulation.dsol.animation.Locatable
,org.djutils.base.Identifiable
,org.djutils.event.EventProducer
,org.opentrafficsim.base.geometry.OtsLocatable
,Drawable
,LocatedObject
,LaneBasedObject
- Direct Known Subclasses:
BusStop
,Conflict
,Conflict.ConflictEnd
,Distraction
,LaneDetector
,SpeedSign
,TrafficLight
An abstract implementation of the LaneBasedObject interface with the required fields being initialized and getters for those
fields. All StaticObjects are EventProducers, allowing them to provide state changes to subscribers.
Note that extending classes must use a create(...) factory method that calls init() after fully constructing the object to avoid "half constructed" objects to be registered in the network.
Note that extending classes must use a create(...) factory method that calls init() after fully constructing the object to avoid "half constructed" objects to be registered in the network.
Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
-
Field Summary
Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITION
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractLaneBasedObject
(String id, Lane lane, org.djunits.value.vdouble.scalar.Length longitudinalPosition, org.djutils.draw.line.PolyLine2d geometry) Construct a new LaneBasedObject with the required fields.protected
AbstractLaneBasedObject
(String id, Lane lane, org.djunits.value.vdouble.scalar.Length longitudinalPosition, org.djutils.draw.line.PolyLine2d geometry, org.djunits.value.vdouble.scalar.Length height) Construct a new AbstractLanebasedObject with the required fields. -
Method Summary
Methods inherited from class org.opentrafficsim.core.object.StaticObject
create, create, getBounds, getGeometry, getHeight, getId, getLocation
Methods inherited from class org.djutils.event.LocalEventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventListenerMap, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventListenerMap, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
Methods inherited from interface org.djutils.base.Identifiable
getId
Methods inherited from interface org.opentrafficsim.road.network.lane.object.LaneBasedObject
getLength, getLocation
Methods inherited from interface nl.tudelft.simulation.dsol.animation.Locatable
getDirZ, getZ
Methods inherited from interface org.opentrafficsim.core.object.LocatedObject
getGeometry, getHeight
Methods inherited from interface org.opentrafficsim.base.geometry.OtsLocatable
getBounds
-
Constructor Details
-
AbstractLaneBasedObject
protected AbstractLaneBasedObject(String id, Lane lane, org.djunits.value.vdouble.scalar.Length longitudinalPosition, org.djutils.draw.line.PolyLine2d geometry, org.djunits.value.vdouble.scalar.Length height) throws NetworkException Construct a new AbstractLanebasedObject with the required fields.- Parameters:
id
- String; the id of the new objectlane
- Lane; The lane on which the new object resides. If the new object is a Sensor; it is automatically registered on the lanelongitudinalPosition
- Length; The position (between 0.0 and the length of the Lane) of the sensor on the design line of the lanegeometry
- PolyLine2d; the geometry of the object, which provides its location and bounds as wellheight
- Length; the height of the object, in case it is a 3D object- Throws:
NetworkException
- when the position on the lane is out of bounds
-
AbstractLaneBasedObject
protected AbstractLaneBasedObject(String id, Lane lane, org.djunits.value.vdouble.scalar.Length longitudinalPosition, org.djutils.draw.line.PolyLine2d geometry) throws NetworkException Construct a new LaneBasedObject with the required fields.- Parameters:
id
- String; the id of the new AbstractLaneBasedObjectlane
- Lane; The lane for which this is a sensorlongitudinalPosition
- Length; The position (between 0.0 and the length of the Lane) of the sensor on the design line of the lanegeometry
- PolyLine2d; the geometry of the object, which provides its location and bounds as well- Throws:
NetworkException
- when the position on the lane is out of bounds
-
-
Method Details
-
init
- Overrides:
init
in classStaticObject
- Throws:
NetworkException
-
getFullId
- Specified by:
getFullId
in interfaceLocatedObject
- Overrides:
getFullId
in classStaticObject
-
getLane
- Specified by:
getLane
in interfaceLaneBasedObject
- Returns:
- The lane for which this is a sensor.
-
getLongitudinalPosition
public final org.djunits.value.vdouble.scalar.Length getLongitudinalPosition()- Specified by:
getLongitudinalPosition
in interfaceLaneBasedObject
- Returns:
- the position (between 0.0 and the length of the Lane) of the sensor on the design line of the lane.
-
toString
- Overrides:
toString
in classStaticObject
-