Class NetworkAnimation

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