Package org.opentrafficsim.draw.road
Class TrafficLightAnimation
java.lang.Object
nl.tudelft.simulation.dsol.animation.D2.Renderable2D<T>
org.opentrafficsim.draw.road.AbstractLineAnimation<TrafficLight>
org.opentrafficsim.draw.road.TrafficLightAnimation
- All Implemented Interfaces:
Serializable,Renderable2DInterface<TrafficLight>,ClonableRenderable2DInterface<TrafficLight>
public class TrafficLightAnimation extends AbstractLineAnimation<TrafficLight> implements ClonableRenderable2DInterface<TrafficLight>, Serializable
Draw a traffic light on the road at th place where the cars are expected to stop.
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 classTrafficLightAnimation.TextText animation for the TrafficLight.Nested classes/interfaces inherited from interface nl.tudelft.simulation.dsol.animation.D2.Renderable2DInterface
Renderable2DInterface.Util -
Constructor Summary
Constructors Constructor Description TrafficLightAnimation(TrafficLight trafficLight, SimulatorInterface.TimeDoubleUnit simulator)Construct the DefaultCarAnimation for a LaneBlock (road block). -
Method Summary
Modifier and Type Method Description ClonableRenderable2DInterface<TrafficLight>clone(TrafficLight newSource, SimulatorInterface.TimeDoubleUnit newSimulator)Clone the animation object and register it for the new source on the new simulation.voiddestroy()TrafficLightAnimation.TextgetText()voidpaint(Graphics2D graphics, ImageObserver observer)StringtoString()Methods inherited from class nl.tudelft.simulation.dsol.animation.D2.Renderable2D
bind2Context, contains, equals, getSource, hashCode, isFlip, isRotate, isScale, isTranslate, paint, setFlip, setRotate, setScale, setTranslateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface nl.tudelft.simulation.dsol.animation.D2.Renderable2DInterface
contains, getSource, paint
-
Constructor Details
-
TrafficLightAnimation
public TrafficLightAnimation(TrafficLight trafficLight, SimulatorInterface.TimeDoubleUnit simulator) throws NamingException, RemoteExceptionConstruct the DefaultCarAnimation for a LaneBlock (road block).- Parameters:
trafficLight- TrafficLight; the CSEBlock to drawsimulator- SimulatorInterface.TimeDoubleUnit; the simulator to schedule on- Throws:
NamingException- in case of registration failure of the animationRemoteException- on communication failure
-
-
Method Details
-
getText
- Returns:
- text.
-
paint
- Overrides:
paintin classAbstractLineAnimation<TrafficLight>- Throws:
RemoteException
-
destroy
- Specified by:
destroyin interfaceRenderable2DInterface<TrafficLight>- Overrides:
destroyin classRenderable2D<TrafficLight>- Throws:
NamingExceptionRemoteException
-
clone
public ClonableRenderable2DInterface<TrafficLight> clone(TrafficLight newSource, SimulatorInterface.TimeDoubleUnit newSimulator) throws NamingException, RemoteExceptionClone the animation object and register it for the new source on the new simulation.- Specified by:
clonein interfaceClonableRenderable2DInterface<TrafficLight>- 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
- Overrides:
toStringin classRenderable2D<TrafficLight>
-