Class RelationNodeMap<T extends IRelationMember<? extends IPrimitive>>
java.lang.Object
org.openstreetmap.josm.gui.dialogs.relation.sort.RelationNodeMap<T>
- Type Parameters:
T- The type ofIRelationMember
Auxiliary class for relation sorting.
Constructs two mappings: One that maps each way to its nodes and the inverse mapping that
maps each node to all ways that have this node.
After construction both maps are consistent, but later on objects that are no longer needed
are removed from the value sets.
However the corresponding keys are not deleted even if they map to an empty set.
Note that normal ways have 2 nodes (beginning and end) but roundabouts can have less or more
(that are shared by other members).
- Since:
- 1785, 17862 (generics)
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate INodeprivate Integerprivate INodeprivate final RelationNodeMap.NodesWaysAll members that are incomplete or not a wayprivate final RelationNodeMap.NodesWaysprivate final RelationNodeMap.NodesWaysprivate static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddNodeWayMap(INode n, int i) private voidaddNodeWayMapReverse(INode n, int i) private voidprivate voidaddRemainingForward(INode n, int i) private voidaddWayNodeMap(INode n, int i) private voidaddWayNodeMapReverse(INode n, int i) private booleanprivate Integerfind next node in nw NodeWays structure, if the node is found delete and return itprivate voiddeleteWayNode(RelationNodeMap.NodesWays nw, Integer way, INode n) private voidprivate voidThis relation member has been processed.private static Integerstatic INodeGets the start node of the member, respecting the direction role.static INodeGets the end node of the member, respecting the direction role.pop()Returns some remaining member or null if every sortable member has been processed.popAdjacent(Integer way) Return a relation member that is linked to the member 'i', but has not been popped yet.private IntegerpopBackwardOnewayPart(int way) private Integer
-
Field Details
-
ROLE_BACKWARD
- See Also:
-
map
-
onewayMap
-
onewayReverseMap
-
remaining
-
remainingOneway
-
notSortable
All members that are incomplete or not a way -
firstOneway
-
lastOnewayNode
-
firstCircular
-
-
Constructor Details
-
RelationNodeMap
RelationNodeMap(List<T> members)
-
-
Method Details
-
firstOnewayNode
Gets the start node of the member, respecting the direction role.- Parameters:
m- The relation member.- Returns:
nullif the member is no way, the node otherwise.- Since:
- 17862 (generics)
-
lastOnewayNode
Gets the end node of the member, respecting the direction role.- Parameters:
m- The relation member.- Returns:
nullif the member is no way, the node otherwise.
-
addPair
-
addNodeWayMap
-
addWayNodeMap
-
addNodeWayMapReverse
-
addWayNodeMapReverse
-
addRemainingForward
-
popAdjacent
Return a relation member that is linked to the member 'i', but has not been popped yet. Return null if there is no such member left.- Parameters:
way- way key- Returns:
- a relation member that is linked to the member 'i', but has not been popped yet
-
popForwardOnewayPart
-
checkIfEndOfLoopReached
-
popBackwardOnewayPart
-
deleteAndGetAdjacentNode
find next node in nw NodeWays structure, if the node is found delete and return it- Parameters:
nw- nodes and waysn- node- Returns:
- node next to n
-
findAdjacentWay
-
deleteWayNode
-
pop
Returns some remaining member or null if every sortable member has been processed.- Returns:
- member key
-
doneOneway
This relation member has been processed. Remove references in the map.nodes.- Parameters:
i- member key
-
done
-
getNotSortableMembers
-