Class DefaultAnimationFactory

java.lang.Object
org.opentrafficsim.animation.DefaultAnimationFactory
All Implemented Interfaces:
Serializable, Remote, EventListener, org.djutils.event.EventListener

public class DefaultAnimationFactory extends Object implements org.djutils.event.EventListener
DefaultAnimationFactory.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Wouter Schakel
See Also:
  • Constructor Details

    • DefaultAnimationFactory

      protected DefaultAnimationFactory(org.opentrafficsim.core.network.Network network, GtuColorer gtuColorer, boolean animateNetwork) throws OtsDrawingException
      Creates animations for nodes, links and lanes. The class will subscribe to the network and listen to changes, so the adding and removing of GTUs and Objects is animated correctly.
      Parameters:
      network - Network; the network
      gtuColorer - GtuColorer; GTU colorer
      animateNetwork - boolean; whether to animate the current network objects
      Throws:
      OtsDrawingException - on drawing error
  • Method Details

    • animateNetwork

      public static DefaultAnimationFactory animateNetwork(org.opentrafficsim.core.network.Network network, nl.tudelft.simulation.naming.context.Contextualized contextualized, GtuColorer gtuColorer) throws OtsDrawingException
      Creates animations for nodes, links, lanes and GTUs. This can be used if the network is not read from XML. The class will subscribe to the network and listen to changes, so the adding and removing of GTUs and Objects is animated correctly.
      Parameters:
      network - Network; the network
      contextualized - Contextualized; context provider
      gtuColorer - GtuColorer; GTU colorer
      Returns:
      the DefaultAnimationFactory
      Throws:
      OtsDrawingException - on drawing error
    • animateXmlNetwork

      public static DefaultAnimationFactory animateXmlNetwork(org.opentrafficsim.core.network.Network network, GtuColorer gtuColorer) throws OtsDrawingException
      Creates animations for nodes, links, lanes and GTUs. This can be used if the network is read from XML. The class will subscribe to the network and listen to changes, so the adding and removing of GTUs and Objects is animated correctly.
      Parameters:
      network - Network; the network
      gtuColorer - GtuColorer; GTU colorer
      Returns:
      the DefaultAnimationFactory
      Throws:
      OtsDrawingException - on drawing error
    • notify

      public void notify(org.djutils.event.Event event) throws RemoteException
      Specified by:
      notify in interface org.djutils.event.EventListener
      Throws:
      RemoteException
    • animateGTU

      protected void animateGTU(LaneBasedGtu gtu)
      Draw the GTU (scheduled method).
      Parameters:
      gtu - LaneBasedGtu; the GTU to draw
    • animateLocatedObject

      protected void animateLocatedObject(org.opentrafficsim.core.object.LocatedObject object)
      Draw the static object.
      Parameters:
      object - ObjectInterface; the object to draw
    • animateNonLocatedObject

      protected void animateNonLocatedObject(org.opentrafficsim.core.object.NonLocatedObject object)
      Draw non-located objects.
      Parameters:
      object - NonLocatedObject; the object to draw.