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, org.opentrafficsim.base.geometry.SpatialObject, org.opentrafficsim.draw.ClickableLineLocatable, org.opentrafficsim.draw.ClickableLocatable, org.opentrafficsim.draw.network.LinkAnimation.LinkData, EvalWrapper.EvalListener

public class MapLinkData extends MapData implements org.opentrafficsim.draw.network.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:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    Remembers minimum and maximum start and end offset, to return the mean of both.
  • Field Summary

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

    Fields inherited from interface org.opentrafficsim.draw.ClickableLocatable

    EXPANSE

    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.djutils.draw.line.PolyLine2d
     
    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.Polygon2d
     
    org.djutils.event.EventListenerMap
     
     
    Returns the editor lane data for the lane of given id.
    org.djutils.draw.line.PolyLine2d
     
    org.djutils.draw.point.OrientedPoint2d
     
    org.opentrafficsim.base.geometry.OtsShape
     
    Returns the stripes.
    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.opentrafficsim.draw.ClickableLineLocatable

    getBounds

    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.
      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 org.djutils.draw.point.OrientedPoint2d getLocation()
      Specified by:
      getLocation in interface org.opentrafficsim.draw.network.LinkAnimation.LinkData
      Specified by:
      getLocation in interface nl.tudelft.simulation.dsol.animation.Locatable
      Specified by:
      getLocation in interface org.opentrafficsim.base.geometry.OtsLocatable
    • getContour

      public org.djutils.draw.line.Polygon2d getContour()
      Specified by:
      getContour in interface org.opentrafficsim.base.geometry.SpatialObject
    • getShape

      public org.opentrafficsim.base.geometry.OtsShape getShape()
      Specified by:
      getShape in interface org.opentrafficsim.base.geometry.OtsLocatable
    • getId

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

      public boolean isConnector()
      Specified by:
      isConnector in interface org.opentrafficsim.draw.network.LinkAnimation.LinkData
    • getCenterLine

      public org.djutils.draw.line.PolyLine2d getCenterLine()
      Specified by:
      getCenterLine in interface org.opentrafficsim.draw.network.LinkAnimation.LinkData
    • getLine

      public org.djutils.draw.line.PolyLine2d getLine()
      Specified by:
      getLine in interface org.opentrafficsim.draw.ClickableLineLocatable
    • 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 - 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 org.djutils.event.EventListenerMap getEventListenerMap() throws RemoteException
      Specified by:
      getEventListenerMap in interface org.djutils.event.EventProducer
      Throws:
      RemoteException
    • 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 org.djunits.value.vdouble.scalar.LinearDensity getClothoidStartCurvature()
      Returns the start curvature from the clothoid.
      Returns:
      start curvature from the clothoid.
    • getClothoidEndCurvature

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

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

      public org.djunits.value.vdouble.scalar.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