Package org.opentrafficsim.draw.gtu
Class DefaultCarAnimation
- java.lang.Object
-
- nl.tudelft.simulation.dsol.animation.D2.Renderable2D<LaneBasedGTU>
-
- org.opentrafficsim.draw.gtu.DefaultCarAnimation
-
- All Implemented Interfaces:
Serializable
,Renderable2DInterface<LaneBasedGTU>
,ClonableRenderable2DInterface<LaneBasedGTU>
public class DefaultCarAnimation extends Renderable2D<LaneBasedGTU> implements ClonableRenderable2DInterface<LaneBasedGTU>, Serializable
Draw a car.Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision: 1401 $, $LastChangedDate: 2015-09-14 01:33:02 +0200 (Mon, 14 Sep 2015) $, by $Author: averbraeck $,
initial version 29 dec. 2014
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
DefaultCarAnimation.Text
Text animation for the Car.
-
Constructor Summary
Constructors Constructor Description DefaultCarAnimation(LaneBasedGTU gtu, org.opentrafficsim.core.dsol.OTSSimulatorInterface simulator)
Construct the DefaultCarAnimation for a LaneBasedIndividualCar.DefaultCarAnimation(LaneBasedGTU gtu, org.opentrafficsim.core.dsol.OTSSimulatorInterface simulator, GTUColorer gtuColorer)
Construct the DefaultCarAnimation for a LaneBasedIndividualCar.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClonableRenderable2DInterface<LaneBasedGTU>
clone(LaneBasedGTU newSource, org.opentrafficsim.core.dsol.OTSSimulatorInterface newSimulator)
Clone the animation object and register it for the new source on the new simulation.void
destroy(Contextualized contextProvider)
boolean
equals(Object object)
int
hashCode()
void
paint(Graphics2D graphics, ImageObserver observer)
void
setGTUColorer(GTUColorer newGTUColorer)
Replace the GTUColorer.String
toString()
-
Methods inherited from class nl.tudelft.simulation.dsol.animation.D2.Renderable2D
bind2Context, contains, getId, getSource, isFlip, isRotate, isScale, isScaleObject, isScaleY, isTranslate, paint, paintComponent, setFlip, setRotate, setScale, setScaleObject, setScaleY, setTranslate
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface nl.tudelft.simulation.dsol.animation.D2.Renderable2DInterface
contains, getId, getSource, paintComponent
-
-
-
-
Constructor Detail
-
DefaultCarAnimation
public DefaultCarAnimation(LaneBasedGTU gtu, org.opentrafficsim.core.dsol.OTSSimulatorInterface simulator) throws NamingException, RemoteException
Construct the DefaultCarAnimation for a LaneBasedIndividualCar.- Parameters:
gtu
- LaneBasedGTU; the Car to drawsimulator
- OTSSimulatorInterface; the simulator to schedule on- Throws:
NamingException
- in case of registration failure of the animationRemoteException
- on communication failure
-
DefaultCarAnimation
public DefaultCarAnimation(LaneBasedGTU gtu, org.opentrafficsim.core.dsol.OTSSimulatorInterface simulator, GTUColorer gtuColorer) throws NamingException, RemoteException
Construct the DefaultCarAnimation for a LaneBasedIndividualCar.- Parameters:
gtu
- LaneBasedGTU; the Car to drawsimulator
- OTSSimulatorInterface; the simulator to schedule ongtuColorer
- GTUColorer; the GTUColorer that determines what fill color to use- Throws:
NamingException
- in case of registration failure of the animationRemoteException
- on communication failure
-
-
Method Detail
-
setGTUColorer
public final void setGTUColorer(GTUColorer newGTUColorer)
Replace the GTUColorer.- Parameters:
newGTUColorer
- GTUColorer; the GTUColorer to use from now on
-
paint
public final void paint(Graphics2D graphics, ImageObserver observer)
- Specified by:
paint
in classRenderable2D<LaneBasedGTU>
-
destroy
public void destroy(Contextualized contextProvider)
- Specified by:
destroy
in interfaceRenderable2DInterface<LaneBasedGTU>
- Overrides:
destroy
in classRenderable2D<LaneBasedGTU>
-
clone
public ClonableRenderable2DInterface<LaneBasedGTU> clone(LaneBasedGTU newSource, org.opentrafficsim.core.dsol.OTSSimulatorInterface newSimulator) throws NamingException, RemoteException
Clone the animation object and register it for the new source on the new simulation.- Specified by:
clone
in interfaceClonableRenderable2DInterface<LaneBasedGTU>
- Parameters:
newSource
- T; the sourcenewSimulator
- OTSSimulatorInterface; the simulator- Returns:
- the generated clone
- Throws:
NamingException
- when animation context cannot be created or retrievedRemoteException
- - when remote context cannot be found
-
toString
public final String toString()
- Overrides:
toString
in classRenderable2D<LaneBasedGTU>
-
-