Class MapAnnotation<L extends OtsShape>

java.lang.Object
nl.tudelft.simulation.dsol.animation.d2.Renderable2d<L>
org.opentrafficsim.animation.OtsRenderable<L>
org.opentrafficsim.editor.extensions.map.edit.MapAnnotation<L>
Type Parameters:
L - locatable type
All Implemented Interfaces:
nl.tudelft.simulation.dsol.animation.d2.Renderable2dInterface<L>
Direct Known Subclasses:
DraggableAnnotation, HelperAnnotation, SelectionAnnotation

public abstract class MapAnnotation<L extends OtsShape> extends OtsRenderable<L>
Convenience class where sub-classes can use px(double) or px(float[]) to obtain a paint stroke defined at pixel level for a locatable that is otherwise scaled in world coordinates.

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

    Constructors
    Constructor
    Description
    MapAnnotation(L source, EditorMap map)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected EditorMap
    Returns the map.
    protected float
    px(double width)
    Returns a world line width that corresponds to a pixel width of the input value.
    protected float[]
    px(float[] dash)
    Scales the value in the input array such that an intended pixel dash pattern is translated in to current world coordinates.

    Methods inherited from class org.opentrafficsim.animation.OtsRenderable

    contains, contains, isDynamic, resetRendering, setDynamic, setRendering

    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

    • MapAnnotation

      public MapAnnotation(L source, EditorMap map)
      Constructor.
      Parameters:
      source - source
      map - map
  • Method Details

    • getMap

      protected EditorMap getMap()
      Returns the map.
      Returns:
      map
    • px

      protected float px(double width)
      Returns a world line width that corresponds to a pixel width of the input value.
      Parameters:
      width - intended pixel line width
      Returns:
      world line width that corresponds to a pixel width of the input value
    • px

      protected float[] px(float[] dash)
      Scales the value in the input array such that an intended pixel dash pattern is translated in to current world coordinates.
      Parameters:
      dash - dash pattern
      Returns:
      input array