Class MapLinkData

java.lang.Object
org.opentrafficsim.editor.extensions.map.MapData
org.opentrafficsim.editor.extensions.map.MapLinkData
All Implemented Interfaces:
Serializable, Remote, EventListener, nl.tudelft.simulation.dsol.animation.Locatable, org.djutils.base.Identifiable, org.djutils.event.EventListener, org.djutils.event.EventProducer, org.opentrafficsim.base.geometry.OtsLocatable, LinkAnimation.LinkData, EvalWrapper.EvalListener

public class MapLinkData extends MapData implements LinkAnimation.LinkData, org.djutils.event.EventListener, org.djutils.event.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
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.djutils.event.EventType
    Event when layout is rebuilt.

    Fields inherited from interface org.djutils.event.EventProducer

    FIRST_POSITION, LAST_POSITION
  • Constructor Summary

    Constructors
    Constructor
    Description
    MapLinkData(EditorMap map, XsdTreeNode linkNode, OtsEditor editor)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The map was notified a new coordinate node was added.
    void
    Destroy this data object, e.g. remove self as listener.
    void
    Notifies the listener that evaluation results may have changed.
    org.opentrafficsim.base.geometry.OtsBounds2d
    org.djunits.value.vdouble.scalar.Length
    Returns the A value from the clothoid.
    Returns whether the shape was applied as a Clothoid, an Arc, or as a Straight, depending on start and end position and direction.
    org.djunits.value.vdouble.scalar.LinearDensity
    Returns the end curvature from the clothoid.
    org.djunits.value.vdouble.scalar.Length
    Returns the length from the clothoid.
    org.djunits.value.vdouble.scalar.LinearDensity
    Returns the start curvature from the clothoid.
    org.djutils.draw.line.PolyLine2d
    org.djutils.event.EventListenerMap
    Returns the editor lane data for the lane of given id.
    org.djutils.draw.point.OrientedPoint2d
    boolean
    void
    notify(org.djutils.event.Event event)
    void
    Notification from the Map that a node (Ots.Network.Node) id was changed.
    void
    The map was notified a coordinate node was removed.

    Methods inherited from class org.opentrafficsim.editor.extensions.map.MapData

    getEval, getMap, getNode, setInvalid, setValid, setValue

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.djutils.event.EventProducer

    addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener

    Methods inherited from interface org.opentrafficsim.draw.network.LinkAnimation.LinkData

    getZ

    Methods inherited from interface nl.tudelft.simulation.dsol.animation.Locatable

    getDirZ
  • Field Details

    • LAYOUT_REBUILT

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

    • MapLinkData

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

    • destroy

      public void destroy()
      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
    • getBounds

      public org.opentrafficsim.base.geometry.OtsBounds2d getBounds()
      Specified by:
      getBounds in interface nl.tudelft.simulation.dsol.animation.Locatable
      Specified by:
      getBounds in interface org.opentrafficsim.base.geometry.OtsLocatable
    • getId

      public String getId()
      Specified by:
      getId in interface org.djutils.base.Identifiable
    • getLocation

      public org.djutils.draw.point.OrientedPoint2d getLocation()
      Specified by:
      getLocation in interface LinkAnimation.LinkData
      Specified by:
      getLocation in interface nl.tudelft.simulation.dsol.animation.Locatable
      Specified by:
      getLocation in interface org.opentrafficsim.base.geometry.OtsLocatable
    • isConnector

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

      public org.djutils.draw.line.PolyLine2d getDesignLine()
      Specified by:
      getDesignLine in interface LinkAnimation.LinkData
    • notify

      public void notify(org.djutils.event.Event event) throws RemoteException
      Specified by:
      notify in interface org.djutils.event.EventListener
      Throws:
      RemoteException
    • 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 - XsdTreeNode; 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 - XsdTreeNode; removed coordinate node.
    • getEventListenerMap

      public org.djutils.event.EventListenerMap getEventListenerMap() throws RemoteException
      Specified by:
      getEventListenerMap in interface org.djutils.event.EventProducer
      Throws:
      RemoteException
    • evalChanged

      public void evalChanged()
      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 - XsdTreeNode; node.
    • getLaneData

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

      public org.djunits.value.vdouble.scalar.LinearDensity getClothoidStartCurvature()
      Returns the start curvature from the clothoid.
      Returns:
      Length; start curvature from the clothoid.
    • getClothoidEndCurvature

      public org.djunits.value.vdouble.scalar.LinearDensity getClothoidEndCurvature()
      Returns the end curvature from the clothoid.
      Returns:
      Length; end curvature from the clothoid.
    • getClothoidLength

      public org.djunits.value.vdouble.scalar.Length getClothoidLength()
      Returns the length from the clothoid.
      Returns:
      Length; length from the clothoid.
    • getClothoidA

      public org.djunits.value.vdouble.scalar.Length getClothoidA()
      Returns the A value from the clothoid.
      Returns:
      Length; 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:
      String; "Clothoid", "Arc" or "Straight".
    • toString

      public String toString()
      Overrides:
      toString in class Object