use of org.elasticsearch.common.geo.builders.CoordinatesBuilder in project elasticsearch by elastic.
the class ShapeBuilderTests method testMultiLineString.
public void testMultiLineString() {
ShapeBuilders.newMultiLinestring().linestring(new LineStringBuilder(new CoordinatesBuilder().coordinate(-100.0, 50.0).coordinate(50.0, 50.0).coordinate(50.0, 20.0).coordinate(-100.0, 20.0))).linestring(new LineStringBuilder(new CoordinatesBuilder().coordinate(-100.0, 20.0).coordinate(50.0, 20.0).coordinate(50.0, 0.0).coordinate(-100.0, 0.0))).build();
// LineString that needs to be wrapped
ShapeBuilders.newMultiLinestring().linestring(new LineStringBuilder(new CoordinatesBuilder().coordinate(150.0, 60.0).coordinate(200.0, 60.0).coordinate(200.0, 40.0).coordinate(150.0, 40.0))).linestring(new LineStringBuilder(new CoordinatesBuilder().coordinate(150.0, 20.0).coordinate(200.0, 20.0).coordinate(200.0, 0.0).coordinate(150.0, 0.0))).build();
}
use of org.elasticsearch.common.geo.builders.CoordinatesBuilder in project elasticsearch by elastic.
the class ShapeBuilderTests method testBoundaryShapeWithTangentialHole.
public void testBoundaryShapeWithTangentialHole() {
// test a shape with one tangential (shared) vertex for each hole (should pass)
PolygonBuilder builder = ShapeBuilders.newPolygon(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)));
Shape shape = builder.close().build();
assertMultiPolygon(shape);
}
use of org.elasticsearch.common.geo.builders.CoordinatesBuilder in project elasticsearch by elastic.
the class ShapeBuilderTests method testShapeWithEdgeAlongDateline.
public void testShapeWithEdgeAlongDateline() {
// test case 1: test the positive side of the dateline
PolygonBuilder builder = ShapeBuilders.newPolygon(new CoordinatesBuilder().coordinate(180, 0).coordinate(176, 4).coordinate(180, -4).coordinate(180, 0));
Shape shape = builder.close().build();
assertPolygon(shape);
// test case 2: test the negative side of the dateline
builder = ShapeBuilders.newPolygon(new CoordinatesBuilder().coordinate(-176, 4).coordinate(-180, 0).coordinate(-180, -4).coordinate(-176, 4));
shape = builder.close().build();
assertPolygon(shape);
}
use of org.elasticsearch.common.geo.builders.CoordinatesBuilder in project elasticsearch by elastic.
the class ShapeBuilderTests method testBoundaryShape.
/**
* Test an enveloping polygon around the max mercator bounds
*/
public void testBoundaryShape() {
PolygonBuilder builder = ShapeBuilders.newPolygon(new CoordinatesBuilder().coordinate(-180, 90).coordinate(180, 90).coordinate(180, -90).coordinate(-180, 90));
Shape shape = builder.close().build();
assertPolygon(shape);
}
use of org.elasticsearch.common.geo.builders.CoordinatesBuilder in project elasticsearch by elastic.
the class ShapeBuilderTests method testPolygonWrapping.
public void testPolygonWrapping() {
Shape shape = ShapeBuilders.newPolygon(new CoordinatesBuilder().coordinate(-150.0, 65.0).coordinate(-250.0, 65.0).coordinate(-250.0, -65.0).coordinate(-150.0, -65.0).close()).build();
assertMultiPolygon(shape);
}
Aggregations