Class StaticObject

java.lang.Object
org.djutils.event.LocalEventProducer
org.opentrafficsim.core.object.StaticObject
All Implemented Interfaces:
Locatable, Identifiable, EventProducer, OtsShape, LocatedObject

public class StaticObject extends 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-2026 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
  • Constructor Details

    • StaticObject

      protected StaticObject(String id, DirectedPoint2d location, Polygon2d absoluteContour, org.djunits.value.vdouble.scalar.Length height)
      Constructor.
      Parameters:
      id - the id
      location - location.
      absoluteContour - absolute contour
      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, 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, 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
    • getAbsoluteContour

      public Polygon2d getAbsoluteContour()
      Specified by:
      getAbsoluteContour in interface OtsShape
    • getRelativeContour

      public Polygon2d getRelativeContour()
      Specified by:
      getRelativeContour in interface OtsShape
    • 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 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 DirectedPoint2d getLocation()
      Specified by:
      getLocation in interface Locatable
      Specified by:
      getLocation in interface OtsShape
    • getRelativeBounds

      public Bounds2d getRelativeBounds()
      Specified by:
      getRelativeBounds in interface Locatable
      Specified by:
      getRelativeBounds in interface OtsShape
    • toString

      public String toString()
      Overrides:
      toString in class Object