Class DefaultAnimationFactory

  • All Implemented Interfaces:
    java.io.Serializable, java.util.EventListener, EventListenerInterface

    public class DefaultAnimationFactory
    extends java.lang.Object
    implements EventListenerInterface
    DefaultAnimationFactory.java.

    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
    • Constructor Detail

      • DefaultAnimationFactory

        protected DefaultAnimationFactory​(OTSNetwork 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 - OTSNetwork; the network
        gtuColorer - GTUColorer; GTU colorer
        animateNetwork - boolean; whether to animate the current network objects
        Throws:
        OTSDrawingException - on drawing error
    • Method Detail

      • animateNetwork

        public static DefaultAnimationFactory animateNetwork​(OTSNetwork network,
                                                             OTSSimulatorInterface simulator,
                                                             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 - OTSNetwork; the network
        simulator - OTSSimulatorInterface; the simulator
        gtuColorer - GTUColorer; GTU colorer
        Returns:
        the DefaultAnimationFactory
        Throws:
        OTSDrawingException - on drawing error
      • animateXmlNetwork

        public static DefaultAnimationFactory animateXmlNetwork​(OTSNetwork 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 - OTSNetwork; the network
        gtuColorer - GTUColorer; GTU colorer
        Returns:
        the DefaultAnimationFactory
        Throws:
        OTSDrawingException - on drawing error
      • animateGTU

        protected void animateGTU​(LaneBasedGTU gtu)
        Draw the GTU (scheduled method).
        Parameters:
        gtu - LaneBasedGTU; the GTU to draw
      • animateStaticObject

        protected void animateStaticObject​(ObjectInterface object)
        Draw the static object.
        Parameters:
        object - ObjectInterface; the object to draw
      • animateGTUGenerator

        protected void animateGTUGenerator​(GtuGenerator gtuGenerator)
        Draw the GTUGenerator.
        Parameters:
        gtuGenerator - GtuGenerator; the GTUGenerator to draw