Class DefaultAnimationFactory

    • 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