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-2020 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.-
Nested classes/interfaces inherited from interface nl.tudelft.simulation.dsol.animation.D2.Renderable2DInterface
Renderable2DInterface.Util
-
-
Constructor Summary
Constructors Constructor Description DefaultCarAnimation(LaneBasedGTU gtu, SimulatorInterface.TimeDoubleUnit simulator)
Construct the DefaultCarAnimation for a LaneBasedIndividualCar.DefaultCarAnimation(LaneBasedGTU gtu, SimulatorInterface.TimeDoubleUnit 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, SimulatorInterface.TimeDoubleUnit newSimulator)
Clone the animation object and register it for the new source on the new simulation.void
destroy()
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, getSource, isFlip, isRotate, isScale, isTranslate, paint, setFlip, setRotate, setScale, 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, getSource, paint
-
-
-
-
Constructor Detail
-
DefaultCarAnimation
public DefaultCarAnimation(LaneBasedGTU gtu, SimulatorInterface.TimeDoubleUnit simulator) throws NamingException, RemoteException
Construct the DefaultCarAnimation for a LaneBasedIndividualCar.- Parameters:
gtu
- LaneBasedGTU; the Car to drawsimulator
- SimulatorInterface.TimeDoubleUnit; the simulator to schedule on- Throws:
NamingException
- in case of registration failure of the animationRemoteException
- on communication failure
-
DefaultCarAnimation
public DefaultCarAnimation(LaneBasedGTU gtu, SimulatorInterface.TimeDoubleUnit simulator, GTUColorer gtuColorer) throws NamingException, RemoteException
Construct the DefaultCarAnimation for a LaneBasedIndividualCar.- Parameters:
gtu
- LaneBasedGTU; the Car to drawsimulator
- SimulatorInterface.TimeDoubleUnit; 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 final void destroy() throws NamingException, RemoteException
- Specified by:
destroy
in interfaceRenderable2DInterface<LaneBasedGTU>
- Overrides:
destroy
in classRenderable2D<LaneBasedGTU>
- Throws:
NamingException
RemoteException
-
clone
public ClonableRenderable2DInterface<LaneBasedGTU> clone(LaneBasedGTU newSource, SimulatorInterface.TimeDoubleUnit 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
- SimulatorInterface.TimeDoubleUnit; 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>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classRenderable2D<LaneBasedGTU>
-
equals
public boolean equals(Object object)
- Overrides:
equals
in classRenderable2D<LaneBasedGTU>
-
-