use of org.opensearch.common.geo.builders.CoordinatesBuilder in project OpenSearch by opensearch-project.
the class ShapeBuilderTests method testShapeWithBoundaryHoles.
public void testShapeWithBoundaryHoles() {
// test case 1: test the positive side of the dateline
PolygonBuilder builder = new PolygonBuilder(new CoordinatesBuilder().coordinate(-177, 10).coordinate(176, 15).coordinate(172, 0).coordinate(176, -15).coordinate(-177, -10).coordinate(-177, 10));
builder.hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(176, 10).coordinate(180, 5).coordinate(180, -5).coordinate(176, -10).coordinate(176, 10)));
assertMultiPolygon(builder.close().buildS4J(), true);
assertMultiPolygon(buildGeometry(builder.close()), false);
// test case 2: test the negative side of the dateline
builder = new PolygonBuilder(new CoordinatesBuilder().coordinate(-176, 15).coordinate(179, 10).coordinate(179, -10).coordinate(-176, -15).coordinate(-172, 0).close());
builder.hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(-176, 10).coordinate(-176, -10).coordinate(-180, -5).coordinate(-180, 5).coordinate(-176, 10).close()));
assertMultiPolygon(builder.close().buildS4J(), true);
assertMultiPolygon(buildGeometry(builder.close()), false);
}
use of org.opensearch.common.geo.builders.CoordinatesBuilder in project OpenSearch by opensearch-project.
the class ShapeBuilderTests method testShapeWithTangentialHole.
public void testShapeWithTangentialHole() {
// test a shape with one tangential (shared) vertex (should pass)
PolygonBuilder builder = new PolygonBuilder(new CoordinatesBuilder().coordinate(179, 10).coordinate(168, 15).coordinate(164, 0).coordinate(166, -15).coordinate(179, -10).coordinate(179, 10));
builder.hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(-177, 10).coordinate(-178, -10).coordinate(-180, -5).coordinate(-180, 5).coordinate(-177, 10)));
assertMultiPolygon(builder.close().buildS4J(), true);
assertMultiPolygon(buildGeometry(builder.close()), false);
}
use of org.opensearch.common.geo.builders.CoordinatesBuilder in project OpenSearch by opensearch-project.
the class ShapeBuilderTests method testShapeWithPointOnDateline.
public void testShapeWithPointOnDateline() {
PolygonBuilder builder = new PolygonBuilder(new CoordinatesBuilder().coordinate(180, 0).coordinate(176, 4).coordinate(176, -4).coordinate(180, 0));
assertPolygon(builder.close().buildS4J(), true);
assertPolygon(buildGeometry(builder.close()), false);
}
use of org.opensearch.common.geo.builders.CoordinatesBuilder in project OpenSearch by opensearch-project.
the class ShapeBuilderTests method testBoundaryShapeWithTangentialHole.
public void testBoundaryShapeWithTangentialHole() {
// test a shape with one tangential (shared) vertex for each hole (should pass)
PolygonBuilder builder = new PolygonBuilder(new CoordinatesBuilder().coordinate(-177, 10).coordinate(176, 15).coordinate(172, 0).coordinate(176, -15).coordinate(-177, -10).coordinate(-177, 10));
builder.hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(-177, 10).coordinate(-178, -10).coordinate(-180, -5).coordinate(-180, 5).coordinate(-177, 10)));
builder.hole(new LineStringBuilder(new CoordinatesBuilder().coordinate(172, 0).coordinate(176, 10).coordinate(176, -5).coordinate(172, 0)));
assertMultiPolygon(builder.close().buildS4J(), true);
assertMultiPolygon(buildGeometry(builder.close()), false);
}
use of org.opensearch.common.geo.builders.CoordinatesBuilder in project OpenSearch by opensearch-project.
the class ShapeBuilderTests method testShapeWithEdgeAlongDateline.
public void testShapeWithEdgeAlongDateline() {
// test case 1: test the positive side of the dateline
PolygonBuilder builder = new PolygonBuilder(new CoordinatesBuilder().coordinate(180, 0).coordinate(176, 4).coordinate(180, -4).coordinate(180, 0));
assertPolygon(builder.close().buildS4J(), true);
assertPolygon(buildGeometry(builder.close()), false);
// test case 2: test the negative side of the dateline
builder = new PolygonBuilder(new CoordinatesBuilder().coordinate(-176, 4).coordinate(-180, 0).coordinate(-180, -4).coordinate(-176, 4));
assertPolygon(builder.close().buildS4J(), true);
assertPolygon(buildGeometry(builder.close()), false);
}
Aggregations