Class LaneDetectorAnimation<L extends LaneDetectorAnimation.LaneDetectorData>
java.lang.Object
nl.tudelft.simulation.dsol.animation.d2.Renderable2d<L>
org.opentrafficsim.animation.OtsRenderable<L>
org.opentrafficsim.animation.OtsRenderableLabeled<L,T>
org.opentrafficsim.animation.road.AbstractLineAnimation<L,LaneDetectorAnimation.Text<L>>
org.opentrafficsim.animation.road.LaneDetectorAnimation<L>
- Type Parameters:
L- detector data type
- All Implemented Interfaces:
Renderable2dInterface<L>
public class LaneDetectorAnimation<L extends LaneDetectorAnimation.LaneDetectorData>
extends AbstractLineAnimation<L,LaneDetectorAnimation.Text<L>>
Draw lane detector.
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceProvides the information required to draw a lane detector.static interfaceProvides the information required to draw a loop detector.static interfaceProvides the information required to draw a sink.static classText animation for the detector.Nested classes/interfaces inherited from class org.opentrafficsim.animation.road.AbstractLineAnimation
AbstractLineAnimation.LaneBasedObjectDataNested classes/interfaces inherited from class org.opentrafficsim.animation.OtsRenderableLabeled
OtsRenderableLabeled.NoText<L extends OtsShape> -
Field Summary
Fields inherited from interface nl.tudelft.simulation.dsol.animation.d2.Renderable2dInterface
ANIMATION_OBJECT_COUNTER, FLIP_FLAG, ROTATE_FLAG, SCALE_FLAG, SCALE_OBJECT_FLAG, SCALE_Y_FLAG, TRANSLATE_FLAG -
Constructor Summary
ConstructorsConstructorDescriptionLaneDetectorAnimation(L laneDetector, nl.tudelft.simulation.naming.context.Contextualized contextualized, Color color) This constructor uses a provider for the text animation.LaneDetectorAnimation(L laneDetector, nl.tudelft.simulation.naming.context.Contextualized contextualized, Color color, String prefix) This constructor uses a provider for the text animation. -
Method Summary
Modifier and TypeMethodDescriptionprotected LaneDetectorAnimation.Text<L>createText(L source, nl.tudelft.simulation.naming.context.Contextualized contextualized, String prefix) Returns a text object that is co-animated with the object itself.final voidpaint(Graphics2D graphics, ImageObserver observer) final StringtoString()Methods inherited from class org.opentrafficsim.animation.OtsRenderableLabeled
destroy, setDynamicMethods inherited from class org.opentrafficsim.animation.OtsRenderable
contains, contains, isDynamic, resetRendering, setRenderingMethods 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
-
Constructor Details
-
LaneDetectorAnimation
public LaneDetectorAnimation(L laneDetector, nl.tudelft.simulation.naming.context.Contextualized contextualized, Color color) This constructor uses a provider for the text animation. This should provide an animation that extendsTextAnimationand implements the right tagging interface to toggle the correct label belonging to L. Alternatively, the toggle can be specified to the class that extendsTextAnimationdirectly.- Parameters:
laneDetector- the lane detector to drawcontextualized- context providercolor- the display color of the detector
-
LaneDetectorAnimation
public LaneDetectorAnimation(L laneDetector, nl.tudelft.simulation.naming.context.Contextualized contextualized, Color color, String prefix) This constructor uses a provider for the text animation. This should provide an animation that extendsTextAnimationand implements the right tagging interface to toggle the correct label belonging to L. Alternatively, the toggle can be specified to the class that extendsTextAnimationdirectly.- Parameters:
laneDetector- the lane detector to drawcontextualized- context providercolor- the display color of the detectorprefix- label prefix
-
-
Method Details
-
createText
protected LaneDetectorAnimation.Text<L> createText(L source, nl.tudelft.simulation.naming.context.Contextualized contextualized, String prefix) Description copied from class:OtsRenderableLabeledReturns a text object that is co-animated with the object itself. Sub-classes ofOtsRenderableLabeledtypically define a.Textclass that extendsRenderableTextSourcesuch that a separate class exists that can be toggled on/off. In this way labels of renderables can be show separately from the object itself. Theprefixmay be ignore depending on the sub-class knowing it provided no prefix to this class, its super class.- Specified by:
createTextin classOtsRenderableLabeled<L extends LaneDetectorAnimation.LaneDetectorData,LaneDetectorAnimation.Text<L extends LaneDetectorAnimation.LaneDetectorData>> - Parameters:
source- the object for which the text is displayedcontextualized- context providerprefix- prefix for the label- Returns:
- text renderable, may be
nullto omit a label
-
paint
- Overrides:
paintin classAbstractLineAnimation<L extends LaneDetectorAnimation.LaneDetectorData,LaneDetectorAnimation.Text<L extends LaneDetectorAnimation.LaneDetectorData>>
-
toString
- Overrides:
toStringin classRenderable2d<L extends LaneDetectorAnimation.LaneDetectorData>
-