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, org.opentrafficsim.base.geometry.SpatialObject, LocatedObject, LaneBasedObject
Direct Known Subclasses:
BusStop, Conflict, Conflict.ConflictEnd, Distraction, LaneDetector, SpeedSign, TrafficLight

public abstract class AbstractLaneBasedObject extends StaticObject implements LaneBasedObject
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.

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

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractLaneBasedObject(String id, Lane lane, org.djunits.value.vdouble.scalar.Length longitudinalPosition, org.djutils.draw.line.PolyLine2d line)
    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 line, org.djunits.value.vdouble.scalar.Length height)
    Construct a new AbstractLanebasedObject with the required fields.
    protected
    AbstractLaneBasedObject(String id, Lane lane, org.djunits.value.vdouble.scalar.Length longitudinalPosition, org.djutils.draw.line.PolyLine2d line, org.djutils.draw.line.Polygon2d contour)
    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 line, org.djutils.draw.line.Polygon2d contour, org.djunits.value.vdouble.scalar.Length height)
    Construct a new AbstractLanebasedObject with the required fields.
  • Method Summary

    Modifier and Type
    Method
    Description
    final String
     
    final Lane
     
    org.djutils.draw.line.PolyLine2d
    Returns the line.
    final org.djunits.value.vdouble.scalar.Length
     
    protected void
     
     

    Methods inherited from class org.opentrafficsim.core.object.StaticObject

    create, create, getBounds, getContour, getHeight, getId, getLocation, getShape

    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, getSimulator

    Methods inherited from interface nl.tudelft.simulation.dsol.animation.Locatable

    getDirZ, getZ

    Methods inherited from interface org.opentrafficsim.core.object.LocatedObject

    getHeight

    Methods inherited from interface org.opentrafficsim.base.geometry.OtsLocatable

    getBounds, getShape

    Methods inherited from interface org.opentrafficsim.base.geometry.SpatialObject

    getContour
  • Constructor Details

    • AbstractLaneBasedObject

      protected AbstractLaneBasedObject(String id, Lane lane, org.djunits.value.vdouble.scalar.Length longitudinalPosition, org.djutils.draw.line.PolyLine2d line, org.djunits.value.vdouble.scalar.Length height) throws NetworkException
      Construct a new AbstractLanebasedObject with the required fields.
      Parameters:
      id - the id of the new object
      lane - The lane on which the new object resides. If the new object is a Sensor; it is automatically registered on the lane
      longitudinalPosition - The position (between 0.0 and the length of the Lane) of the sensor on the design line of the lane
      line - the line of the object on the lane, which provides its location and bounds as well
      height - 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 line, org.djutils.draw.line.Polygon2d contour, org.djunits.value.vdouble.scalar.Length height) throws NetworkException
      Construct a new AbstractLanebasedObject with the required fields.
      Parameters:
      id - the id of the new object
      lane - The lane on which the new object resides. If the new object is a Sensor; it is automatically registered on the lane
      longitudinalPosition - The position (between 0.0 and the length of the Lane) of the sensor on the design line of the lane
      line - the line of the object on the lane
      contour - contour of the object, which provides its location and bounds as well
      height - 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 line) throws NetworkException
      Construct a new LaneBasedObject with the required fields.
      Parameters:
      id - the id of the new AbstractLaneBasedObject
      lane - The lane for which this is a sensor
      longitudinalPosition - The position (between 0.0 and the length of the Lane) of the sensor on the design line of the lane
      line - the line of the object on the lane, which provides its location and bounds as well
      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 line, org.djutils.draw.line.Polygon2d contour) throws NetworkException
      Construct a new LaneBasedObject with the required fields.
      Parameters:
      id - the id of the new AbstractLaneBasedObject
      lane - The lane for which this is a sensor
      longitudinalPosition - The position (between 0.0 and the length of the Lane) of the sensor on the design line of the lane
      line - the line of the object on the lane
      contour - contour 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