Class OtsRenderable<L extends OtsLocatable>

java.lang.Object
nl.tudelft.simulation.dsol.animation.d2.Renderable2d<L>
org.opentrafficsim.base.geometry.OtsRenderable<L>
Type Parameters:
L - locatable type
All Implemented Interfaces:
Serializable, nl.tudelft.simulation.dsol.animation.d2.Renderable2dInterface<L>

public abstract class OtsRenderable<L extends OtsLocatable> 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
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Standard rendering keys.
    static Object[]
    Standard rendering values.
  • 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(org.djutils.draw.point.Point2d pointWorldCoordinates, org.djutils.draw.bounds.Bounds2d extent)
    protected void
    Resets rendering hints that this renderable changed through setRendering().
    protected void
    Set standard rendering hints for this renderable to paint.
    static org.djutils.draw.Transform2d
    toBoundsTransform(org.djutils.draw.point.Point2d location)
    Returns a transformation by which absolute coordinates can be translated and rotated to the frame of the possibly oriented location around which bounds are defined.

    Methods inherited from class nl.tudelft.simulation.dsol.animation.d2.Renderable2d

    bind2Context, 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
  • Field Details

    • RENDERING_KEYS

      public static RenderingHints.Key[] RENDERING_KEYS
      Standard rendering keys.
    • RENDERING_VALUES

      public static Object[] RENDERING_VALUES
      Standard rendering values.
  • Constructor Details

    • OtsRenderable

      public OtsRenderable(L source, nl.tudelft.simulation.naming.context.Contextualized contextProvider)
      Constructs a new Renderable2d.
      Parameters:
      source - T; the source
      contextProvider - Contextualized; 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 - Graphics2D; graphics.
    • resetRendering

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

      public boolean contains(org.djutils.draw.point.Point2d pointWorldCoordinates, org.djutils.draw.bounds.Bounds2d extent)
      Specified by:
      contains in interface nl.tudelft.simulation.dsol.animation.d2.Renderable2dInterface<L extends OtsLocatable>
      Overrides:
      contains in class nl.tudelft.simulation.dsol.animation.d2.Renderable2d<L extends OtsLocatable>
    • toBoundsTransform

      public static org.djutils.draw.Transform2d toBoundsTransform(org.djutils.draw.point.Point2d location)
      Returns a transformation by which absolute coordinates can be translated and rotated to the frame of the possibly oriented location around which bounds are defined.
      Parameters:
      location - Point2d; location (can be an Oriented).
      Returns:
      Transform2d; transformation.