|
@@ -240,7 +240,7 @@ public class ShapeBuilderTests extends ElasticsearchTestCase {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void testDateline() {
|
|
|
+ public void testDatelineOGC() {
|
|
|
// view shape at https://gist.github.com/anonymous/7f1bb6d7e9cd72f5977c
|
|
|
// expect 3 polygons, 1 with a hole
|
|
|
|
|
@@ -281,6 +281,48 @@ public class ShapeBuilderTests extends ElasticsearchTestCase {
|
|
|
assertMultiPolygon(shape);
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testDateline() {
|
|
|
+ // view shape at https://gist.github.com/anonymous/7f1bb6d7e9cd72f5977c
|
|
|
+ // expect 3 polygons, 1 with a hole
|
|
|
+
|
|
|
+ // a giant c shape
|
|
|
+ PolygonBuilder builder = ShapeBuilder.newPolygon()
|
|
|
+ .point(-186,0)
|
|
|
+ .point(-176,0)
|
|
|
+ .point(-176,3)
|
|
|
+ .point(-183,3)
|
|
|
+ .point(-183,5)
|
|
|
+ .point(-176,5)
|
|
|
+ .point(-176,8)
|
|
|
+ .point(-186,8)
|
|
|
+ .point(-186,0);
|
|
|
+
|
|
|
+ // 3/4 of an embedded 'c', crossing dateline once
|
|
|
+ builder.hole()
|
|
|
+ .point(-185,1)
|
|
|
+ .point(-181,1)
|
|
|
+ .point(-181,2)
|
|
|
+ .point(-184,2)
|
|
|
+ .point(-184,6)
|
|
|
+ .point(-178,6)
|
|
|
+ .point(-178,7)
|
|
|
+ .point(-185,7)
|
|
|
+ .point(-185,1);
|
|
|
+
|
|
|
+ // embedded hole right of the dateline
|
|
|
+ builder.hole()
|
|
|
+ .point(-179,1)
|
|
|
+ .point(-177,1)
|
|
|
+ .point(-177,2)
|
|
|
+ .point(-179,2)
|
|
|
+ .point(-179,1);
|
|
|
+
|
|
|
+ Shape shape = builder.close().build();
|
|
|
+
|
|
|
+ assertMultiPolygon(shape);
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
public void testComplexShapeWithHole() {
|
|
|
PolygonBuilder builder = ShapeBuilder.newPolygon()
|