private static class JoinAreasAction.WayTraverser extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Set<JoinAreasAction.WayInPolygon> |
availableWays
Set of
JoinAreasAction.WayInPolygon to be joined by walk algorithm |
private JoinAreasAction.WayInPolygon |
lastWay
Current state of walk algorithm
|
private boolean |
lastWayReverse
Direction of current way
|
Constructor and Description |
---|
WayTraverser(java.util.Collection<JoinAreasAction.WayInPolygon> ways)
Constructor
|
Modifier and Type | Method and Description |
---|---|
private static double |
getAngle(Node N1,
Node N2,
Node N3)
Returns oriented angle (N1N2, N1N3) in range [0; 2*Math.PI[
|
private Node |
getHeadNode()
Walking through
JoinAreasAction.WayInPolygon segments, head node is the current position |
private Node |
getPrevNode()
Node just before head node.
|
JoinAreasAction.WayInPolygon |
leftComingWay()
Search for an other way coming to the same head node at left side from last way.
|
void |
removeWay(JoinAreasAction.WayInPolygon way)
Remove a single way from available ways
|
void |
removeWays(java.util.Collection<JoinAreasAction.WayInPolygon> ways)
Remove ways from available ways
|
void |
setStartWay(JoinAreasAction.WayInPolygon way)
Reset walk algorithm to a new start point
|
JoinAreasAction.WayInPolygon |
startNewWay()
Reset walk algorithm to a new start point.
|
JoinAreasAction.WayInPolygon |
walk()
Get the next way creating a clockwise path, ensure it is the most right way.
|
private java.util.Set<JoinAreasAction.WayInPolygon> availableWays
JoinAreasAction.WayInPolygon
to be joined by walk algorithmprivate JoinAreasAction.WayInPolygon lastWay
private boolean lastWayReverse
WayTraverser(java.util.Collection<JoinAreasAction.WayInPolygon> ways)
public void removeWays(java.util.Collection<JoinAreasAction.WayInPolygon> ways)
ways
- Collection of WayInPolygonpublic void removeWay(JoinAreasAction.WayInPolygon way)
way
- WayInPolygonpublic void setStartWay(JoinAreasAction.WayInPolygon way)
way
- New start pointpublic JoinAreasAction.WayInPolygon startNewWay()
private Node getHeadNode()
JoinAreasAction.WayInPolygon
segments, head node is the current positionprivate Node getPrevNode()
private static double getAngle(Node N1, Node N2, Node N3)
public JoinAreasAction.WayInPolygon walk()
public JoinAreasAction.WayInPolygon leftComingWay()