Package org.opentrafficsim.animation
Class OtsRenderable<L extends OtsShape>
java.lang.Object
nl.tudelft.simulation.dsol.animation.d2.Renderable2d<L>
org.opentrafficsim.animation.OtsRenderable<L>
- Type Parameters:
L- locatable type
- All Implemented Interfaces:
Renderable2dInterface<L>
- Direct Known Subclasses:
CrossSectionElementAnimation,DefaultCarAnimation,GtuGeneratorPositionAnimation,LaneAnimation.CenterLineAnimation,OtsRenderableLabeled,PerceptionAnimation,PriorityAnimation,StaticObjectAnimation,StripeAnimation,TrafficLightDetectorAnimation
Extends
Renderable2d to let the contains method look at the actual bounds shape, rather than only the box.
Copyright (c) 2024-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Wouter Schakel
-
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
ConstructorsConstructorDescriptionOtsRenderable(L source, nl.tudelft.simulation.naming.context.Contextualized contextProvider) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(Point2D pointScreenCoordinates, Bounds2d extent, Dimension screenSize, RenderableScale scale, double worldMargin, double pixelMargin) booleancontains(Point2d pointRelativeTo00, RenderableScale scale, double worldMargin, double pixelMargin, double xScale, double yScale) booleanReturns whether the renderable is dynamic.protected voidresetRendering(Graphics2D graphics) Resets rendering hints that this renderable changed throughsetRendering(java.awt.Graphics2D).setDynamic(boolean dynamic) Sets the dynamic state.protected voidsetRendering(Graphics2D graphics) Set standard rendering hints for this renderable to paint.Methods inherited from class nl.tudelft.simulation.dsol.animation.d2.Renderable2d
bind2Context, contains, destroy, getId, getSource, isFlip, isRotate, isScale, isScaleObject, isScaleY, isTranslate, paint, paint, paintComponent, setFlip, setRotate, setScale, setScaleObject, setScaleY, setTranslate, toString
-
Constructor Details
-
OtsRenderable
Constructor.- Parameters:
source- the sourcecontextProvider- the object that can provide the context to store the animation objects
-
-
Method Details
-
setDynamic
Sets the dynamic state.- Parameters:
dynamic- dynamic state- Returns:
- this renderable for method changing
-
isDynamic
public boolean isDynamic()Returns whether the renderable is dynamic.- Returns:
- whether the renderable is dynamic
-
setRendering
Set standard rendering hints for this renderable to paint. The graphics should be reset usingresetRendering(java.awt.Graphics2D)after painting.- Parameters:
graphics- graphics
-
resetRendering
Resets rendering hints that this renderable changed throughsetRendering(java.awt.Graphics2D).- Parameters:
graphics- graphics
-
contains
public boolean contains(Point2D pointScreenCoordinates, Bounds2d extent, Dimension screenSize, RenderableScale scale, double worldMargin, double pixelMargin) - Specified by:
containsin interfaceRenderable2dInterface<L extends OtsShape>- Overrides:
containsin classRenderable2d<L extends OtsShape>
-
contains
public boolean contains(Point2d pointRelativeTo00, RenderableScale scale, double worldMargin, double pixelMargin, double xScale, double yScale) - Overrides:
containsin classRenderable2d<L extends OtsShape>
-