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
ConstructorsModifierConstructorDescriptionprotected
DefaultAnimationFactory
(org.opentrafficsim.core.network.Network network, GtuColorerManager gtuColorerManager, 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, GtuColorerManager gtuColorerManager, Map<org.opentrafficsim.core.gtu.GtuType, DefaultCarAnimation.GtuData.GtuMarker> markers) 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, GtuColorerManager gtuColorerManager, Map<org.opentrafficsim.core.gtu.GtuType, DefaultCarAnimation.GtuData.GtuMarker> markers) Creates animations for nodes, links, lanes and GTUs.void
notify
(org.djutils.event.Event event) void
setGtuMarker
(org.opentrafficsim.core.gtu.GtuType gtuType, DefaultCarAnimation.GtuData.GtuMarker marker) Set marker on GTU type.
-
Constructor Details
-
DefaultAnimationFactory
protected DefaultAnimationFactory(org.opentrafficsim.core.network.Network network, GtuColorerManager gtuColorerManager, boolean animateNetwork) 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
- the networkgtuColorerManager
- GTU colorer manageranimateNetwork
- whether to animate the current network objects
-
-
Method Details
-
setGtuMarker
public void setGtuMarker(org.opentrafficsim.core.gtu.GtuType gtuType, DefaultCarAnimation.GtuData.GtuMarker marker) Set marker on GTU type.- Parameters:
gtuType
- GTU typemarker
- marker- Throws:
NullPointerException
- when marker is null
-
animateNetwork
public static DefaultAnimationFactory animateNetwork(org.opentrafficsim.core.network.Network network, nl.tudelft.simulation.naming.context.Contextualized contextualized, GtuColorerManager gtuColorerManager, Map<org.opentrafficsim.core.gtu.GtuType, DefaultCarAnimation.GtuData.GtuMarker> markers) 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
- the networkcontextualized
- context providergtuColorerManager
- GTU colorer managermarkers
- GTU type markers- Returns:
- the DefaultAnimationFactory
-
animateXmlNetwork
public static DefaultAnimationFactory animateXmlNetwork(org.opentrafficsim.core.network.Network network, GtuColorerManager gtuColorerManager, Map<org.opentrafficsim.core.gtu.GtuType, DefaultCarAnimation.GtuData.GtuMarker> markers) 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
- the networkgtuColorerManager
- GTU colorer managermarkers
- GTU type markers- Returns:
- the DefaultAnimationFactory
-
notify
- Specified by:
notify
in interfaceorg.djutils.event.EventListener
- Throws:
RemoteException
-
animateGTU
Draw the GTU (scheduled method).- Parameters:
gtu
- the GTU to draw
-
animateLocatedObject
protected void animateLocatedObject(org.opentrafficsim.core.object.LocatedObject object) Draw the static object.- Parameters:
object
- the object to draw
-
animateNonLocatedObject
protected void animateNonLocatedObject(org.opentrafficsim.core.object.NonLocatedObject object) Draw non-located objects.- Parameters:
object
- the object to draw.
-