Class MapData
java.lang.Object
org.opentrafficsim.editor.extensions.map.MapData
- All Implemented Interfaces:
EvalWrapper.EvalListener
- Direct Known Subclasses:
MapLaneBasedObjectData,MapLinkData,MapNodeData
Part of the map data structure.
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroy this data object, e.g. remove self as listener.getEval()Returns the evaluator for expressions.protected EditorMapgetMap()Returns the map.getNode()Returns the tree node.protected <T> voidsetValue(Consumer<T> setter, ExpressionAdapter<T, ?> adapter, XsdTreeNode node, String attribute) Generic method to set a value based on a changed attribute.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opentrafficsim.editor.EvalWrapper.EvalListener
evalChanged
-
Constructor Details
-
MapData
Constructor.- Parameters:
map- map.node- tree node.editor- editor.
-
-
Method Details
-
getNode
Returns the tree node.- Returns:
- tree node.
-
getEval
Returns the evaluator for expressions.- Returns:
- evaluator for expressions.
-
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. -
getMap
Returns the map.- Returns:
- map.
-
setValue
protected <T> void setValue(Consumer<T> setter, ExpressionAdapter<T, ?> adapter, XsdTreeNode node, String attribute) Generic method to set a value based on a changed attribute. If the new value isnull, the setter is invoked to set anullvalue. If the value is an invalid expression, or the value cannot be unmarshalled by the adapter, no change is made.- Type Parameters:
T- type of the value to set.- Parameters:
setter- setter that receives a successfully derived value.adapter- adapter.node- node that has the attribute, will often begetNode().attribute- name of the attribute.
-