Package org.opentrafficsim.draw.factory
Class DefaultAnimationFactory
- java.lang.Object
- 
- org.opentrafficsim.draw.factory.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
 
- 
- 
Field SummaryFields Modifier and Type Field Description java.util.Map<ObjectInterface,Renderable2D<?>>animatedObjectsrendered static objects.
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedDefaultAnimationFactory(OTSNetwork network, GTUColorer gtuColorer, boolean animateNetwork)Creates animations for nodes, links and lanes.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidanimateGTU(LaneBasedGTU gtu)Draw the GTU (scheduled method).protected voidanimateGTUGenerator(GtuGenerator gtuGenerator)Draw the GTUGenerator.static DefaultAnimationFactoryanimateNetwork(OTSNetwork network, OTSSimulatorInterface simulator, GTUColorer gtuColorer)Creates animations for nodes, links, lanes and GTUs.protected voidanimateStaticObject(ObjectInterface object)Draw the static object.static DefaultAnimationFactoryanimateXmlNetwork(OTSNetwork network, GTUColorer gtuColorer)Creates animations for nodes, links, lanes and GTUs.voidnotify(EventInterface event)
 
- 
- 
- 
Field Detail- 
animatedObjectspublic java.util.Map<ObjectInterface,Renderable2D<?>> animatedObjects rendered static objects.
 
- 
 - 
Constructor Detail- 
DefaultAnimationFactoryprotected 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- 
animateNetworkpublic 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
 
 - 
animateXmlNetworkpublic 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
 
 - 
notifypublic void notify(EventInterface event) throws java.rmi.RemoteException - Specified by:
- notifyin interface- EventListenerInterface
- Throws:
- java.rmi.RemoteException
 
 - 
animateGTUprotected void animateGTU(LaneBasedGTU gtu) Draw the GTU (scheduled method).- Parameters:
- gtu- LaneBasedGTU; the GTU to draw
 
 - 
animateStaticObjectprotected void animateStaticObject(ObjectInterface object) Draw the static object.- Parameters:
- object- ObjectInterface; the object to draw
 
 - 
animateGTUGeneratorprotected void animateGTUGenerator(GtuGenerator gtuGenerator) Draw the GTUGenerator.- Parameters:
- gtuGenerator- GtuGenerator; the GTUGenerator to draw
 
 
- 
 
-