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.
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 Summary
Fields Modifier and Type Field Description java.util.Map<ObjectInterface,Renderable2D<?>>
animatedObjects
rendered static objects. -
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultAnimationFactory(OTSNetwork network, OTSSimulatorInterface simulator, GTUColorer gtuColorer, boolean animateNetwork)
Creates animations for nodes, links and lanes. -
Method Summary
Modifier and Type Method Description protected void
animateGTU(LaneBasedGTU gtu)
Draw the GTU (scheduled method).protected void
animateGTUGenerator(GtuGenerator gtuGenerator)
Draw the GTUGenerator.static DefaultAnimationFactory
animateNetwork(OTSNetwork network, OTSSimulatorInterface simulator, GTUColorer gtuColorer)
Creates animations for nodes, links, lanes and GTUs.protected void
animateStaticObject(ObjectInterface object)
Draw the static object.static DefaultAnimationFactory
animateXmlNetwork(OTSNetwork network, OTSSimulatorInterface simulator, GTUColorer gtuColorer)
Creates animations for nodes, links, lanes and GTUs.void
notify(EventInterface event)
-
Field Details
-
animatedObjects
rendered static objects.
-
-
Constructor Details
-
DefaultAnimationFactory
protected DefaultAnimationFactory(OTSNetwork network, OTSSimulatorInterface simulator, GTUColorer gtuColorer, boolean animateNetwork) throws OTSDrawingExceptionCreates 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 networksimulator
- OTSSimulatorInterface; the simulatorgtuColorer
- GTUColorer; GTU coloreranimateNetwork
- boolean; whether to animate the current network objects- Throws:
OTSDrawingException
- on drawing error
-
-
Method Details
-
animateNetwork
public static DefaultAnimationFactory animateNetwork(OTSNetwork network, OTSSimulatorInterface simulator, GTUColorer gtuColorer) throws OTSDrawingExceptionCreates 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 networksimulator
- OTSSimulatorInterface; the simulatorgtuColorer
- GTUColorer; GTU colorer- Returns:
- the DefaultAnimationFactory
- Throws:
OTSDrawingException
- on drawing error
-
animateXmlNetwork
public static DefaultAnimationFactory animateXmlNetwork(OTSNetwork network, OTSSimulatorInterface simulator, GTUColorer gtuColorer) throws OTSDrawingExceptionCreates 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 networksimulator
- OTSSimulatorInterface; the simulatorgtuColorer
- GTUColorer; GTU colorer- Returns:
- the DefaultAnimationFactory
- Throws:
OTSDrawingException
- on drawing error
-
notify
- Specified by:
notify
in interfaceEventListenerInterface
- Throws:
java.rmi.RemoteException
-
animateGTU
Draw the GTU (scheduled method).- Parameters:
gtu
- LaneBasedGTU; the GTU to draw
-
animateStaticObject
Draw the static object.- Parameters:
object
- ObjectInterface; the object to draw
-
animateGTUGenerator
Draw the GTUGenerator.- Parameters:
gtuGenerator
- GtuGenerator; the GTUGenerator to draw
-