Class DraggableAnnotation

java.lang.Object
nl.tudelft.simulation.dsol.animation.d2.Renderable2d<L>
All Implemented Interfaces:
nl.tudelft.simulation.dsol.animation.d2.Renderable2dInterface<DraggableAnnotation.Draggable<?>>

public class DraggableAnnotation extends MapAnnotation<DraggableAnnotation.Draggable<?>>
Draggable by which the user can influence a value in the data structure.

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
  • Constructor Details

  • Method Details

    • setHighlightIfDeletable

      public void setHighlightIfDeletable(boolean selected)
      Sets whether the draggable is highlighted based on whether it is selected, and it is deletable.
      Parameters:
      selected - whether the draggable is selected
    • isDeletable

      public boolean isDeletable()
      Returns whether the draggable is deletable.
      Returns:
      whether the draggable is deletable
    • showValue

      public void showValue(OtsEditor editor)
      Shows the attribute and/or node in the tree that is affected by the draggable.
      Parameters:
      editor - editor
    • delete

      public void delete()
      Delete represented data of draggable.
    • paint

      public void paint(Graphics2D graphics, ImageObserver observer)
      Specified by:
      paint in class nl.tudelft.simulation.dsol.animation.d2.Renderable2d<DraggableAnnotation.Draggable<?>>
    • mouseDragged

      public void mouseDragged(Point2d mousePoint)
      Mouse was dragged.
      Parameters:
      mousePoint - world coordinate of mouse
    • mouseReleased

      public void mouseReleased(Point2d mousePoint)
      Mouse was released.
      Parameters:
      mousePoint - world coordinate of mouse
    • addHelperAnnotation

      public void addHelperAnnotation(HelperAnnotation annotation, DraggableAnnotation.UpdateMode updateMode)
      Add helper annotation. The update mode determines when the location is updated, which is set to the location of the animated draggable.
      Parameters:
      annotation - annotation
      updateMode - whether the annotation is update while dragging or only on mouse release
    • destroy

      public void destroy(nl.tudelft.simulation.naming.context.Contextualized contextProvider)
      Specified by:
      destroy in interface nl.tudelft.simulation.dsol.animation.d2.Renderable2dInterface<DraggableAnnotation.Draggable<?>>
      Overrides:
      destroy in class nl.tudelft.simulation.dsol.animation.d2.Renderable2d<DraggableAnnotation.Draggable<?>>
    • 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 OtsRenderable<DraggableAnnotation.Draggable<?>>