Class MapLinkData

java.lang.Object
org.opentrafficsim.editor.extensions.map.MapData
org.opentrafficsim.editor.extensions.map.MapLinkData
All Implemented Interfaces:
EventListener, nl.tudelft.simulation.dsol.animation.Locatable, Identifiable, EventListener, EventProducer, OtsShape, LineLocatable, LinkAnimation.LinkData, EvalWrapper.EvalListener

public class MapLinkData extends MapData implements LinkAnimation.LinkData, EventListener, EventProducer
LinkData for the editor Map. This class will also listen to any changes that may affect the link shape, maintain the drawn layout, and maintain the priority animation.

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

    • LAYOUT_REBUILT

      public static final EventType LAYOUT_REBUILT
      Event when layout is rebuilt.
  • Constructor Details

    • MapLinkData

      public MapLinkData(EditorMap map, XsdTreeNode linkNode, OtsEditor editor)
      Constructor.
      Parameters:
      map - map.
      linkNode - node Ots.Network.Link.
      editor - editor.
  • Method Details

    • destroy

      public void destroy()
      Description copied from class: MapData
      Destroy this data object, e.g. remove self as listener. Override and call super if subclasses remove their own listeners. Using weak references for listeners is another option to deal with obsolete listening.
      Overrides:
      destroy in class MapData
    • getLocation

      public DirectedPoint2d getLocation()
      Specified by:
      getLocation in interface LinkAnimation.LinkData
      Specified by:
      getLocation in interface nl.tudelft.simulation.dsol.animation.Locatable
      Specified by:
      getLocation in interface OtsShape
    • getAbsoluteContour

      public Polygon2d getAbsoluteContour()
      Specified by:
      getAbsoluteContour in interface OtsShape
    • getRelativeContour

      public Polygon2d getRelativeContour()
      Specified by:
      getRelativeContour in interface OtsShape
    • getId

      public String getId()
      Specified by:
      getId in interface Identifiable
    • isConnector

      public boolean isConnector()
      Specified by:
      isConnector in interface LinkAnimation.LinkData
    • getCenterLine

      public PolyLine2d getCenterLine()
      Specified by:
      getCenterLine in interface LinkAnimation.LinkData
    • getLine

      public PolyLine2d getLine()
      Specified by:
      getLine in interface LineLocatable
    • notify

      public void notify(Event event)
      Specified by:
      notify in interface EventListener
    • addCoordinate

      public void addCoordinate(XsdTreeNode node)
      The map was notified a new coordinate node was added. The node may or may not be part of this link.
      Parameters:
      node - added coordinate node.
    • removeCoordinate

      public void removeCoordinate(XsdTreeNode node)
      The map was notified a coordinate node was removed. The node may or may not be part of this link.
      Parameters:
      node - removed coordinate node.
    • getStripeData

      protected Collection<MapStripeData> getStripeData()
      Returns the stripes.
      Returns:
      stripes
    • getEventListenerMap

      public EventListenerMap getEventListenerMap()
      Specified by:
      getEventListenerMap in interface EventProducer
    • evalChanged

      public void evalChanged()
      Description copied from interface: EvalWrapper.EvalListener
      Notifies the listener that evaluation results may have changed.
      Specified by:
      evalChanged in interface EvalWrapper.EvalListener
    • notifyNodeIdChanged

      public void notifyNodeIdChanged(XsdTreeNode node)
      Notification from the Map that a node (Ots.Network.Node) id was changed.
      Parameters:
      node - node.
    • getLaneData

      public MapLaneData getLaneData(String laneId)
      Returns the editor lane data for the lane of given id.
      Parameters:
      laneId - id.
      Returns:
      editor lane data for the lane of given id.
    • getClothoidStartCurvature

      public LinearDensity getClothoidStartCurvature()
      Returns the start curvature from the clothoid.
      Returns:
      start curvature from the clothoid.
    • getClothoidEndCurvature

      public LinearDensity getClothoidEndCurvature()
      Returns the end curvature from the clothoid.
      Returns:
      end curvature from the clothoid.
    • getClothoidLength

      public Length getClothoidLength()
      Returns the length from the clothoid.
      Returns:
      length from the clothoid.
    • getClothoidA

      public Length getClothoidA()
      Returns the A value from the clothoid.
      Returns:
      A value from the clothoid.
    • getClothoidAppliedShape

      public String getClothoidAppliedShape()
      Returns whether the shape was applied as a Clothoid, an Arc, or as a Straight, depending on start and end position and direction.
      Returns:
      "Clothoid", "Arc" or "Straight".
    • toString

      public String toString()
      Overrides:
      toString in class Object