Package org.opentrafficsim.draw.factory
Class DefaultAnimationFactory
java.lang.Object
org.opentrafficsim.draw.factory.DefaultAnimationFactory
- All Implemented Interfaces:
Serializable,Remote,EventListener,org.djutils.event.EventListener
DefaultAnimationFactory.java.
Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefaultAnimationFactory(org.opentrafficsim.core.network.Network network, GtuColorer gtuColorer, boolean animateNetwork) Creates animations for nodes, links and lanes. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidanimateGTU(LaneBasedGtu gtu) Draw the GTU (scheduled method).protected voidanimateLocatedObject(org.opentrafficsim.core.object.LocatedObject object) Draw the static object.static DefaultAnimationFactoryanimateNetwork(org.opentrafficsim.core.network.Network network, org.opentrafficsim.core.dsol.OtsSimulatorInterface simulator, GtuColorer gtuColorer) Creates animations for nodes, links, lanes and GTUs.protected voidanimateNonLocatedObject(org.opentrafficsim.core.object.NonLocatedObject object) Draw non-located objects.static DefaultAnimationFactoryanimateXmlNetwork(org.opentrafficsim.core.network.Network network, GtuColorer gtuColorer) Creates animations for nodes, links, lanes and GTUs.voidnotify(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, org.opentrafficsim.core.dsol.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- Network; the networksimulator- OtsSimulatorInterface; the simulatorgtuColorer- 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:
notifyin 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.
-