Package org.opentrafficsim.draw.road
Class LaneDetectorAnimation<L extends LaneDetectorAnimation.LaneDetectorData,T extends TextAnimation<L,T>>
java.lang.Object
nl.tudelft.simulation.dsol.animation.d2.Renderable2d<L>
org.opentrafficsim.base.geometry.OtsRenderable<T>
org.opentrafficsim.draw.road.AbstractLineAnimation<L>
org.opentrafficsim.draw.road.LaneDetectorAnimation<L,T>
- Type Parameters:
L
- detector data typeT
- text type
- All Implemented Interfaces:
Serializable
,nl.tudelft.simulation.dsol.animation.d2.Renderable2dInterface<L>
public class LaneDetectorAnimation<L extends LaneDetectorAnimation.LaneDetectorData,T extends TextAnimation<L,T>>
extends AbstractLineAnimation<L>
Draw LaneDetectorData.
Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands.
All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
LaneDetectorData provides the information required to draw a lane detector.static interface
SinkData provides the information required to draw a sink.static interface
SinkData provides the information required to draw a sink.static class
Text animation for the Detector.Nested classes/interfaces inherited from class org.opentrafficsim.draw.road.AbstractLineAnimation
AbstractLineAnimation.LaneBasedObjectData
-
Field Summary
Fields inherited from class org.opentrafficsim.base.geometry.OtsRenderable
RENDERING_KEYS, RENDERING_VALUES
-
Constructor Summary
ConstructorDescriptionLaneDetectorAnimation
(L laneDetector, nl.tudelft.simulation.naming.context.Contextualized contextualized, Color color, Function<LaneDetectorAnimation<L, T>, T> textSupplier) This constructor uses a provider for the text animation. -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy
(nl.tudelft.simulation.naming.context.Contextualized contextProvider) final T
getText()
ofGenericType
(LaneDetectorAnimation.LaneDetectorData laneDetector, nl.tudelft.simulation.naming.context.Contextualized contextualized, Color color) This method produces a detector animation that toggles generally for all LaneDetectorData and its respective text id.final void
paint
(Graphics2D graphics, ImageObserver observer) final String
toString()
Methods inherited from class org.opentrafficsim.draw.road.AbstractLineAnimation
getHalfLength
Methods inherited from class org.opentrafficsim.base.geometry.OtsRenderable
contains, resetRendering, setRendering, toBoundsTransform
Methods inherited from class nl.tudelft.simulation.dsol.animation.d2.Renderable2d
bind2Context, getId, getSource, isFlip, isRotate, isScale, isScaleObject, isScaleY, isTranslate, paint, paintComponent, setFlip, setRotate, setScale, setScaleObject, setScaleY, setTranslate
-
Constructor Details
-
LaneDetectorAnimation
public LaneDetectorAnimation(L laneDetector, nl.tudelft.simulation.naming.context.Contextualized contextualized, Color color, Function<LaneDetectorAnimation<L, T>, throws NamingException, RemoteExceptionT> textSupplier) This constructor uses a provider for the text animation. This should provide an animation that extendsTextAnimation
and implements the right tagging interface to toggle the correct label belonging to L. Alternatively, the toggle can be specified to the class that extendsTextAnimation
directly.- Parameters:
laneDetector
- L; the lane detector to draw.contextualized
- Contextualized; context provider.color
- Color; the display color of the detector.textSupplier
- Function<Float, Text>; text supplier.- Throws:
NamingException
- in case of registration failure of the animationRemoteException
- in case of remote registration failure of the animation
-
-
Method Details
-
ofGenericType
public static LaneDetectorAnimation<LaneDetectorAnimation.LaneDetectorData,LaneDetectorAnimation.Text> ofGenericType(LaneDetectorAnimation.LaneDetectorData laneDetector, nl.tudelft.simulation.naming.context.Contextualized contextualized, Color color) throws RemoteException, NamingException This method produces a detector animation that toggles generally for all LaneDetectorData and its respective text id.- Parameters:
laneDetector
- L; detector data.contextualized
- Contextualized; context provider.color
- Color; color.- Returns:
- animation for generic lane detector type.
- Throws:
NamingException
- in case of registration failure of the animationRemoteException
- in case of remote registration failure of the animation
-
getText
- Returns:
- text.
-
paint
- Overrides:
paint
in classAbstractLineAnimation<L extends LaneDetectorAnimation.LaneDetectorData>
-
destroy
public void destroy(nl.tudelft.simulation.naming.context.Contextualized contextProvider) - Specified by:
destroy
in interfacenl.tudelft.simulation.dsol.animation.d2.Renderable2dInterface<L extends LaneDetectorAnimation.LaneDetectorData>
- Overrides:
destroy
in classnl.tudelft.simulation.dsol.animation.d2.Renderable2d<L extends LaneDetectorAnimation.LaneDetectorData>
-
toString
- Overrides:
toString
in classnl.tudelft.simulation.dsol.animation.d2.Renderable2d<L extends LaneDetectorAnimation.LaneDetectorData>
-