Package org.opentrafficsim.animation
Class DefaultAnimationFactory
java.lang.Object
org.opentrafficsim.animation.DefaultAnimationFactory
- All Implemented Interfaces:
Serializable
,Remote
,EventListener
,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 Summary
ModifierConstructorDescriptionprotected
DefaultAnimationFactory
(org.opentrafficsim.core.network.Network network, GtuColorer gtuColorer, boolean animateNetwork) Creates animations for nodes, links and lanes. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
animateGTU
(LaneBasedGtu gtu) Draw the GTU (scheduled method).protected void
animateLocatedObject
(org.opentrafficsim.core.object.LocatedObject object) Draw the static object.static DefaultAnimationFactory
animateNetwork
(org.opentrafficsim.core.network.Network network, nl.tudelft.simulation.naming.context.Contextualized contextualized, GtuColorer gtuColorer) Creates animations for nodes, links, lanes and GTUs.protected void
animateNonLocatedObject
(org.opentrafficsim.core.object.NonLocatedObject object) Draw non-located objects.static DefaultAnimationFactory
animateXmlNetwork
(org.opentrafficsim.core.network.Network network, GtuColorer gtuColorer) Creates animations for nodes, links, lanes and GTUs.void
notify
(org.djutils.event.Event event)
-
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 networkgtuColorer
- GtuColorer; GTU coloreranimateNetwork
- 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 networkcontextualized
- Contextualized; context providergtuColorer
- 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 networkgtuColorer
- GtuColorer; GTU colorer- Returns:
- the DefaultAnimationFactory
- Throws:
OtsDrawingException
- on drawing error
-
notify
- Specified by:
notify
in interfaceorg.djutils.event.EventListener
- Throws:
RemoteException
-
animateGTU
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.
-