Package org.opentrafficsim.core.object
Class StaticObject
- java.lang.Object
-
- org.djutils.event.EventProducer
-
- org.opentrafficsim.core.object.StaticObject
-
- All Implemented Interfaces:
Serializable,Locatable,EventProducerInterface,Identifiable,Drawable,ObjectInterface
public class StaticObject extends EventProducer implements ObjectInterface, Serializable, Identifiable, Drawable
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-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Nov 26, 2015
BSD-style license. See OpenTrafficSim License.- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.djutils.event.EventProducer
eventProducerImpl
-
Fields inherited from interface org.djutils.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedStaticObject(String id, Polygon3d geometry, Length minimumRelativeHeight, Length maximumRelativeHeight)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StaticObjectclone(Network newNetwork, boolean animation)Clone the StaticObject for e.g., copying a network.static StaticObjectcreate(String id, Polygon3d geometry)Make a static object with zero minimumRelativeHeight and zero maximumRelativeHeight and carry out the initialization after it has been fully created.static StaticObjectcreate(String id, Polygon3d geometry, Length minimumRelativeHeight, Length maximumRelativeHeight)Make a static object and carry out the initialization after it has been fully created.Bounds3dgetBounds()StringgetFullId()Retrieve the full id that (must be unique within the network).Polygon3dgetGeometry()StringgetId()OrientedPoint3dgetLocation()LengthgetMaximumRelativeHeight()Get the maximum elevation relative to the Z of getLocation.LengthgetMinimumRelativeHeight()Get the minimum elevation relative to the Z of getLocation.SerializablegetSourceId()protected voidinit()Initialize the object after it has been fully created.StringtoString()-
Methods inherited from class org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, 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.EventProducerInterface
addListener, addListener, addListener, addListener, getEventTypesWithListeners, hasListeners, numberOfListeners, removeListener
-
-
-
-
Constructor Detail
-
StaticObject
protected StaticObject(String id, Polygon3d geometry, Length minimumRelativeHeight, Length maximumRelativeHeight) throws NullPointerException, IllegalArgumentException
- Parameters:
id- String; the idgeometry- Polygon3d; the top-level 2D outline of the object relative to its locationminimumRelativeHeight- Length; the minimum height of the object, relative to the z-value of its locationmaximumRelativeHeight- Length; the maximum height of the object, relative to the z-value of its location- Throws:
NullPointerException- when id, geometry, minimumRelativeHeight, or maximumRelativeHeight is nullIllegalArgumentException- when minimumRelativeHeight exceeds maximumRelativeHeight
-
-
Method Detail
-
init
protected void init() throws NetworkExceptionInitialize 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, Polygon3d geometry, Length minimumRelativeHeight, Length maximumRelativeHeight) throws NetworkException
Make a static object and carry out the initialization after it has been fully created.- Parameters:
id- String; the idgeometry- Polygon3d; the top-level 2D outline of the objectminimumRelativeHeight- Length; the minimum height of the object, relative to the z-value of its locationmaximumRelativeHeight- Length; the maximum height of the object, relative to the z-value of its location- Returns:
- the static object
- Throws:
NetworkException- e.g. on error registering the object in the network
-
create
public static StaticObject create(String id, Polygon3d geometry) throws NetworkException
Make a static object with zero minimumRelativeHeight and zero maximumRelativeHeight and carry out the initialization after it has been fully created.- Parameters:
id- String; the idgeometry- OTSLine3D; the top-level 2D outline of the object- Returns:
- the static object
- Throws:
NetworkException- e.g. on error registering the object in the network
-
getGeometry
public final Polygon3d getGeometry()
- Specified by:
getGeometryin interfaceObjectInterface- Returns:
- the outline geometry of the object.
-
getMinimumRelativeHeight
public final Length getMinimumRelativeHeight()
Get the minimum elevation relative to the Z of getLocation.- Specified by:
getMinimumRelativeHeightin interfaceObjectInterface- Returns:
- Length; the minimum elevation relative to the Z of getLocation
-
getMaximumRelativeHeight
public final Length getMaximumRelativeHeight()
Get the maximum elevation relative to the Z of getLocation.- Specified by:
getMaximumRelativeHeightin interfaceObjectInterface- Returns:
- Length; the maximum elevation relative to the Z of getLocation
-
getId
public final String getId()
- Specified by:
getIdin interfaceIdentifiable
-
getFullId
public String getFullId()
Retrieve the full id that (must be unique within the network).- Specified by:
getFullIdin interfaceObjectInterface- Returns:
- the full id that makes the id unique in the network
-
getLocation
public OrientedPoint3d getLocation()
- Specified by:
getLocationin interfaceLocatable
-
clone
public StaticObject clone(Network newNetwork, boolean animation) throws NetworkException
Clone the StaticObject for e.g., copying a network.- Parameters:
newNetwork- Network; the new network to which the clone belongsanimation- boolean; whether to (re)create animation or not- Returns:
- a clone of this object
- Throws:
NetworkException- in case the cloning fails
-
getSourceId
public Serializable getSourceId()
- Specified by:
getSourceIdin interfaceEventProducerInterface- Specified by:
getSourceIdin classEventProducer
-
-