|
10 | 10 |
|
11 | 11 | /** |
12 | 12 | * Shamos-Hoey simple polygon detection |
13 | | - * |
| 13 | + * <p> |
14 | 14 | * Based upon C++ implementation: |
15 | | - * http://geomalgorithms.com/a09-_intersect-3.html |
16 | | - * |
| 15 | + * <p> |
| 16 | + * <a href= |
| 17 | + * "http://geomalgorithms.com/a09-_intersect-3.html">http://geomalgorithms.com/a09-_intersect-3.html</a> |
| 18 | + * <p> |
17 | 19 | * C++ implementation license: |
18 | | - * |
| 20 | + * <p> |
19 | 21 | * Copyright 2001 softSurfer, 2012 Dan Sunday This code may be freely used and |
20 | 22 | * modified for any purpose providing that this copyright notice is included |
21 | 23 | * with it. SoftSurfer makes no warranty for this code, and cannot be held |
@@ -58,7 +60,8 @@ public static boolean simplePolygonPoints(List<Point> points) { |
58 | 60 | * polygon point rings |
59 | 61 | * @return true if simple, false if intersects |
60 | 62 | */ |
61 | | - public static boolean simplePolygonRingPoints(List<List<Point>> pointRings) { |
| 63 | + public static boolean simplePolygonRingPoints( |
| 64 | + List<List<Point>> pointRings) { |
62 | 65 | List<LineString> rings = new ArrayList<>(); |
63 | 66 | for (List<Point> points : pointRings) { |
64 | 67 | LineString ring = new LineString(); |
@@ -107,7 +110,8 @@ public static boolean simplePolygon(List<LineString> rings) { |
107 | 110 | if (ringCopyPoints.size() >= 3) { |
108 | 111 | Point first = ringCopyPoints.get(0); |
109 | 112 | Point last = ringCopyPoints.get(ringCopyPoints.size() - 1); |
110 | | - if (first.getX() == last.getX() && first.getY() == last.getY()) { |
| 113 | + if (first.getX() == last.getX() |
| 114 | + && first.getY() == last.getY()) { |
111 | 115 | ringCopyPoints.remove(ringCopyPoints.size() - 1); |
112 | 116 | } |
113 | 117 | } |
@@ -151,7 +155,8 @@ public static boolean simplePolygon(List<LineString> rings) { |
151 | 155 | if (event.getType() == EventType.LEFT) { |
152 | 156 | Segment segment = sweepLine.add(event); |
153 | 157 | if (sweepLine.intersect(segment, segment.getAbove()) |
154 | | - || sweepLine.intersect(segment, segment.getBelow())) { |
| 158 | + || sweepLine.intersect(segment, |
| 159 | + segment.getBelow())) { |
155 | 160 | simple = false; |
156 | 161 | break; |
157 | 162 | } |
|
0 commit comments