Class OtsRenderable<L extends OtsShape>

java.lang.Object
nl.tudelft.simulation.dsol.animation.d2.Renderable2d<L>
org.opentrafficsim.draw.OtsRenderable<L>
Type Parameters:
L - locatable type
All Implemented Interfaces:
nl.tudelft.simulation.dsol.animation.d2.Renderable2dInterface<L>
Direct Known Subclasses:
AbstractLineAnimation, CrossSectionElementAnimation, DefaultCarAnimation, GtuGeneratorPositionAnimation, LaneAnimation.CenterLineAnimation, LinkAnimation, NodeAnimation, PriorityAnimation, SpeedSignAnimation, StaticObjectAnimation, StripeAnimation, TrafficLightDetectorAnimation

public abstract class OtsRenderable<L extends OtsShape> extends nl.tudelft.simulation.dsol.animation.d2.Renderable2d<L>
Extends Renderable2d to let the contains method look at the actual bounds shape, rather than only the box.

Copyright (c) 2024-2024 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

    Constructors
    Constructor
    Description
    OtsRenderable(L source, nl.tudelft.simulation.naming.context.Contextualized contextProvider)
    Constructs a new Renderable2d.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(Point2D pointScreenCoordinates, Bounds2d extent, Dimension screenSize, nl.tudelft.simulation.dsol.animation.d2.RenderableScale scale, double worldMargin, double pixelMargin)
     
    boolean
    contains(Point2d pointRelativeTo00, nl.tudelft.simulation.dsol.animation.d2.RenderableScale scale, double worldMargin, double pixelMargin, double xScale, double yScale)
     
    protected void
    Resets rendering hints that this renderable changed through setRendering().
    protected void
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • OtsRenderable

      public OtsRenderable(L source, nl.tudelft.simulation.naming.context.Contextualized contextProvider)
      Constructs a new Renderable2d.
      Parameters:
      source - the source
      contextProvider - the object that can provide the context to store the animation objects
  • Method Details

    • setRendering

      protected void setRendering(Graphics2D graphics)
      Set standard rendering hints for this renderable to paint. The graphics should be reset using resetRendering() after painting.
      Parameters:
      graphics - graphics.
    • resetRendering

      protected void resetRendering(Graphics2D graphics)
      Resets rendering hints that this renderable changed through setRendering().
      Parameters:
      graphics - graphics.
    • contains

      public boolean contains(Point2D pointScreenCoordinates, Bounds2d extent, Dimension screenSize, nl.tudelft.simulation.dsol.animation.d2.RenderableScale scale, double worldMargin, double pixelMargin)
      Specified by:
      contains in interface nl.tudelft.simulation.dsol.animation.d2.Renderable2dInterface<L extends OtsShape>
      Overrides:
      contains in class nl.tudelft.simulation.dsol.animation.d2.Renderable2d<L extends OtsShape>
    • contains

      public boolean contains(Point2d pointRelativeTo00, nl.tudelft.simulation.dsol.animation.d2.RenderableScale scale, double worldMargin, double pixelMargin, double xScale, double yScale)
      Overrides:
      contains in class nl.tudelft.simulation.dsol.animation.d2.Renderable2d<L extends OtsShape>