Package org.openstreetmap.josm.actions
Class JoinAreasAction.WayTraverser
java.lang.Object
org.openstreetmap.josm.actions.JoinAreasAction.WayTraverser
- Enclosing class:
- JoinAreasAction
This helper class implements algorithm traversing through connected ways.
Assumes you are going in clockwise orientation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Set<JoinAreasAction.WayInPolygon>Set ofJoinAreasAction.WayInPolygonto be joined by walk algorithmprivate JoinAreasAction.WayInPolygonCurrent state of walk algorithmprivate booleanDirection of current way -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static doubleReturns oriented angle (N1N2, N1N3) in range [0; 2*Math.PI[private NodeWalking throughJoinAreasAction.WayInPolygonsegments, head node is the current positionprivate NodeNode just before head node.Search for another way coming to the same head node at left side from last way.voidRemove a single way from available waysvoidRemove ways from available waysvoidReset walk algorithm to a new start pointReset walk algorithm to a new start point.walk()Get the next way creating a clockwise path, ensure it is the most right way.
-
Field Details
-
availableWays
Set ofJoinAreasAction.WayInPolygonto be joined by walk algorithm -
lastWay
Current state of walk algorithm -
lastWayReverse
Direction of current way
-
-
Constructor Details
-
WayTraverser
Constructor- Parameters:
ways- available ways
-
-
Method Details
-
removeWays
Remove ways from available ways- Parameters:
ways- Collection of WayInPolygon
-
removeWay
Remove a single way from available ways- Parameters:
way- WayInPolygon
-
setStartWay
Reset walk algorithm to a new start point- Parameters:
way- New start point
-
startNewWay
Reset walk algorithm to a new start point.- Returns:
- The new start point or null if no available way remains
-
getHeadNode
Walking throughJoinAreasAction.WayInPolygonsegments, head node is the current position- Returns:
- Head node
-
getPrevNode
Node just before head node.- Returns:
- Previous node
-
getAngle
Returns oriented angle (N1N2, N1N3) in range [0; 2*Math.PI[- Parameters:
n1- first noden2- second noden3- third node- Returns:
- oriented angle (N1N2, N1N3) in range [0; 2*Math.PI[
-
walk
Get the next way creating a clockwise path, ensure it is the most right way. #7959- Returns:
- The next way.
-
leftComingWay
Search for another way coming to the same head node at left side from last way. #9951- Returns:
- left way or null if none found
-