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:
java.io.Serializable,Renderable2DInterface<LaneBasedGTU>,ClonableRenderable2DInterface<LaneBasedGTU>
public class DefaultCarAnimation extends Renderable2D<LaneBasedGTU> implements ClonableRenderable2DInterface<LaneBasedGTU>, java.io.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 classDefaultCarAnimation.TextText 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.voiddestroy()booleanequals(java.lang.Object object)inthashCode()voidpaint(java.awt.Graphics2D graphics, java.awt.image.ImageObserver observer)voidsetGTUColorer(GTUColorer newGTUColorer)Replace the GTUColorer.java.lang.StringtoString()-
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 javax.naming.NamingException, java.rmi.RemoteException
Construct the DefaultCarAnimation for a LaneBasedIndividualCar.- Parameters:
gtu- LaneBasedGTU; the Car to drawsimulator- SimulatorInterface.TimeDoubleUnit; the simulator to schedule on- Throws:
javax.naming.NamingException- in case of registration failure of the animationjava.rmi.RemoteException- on communication failure
-
DefaultCarAnimation
public DefaultCarAnimation(LaneBasedGTU gtu, SimulatorInterface.TimeDoubleUnit simulator, GTUColorer gtuColorer) throws javax.naming.NamingException, java.rmi.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:
javax.naming.NamingException- in case of registration failure of the animationjava.rmi.RemoteException- 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(java.awt.Graphics2D graphics, java.awt.image.ImageObserver observer)- Specified by:
paintin classRenderable2D<LaneBasedGTU>
-
destroy
public final void destroy() throws javax.naming.NamingException, java.rmi.RemoteException- Specified by:
destroyin interfaceRenderable2DInterface<LaneBasedGTU>- Overrides:
destroyin classRenderable2D<LaneBasedGTU>- Throws:
javax.naming.NamingExceptionjava.rmi.RemoteException
-
clone
public ClonableRenderable2DInterface<LaneBasedGTU> clone(LaneBasedGTU newSource, SimulatorInterface.TimeDoubleUnit newSimulator) throws javax.naming.NamingException, java.rmi.RemoteException
Clone the animation object and register it for the new source on the new simulation.- Specified by:
clonein interfaceClonableRenderable2DInterface<LaneBasedGTU>- Parameters:
newSource- T; the sourcenewSimulator- SimulatorInterface.TimeDoubleUnit; the simulator- Returns:
- the generated clone
- Throws:
javax.naming.NamingException- when animation context cannot be created or retrievedjava.rmi.RemoteException- - when remote context cannot be found
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classRenderable2D<LaneBasedGTU>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classRenderable2D<LaneBasedGTU>
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equalsin classRenderable2D<LaneBasedGTU>
-
-