Class MapLinkData
java.lang.Object
org.djutils.event.LocalEventProducer
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,LineLocatable,LinkAnimation.LinkData,OtsShape,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-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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassRemembers minimum and maximum start and end offset, to return the mean of both. -
Field Summary
FieldsFields inherited from class org.opentrafficsim.editor.extensions.map.MapData
MAP_DATA_CHANGEDFields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITIONFields inherited from interface org.opentrafficsim.base.geometry.OtsShape
DEFAULT_POLYGON_SEGMENTS, WORLD_MARGIN_LINE -
Constructor Summary
ConstructorsConstructorDescriptionMapLinkData(EditorMap map, XsdTreeNode linkNode, OtsEditor editor) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCoordinate(XsdTreeNode node) The map was notified a new coordinate node was added.voiddestroy()Destroy this data object, e.g. remove self as listener.voidNotifies the listener that evaluation results may have changed.doubleReturns the shape value of the Bezier.org.djunits.value.vdouble.scalar.LengthReturns 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.LinearDensityReturns the end curvature from the clothoid.org.djunits.value.vdouble.scalar.LengthReturns the length from the clothoid.org.djunits.value.vdouble.scalar.LinearDensityReturns the start curvature from the clothoid.Returns the design line.getId()getLaneData(String laneId) Returns the editor lane data for the lane of given id.getLine()Returns a safe copy of the polyline coordinates, mapped from XSD node to point.protected Collection<MapStripeData>Returns the stripes.booleanisBezier()Returns whether the link has a Bezier shape.booleanReturns whether the link has a clothoid shape.booleanbooleanReturns whether the link has a polyline shape.booleanReturns whether the Bezier is weighted.voidvoidNotification from the Map that a node (Ots.Network.Node) id was changed.voidnotifyNodeRemoved(XsdTreeNode node) Notification from the Map that a node (Ots.Network.Node) is removed.voidremoveCoordinate(XsdTreeNode node) The map was notified a coordinate node was removed.toString()Methods inherited from class org.opentrafficsim.editor.extensions.map.MapData
getEval, getMap, getNode, isValid, setValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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, removeListenerMethods inherited from interface org.opentrafficsim.animation.LineLocatable
contains, signedDistanceMethods inherited from interface org.opentrafficsim.animation.network.LinkAnimation.LinkData
getZMethods inherited from interface org.opentrafficsim.base.geometry.OtsShape
contains, getAbsoluteBounds, getAbsoluteContour, getDirZ, getRelativeBounds, signedDistance
-
Field Details
-
LAYOUT_REBUILT
Event when layout is rebuilt.
-
-
Constructor Details
-
MapLinkData
Constructor.- Parameters:
map- map.linkNode- node Ots.Network.Link.editor- editor.
-
-
Method Details
-
destroy
public void destroy()Description copied from class:MapDataDestroy 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. -
getLocation
- Specified by:
getLocationin interfaceLinkAnimation.LinkData- Specified by:
getLocationin interfacenl.tudelft.simulation.dsol.animation.Locatable- Specified by:
getLocationin interfaceOtsShape
-
getAbsoluteContour
- Specified by:
getAbsoluteContourin interfaceOtsShape
-
getRelativeContour
- Specified by:
getRelativeContourin interfaceOtsShape
-
getId
- Specified by:
getIdin interfaceIdentifiable
-
isConnector
public boolean isConnector()- Specified by:
isConnectorin interfaceLinkAnimation.LinkData
-
getCenterLine
- Specified by:
getCenterLinein interfaceLinkAnimation.LinkData
-
getLine
- Specified by:
getLinein interfaceLineLocatable
-
notify
- Specified by:
notifyin interfaceEventListener
-
addCoordinate
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
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
Returns the stripes.- Returns:
- stripes
-
getEventListenerMap
- Specified by:
getEventListenerMapin interfaceEventProducer- Overrides:
getEventListenerMapin classLocalEventProducer
-
evalChanged
public void evalChanged()Description copied from interface:EvalWrapper.EvalListenerNotifies the listener that evaluation results may have changed.- Specified by:
evalChangedin interfaceEvalWrapper.EvalListener
-
notifyNodeIdChanged
public void notifyNodeIdChanged()Notification from the Map that a node (Ots.Network.Node) id was changed. -
notifyNodeRemoved
Notification from the Map that a node (Ots.Network.Node) is removed.- Parameters:
node- node of node
-
getLaneData
Returns the editor lane data for the lane of given id.- Parameters:
laneId- id.- Returns:
- editor lane data for the lane of given id.
-
getDesignLine
Returns the design line.- Returns:
- design line
-
isBezier
public boolean isBezier()Returns whether the link has a Bezier shape.- Returns:
- whether the link has a Bezier shape
-
getBezierShape
public double getBezierShape()Returns the shape value of the Bezier.- Returns:
- the shape value of the Bezier
-
isWeightedBezier
public boolean isWeightedBezier()Returns whether the Bezier is weighted.- Returns:
- whether the Bezier is weighted
-
isPolyline
public boolean isPolyline()Returns whether the link has a polyline shape.- Returns:
- whether the link has a polyline shape
-
getPolylineCoordinates
Returns a safe copy of the polyline coordinates, mapped from XSD node to point.- Returns:
- a safe copy of the polyline coordinates
-
isClothoid
public boolean isClothoid()Returns whether the link has a clothoid shape.- Returns:
- whether the link has a clothoid shape
-
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
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
-