Class StaticObject

java.lang.Object
org.djutils.event.LocalEventProducer
org.opentrafficsim.core.object.StaticObject
All Implemented Interfaces:
Serializable, Remote, nl.tudelft.simulation.dsol.animation.Locatable, org.djutils.base.Identifiable, org.djutils.event.EventProducer, OtsLocatable, SpatialObject, LocatedObject

public class StaticObject extends org.djutils.event.LocalEventProducer implements LocatedObject
A static object with a height that a GTU might have to avoid, or which can cause occlusion for perception. All objects are potential event producers, which allows them to signal that their state has changed.

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
See Also:
  • Field Summary

    Fields inherited from interface org.djutils.event.EventProducer

    FIRST_POSITION, LAST_POSITION
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    StaticObject(String id, org.djutils.draw.point.OrientedPoint2d location, org.djutils.draw.line.Polygon2d contour, org.djunits.value.vdouble.scalar.Length height)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    create(String id, org.djutils.draw.line.Polygon2d geometry)
    Make a static object with zero height and carry out the initialization after it has been fully created.
    create(String id, org.djutils.draw.line.Polygon2d geometry, org.djunits.value.vdouble.scalar.Length height)
    Make a static object and carry out the initialization after it has been fully created.
    org.djutils.draw.bounds.Bounds2d
     
    org.djutils.draw.line.Polygon2d
     
    Returns the full id that makes the id unique in the network.
    final org.djunits.value.vdouble.scalar.Length
    Returns the object height.
    final String
     
    org.djutils.draw.point.OrientedPoint2d
     
     
    protected void
    Initialize the object after it has been fully created.
     

    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 nl.tudelft.simulation.dsol.animation.Locatable

    getDirZ, getZ
  • Constructor Details

    • StaticObject

      protected StaticObject(String id, org.djutils.draw.point.OrientedPoint2d location, org.djutils.draw.line.Polygon2d contour, org.djunits.value.vdouble.scalar.Length height)
      Parameters:
      id - the id
      location - location.
      contour - the top-level 2D outline of the object
      height - the height of the object
  • Method Details

    • init

      protected void init() throws NetworkException
      Initialize the object after it has been fully created.
      Throws:
      NetworkException - e.g. on error registering the object in the network
    • create

      public static StaticObject create(String id, org.djutils.draw.line.Polygon2d geometry, org.djunits.value.vdouble.scalar.Length height) throws NetworkException
      Make a static object and carry out the initialization after it has been fully created.
      Parameters:
      id - the id
      geometry - the top-level 2D outline of the object
      height - the height of the object
      Returns:
      the static object
      Throws:
      NetworkException - e.g. on error registering the object in the network
    • create

      public static StaticObject create(String id, org.djutils.draw.line.Polygon2d geometry) throws NetworkException
      Make a static object with zero height and carry out the initialization after it has been fully created.
      Parameters:
      id - the id
      geometry - the top-level 2D outline of the object
      Returns:
      the static object
      Throws:
      NetworkException - e.g. on error registering the object in the network
    • getContour

      public org.djutils.draw.line.Polygon2d getContour()
      Specified by:
      getContour in interface SpatialObject
    • getShape

      public OtsShape getShape()
      Specified by:
      getShape in interface OtsLocatable
    • getHeight

      public final org.djunits.value.vdouble.scalar.Length getHeight()
      Description copied from interface: LocatedObject
      Returns the object height.
      Specified by:
      getHeight in interface LocatedObject
      Returns:
      the height of the object (can be Length.ZERO).
    • getId

      public final String getId()
      Specified by:
      getId in interface org.djutils.base.Identifiable
    • getFullId

      public String getFullId()
      Description copied from interface: LocatedObject
      Returns the full id that makes the id unique in the network.
      Specified by:
      getFullId in interface LocatedObject
      Returns:
      the full id that makes the id unique in the network.
    • getLocation

      public org.djutils.draw.point.OrientedPoint2d getLocation()
      Specified by:
      getLocation in interface nl.tudelft.simulation.dsol.animation.Locatable
      Specified by:
      getLocation in interface OtsLocatable
    • getBounds

      public org.djutils.draw.bounds.Bounds2d getBounds()
      Specified by:
      getBounds in interface nl.tudelft.simulation.dsol.animation.Locatable
      Specified by:
      getBounds in interface OtsLocatable
    • toString

      public String toString()
      Overrides:
      toString in class Object