Class AbstractLaneBasedObject

java.lang.Object
org.djutils.event.LocalEventProducer
org.opentrafficsim.core.object.StaticObject
org.opentrafficsim.road.network.lane.object.AbstractLaneBasedObject
All Implemented Interfaces:
nl.tudelft.simulation.dsol.animation.Locatable, Identifiable, EventProducer, OtsShape, LocatedObject, LaneBasedObject
Direct Known Subclasses:
BusStop, Conflict, Conflict.ConflictEnd, LaneDetector, LocalDistraction, RoadSideDistraction, 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
  • Constructor Details

    • AbstractLaneBasedObject

      protected AbstractLaneBasedObject(String id, Lane lane, Length longitudinalPosition, PolyLine2d line, 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, Length longitudinalPosition, PolyLine2d line, Polygon2d contour, 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, Length longitudinalPosition, 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, Length longitudinalPosition, PolyLine2d 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