Class NetworkAnimation
- java.lang.Object
-
- org.djutils.event.EventProducer
-
- org.opentrafficsim.core.animation.network.NetworkAnimation
-
- All Implemented Interfaces:
Serializable,EventListener,EventListenerInterface,EventProducerInterface
public class NetworkAnimation extends EventProducer implements EventListenerInterface
NetworkAnimation stores the relations between drawable objects and their drawing info.
Copyright (c) 2003-2022 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information www.simulation.tudelft.nl. The source code and binary code of this software is proprietary information of Delft University of Technology.- Author:
- Alexander Verbraeck
- 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 Constructor Description NetworkAnimation(Network network)Construct this NetworkAnimation object with a connection to the Network.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDrawingInfoBase(Drawable drawable, DrawingInfo drawingInfo)Add the drawing info for an instance.voidaddDrawingInfoClass(Class<? extends Drawable> drawableClass, DrawingInfo drawingInfo)Add the drawing info for a class.voidaddDrawingInfoDynamic(Drawable drawable, DrawingInfo drawingInfo)Add the dynamic drawing information for an instance.DrawingInfogetDrawingInfo(Drawable drawable)Get the drawing information for a drawable instance.DrawingInfogetDrawingInfoBase(Drawable drawable)Get the static drawing information for a drawable instance.DrawingInfogetDrawingInfoClass(Class<? extends Drawable> drawableClass)Get the static class-based drawing information for a drawable instance.NetworkgetNetwork()SerializablegetSourceId()voidnotify(EventInterface event)-
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
-
-
-
-
Constructor Detail
-
NetworkAnimation
public NetworkAnimation(Network network) throws RemoteException
Construct this NetworkAnimation object with a connection to the Network.- Parameters:
network- Network; the network to which the animation info is connected- Throws:
RemoteException- in case of remote events and network error
-
-
Method Detail
-
addDrawingInfoClass
public void addDrawingInfoClass(Class<? extends Drawable> drawableClass, DrawingInfo drawingInfo)
Add the drawing info for a class. Here it can e.g., be specified that all lanes are filled with a light gray color and drawn with a dark gray stroke. The class drawing info can be cached.- Parameters:
drawableClass- Class<? extends Drawable>; the class to set the drawing info fordrawingInfo- DrawingInfo; the default drawing info for the class
-
addDrawingInfoBase
public void addDrawingInfoBase(Drawable drawable, DrawingInfo drawingInfo)
Add the drawing info for an instance. This overrides the drawing info for the class. An example is that a bus lane can be drawn using a black color to make it different from the standard lanes. The base drawing info can be cached.- Parameters:
drawable- Drawable; the object to set the drawing info fordrawingInfo- DrawingInfo; the default drawing info for the drawable
-
addDrawingInfoDynamic
public void addDrawingInfoDynamic(Drawable drawable, DrawingInfo drawingInfo)
Add the dynamic drawing information for an instance. This overrides the drawing info for the object and the class, and should not be cached. An example is that a lane on a highway that turns red when it is forbidden for traffic to use the lane.- Parameters:
drawable- Drawable; the object to set the drawing info fordrawingInfo- DrawingInfo; the dynamic drawing info for the drawable
-
getDrawingInfo
public DrawingInfo getDrawingInfo(Drawable drawable)
Get the drawing information for a drawable instance. It first checks the dynamic info, then the base info, and then the class info.- Parameters:
drawable- Drawable; the object to get the drawing info for- Returns:
- DrawingInfo; the drawing info for the instance, or null if no Drawing info could be found
-
getDrawingInfoBase
public DrawingInfo getDrawingInfoBase(Drawable drawable)
Get the static drawing information for a drawable instance. It first checks the base info, and then the class info.- Parameters:
drawable- Drawable; the object to get the drawing info for- Returns:
- DrawingInfo; the drawing info for the instance, or null if no Drawing info could be found
-
getDrawingInfoClass
public DrawingInfo getDrawingInfoClass(Class<? extends Drawable> drawableClass)
Get the static class-based drawing information for a drawable instance.- Parameters:
drawableClass- Class<? extends Drawable>; the class to get the drawing info for- Returns:
- DrawingInfo; the drawing info for the class, or null if no Drawing info could be found
-
getNetwork
public final Network getNetwork()
- Returns:
- the network backed by this NetworkAnimation object
-
notify
public void notify(EventInterface event) throws RemoteException
- Specified by:
notifyin interfaceEventListenerInterface- Throws:
RemoteException
-
getSourceId
public Serializable getSourceId()
- Specified by:
getSourceIdin interfaceEventProducerInterface- Specified by:
getSourceIdin classEventProducer
-
-