Class NetworkAnimation

java.lang.Object
nl.tudelft.simulation.event.EventProducer
org.opentrafficsim.core.animation.network.NetworkAnimation
All Implemented Interfaces:
Serializable, EventListener, nl.tudelft.simulation.event.EventListenerInterface, nl.tudelft.simulation.event.EventProducerInterface

public class NetworkAnimation
extends nl.tudelft.simulation.event.EventProducer
implements nl.tudelft.simulation.event.EventListenerInterface
NetworkAnimation stores the relations between drawable objects and their drawing info.

Copyright (c) 2003-2020 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 nl.tudelft.simulation.event.EventProducer

    listeners

    Fields inherited from interface nl.tudelft.simulation.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

    Modifier and Type Method Description
    void addDrawingInfoBase​(Drawable drawable, DrawingInfo drawingInfo)
    Add the drawing info for an instance.
    void addDrawingInfoClass​(Class<? extends Drawable> drawableClass, DrawingInfo drawingInfo)
    Add the drawing info for a class.
    void addDrawingInfoDynamic​(Drawable drawable, DrawingInfo drawingInfo)
    Add the dynamic drawing information for an instance.
    DrawingInfo getDrawingInfo​(Drawable drawable)
    Get the drawing information for a drawable instance.
    DrawingInfo getDrawingInfoBase​(Drawable drawable)
    Get the static drawing information for a drawable instance.
    DrawingInfo getDrawingInfoClass​(Class<? extends Drawable> drawableClass)
    Get the static class-based drawing information for a drawable instance.
    Network getNetwork()  
    void notify​(nl.tudelft.simulation.event.EventInterface event)

    Methods inherited from class nl.tudelft.simulation.event.EventProducer

    addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListener

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • 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 Details

    • 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 for
      drawingInfo - 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 for
      drawingInfo - 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 for
      drawingInfo - 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​(nl.tudelft.simulation.event.EventInterface event) throws RemoteException
      Specified by:
      notify in interface nl.tudelft.simulation.event.EventListenerInterface
      Throws:
      RemoteException