Search in sources :

Example 6 with GeometryCollection

use of org.opensearch.geometry.GeometryCollection in project OpenSearch by opensearch-project.

the class GeometryIO method readGeometryCollection.

private static GeometryCollection<Geometry> readGeometryCollection(StreamInput in) throws IOException {
    int size = in.readVInt();
    List<Geometry> shapes = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        shapes.add(readGeometry(in));
    }
    return new GeometryCollection<>(shapes);
}
Also used : Geometry(org.opensearch.geometry.Geometry) GeometryCollection(org.opensearch.geometry.GeometryCollection) ArrayList(java.util.ArrayList) Point(org.opensearch.geometry.Point) MultiPoint(org.opensearch.geometry.MultiPoint)

Example 7 with GeometryCollection

use of org.opensearch.geometry.GeometryCollection in project OpenSearch by opensearch-project.

the class GeometryTestUtils method randomGeometryCollection.

private static GeometryCollection<Geometry> randomGeometryCollection(int level, boolean hasAlt) {
    int size = OpenSearchTestCase.randomIntBetween(1, 10);
    List<Geometry> shapes = new ArrayList<>();
    for (int i = 0; i < size; i++) {
        shapes.add(randomGeometry(level, hasAlt));
    }
    return new GeometryCollection<>(shapes);
}
Also used : Geometry(org.opensearch.geometry.Geometry) GeometryCollection(org.opensearch.geometry.GeometryCollection) ArrayList(java.util.ArrayList) Point(org.opensearch.geometry.Point) MultiPoint(org.opensearch.geometry.MultiPoint)

Aggregations

GeometryCollection (org.opensearch.geometry.GeometryCollection)7 Geometry (org.opensearch.geometry.Geometry)6 MultiPoint (org.opensearch.geometry.MultiPoint)6 Point (org.opensearch.geometry.Point)6 ArrayList (java.util.ArrayList)4 Line (org.opensearch.geometry.Line)3 MultiLine (org.opensearch.geometry.MultiLine)3 OpenSearchParseException (org.opensearch.OpenSearchParseException)2 XContentBuilder (org.opensearch.common.xcontent.XContentBuilder)2 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 List (java.util.List)1 Coordinate (org.locationtech.jts.geom.Coordinate)1 LineString (org.locationtech.jts.geom.LineString)1 LinearRing (org.locationtech.jts.geom.LinearRing)1 MultiLineString (org.locationtech.jts.geom.MultiLineString)1 MultiPolygon (org.locationtech.jts.geom.MultiPolygon)1 Point (org.locationtech.jts.geom.Point)1 Polygon (org.locationtech.jts.geom.Polygon)1 Shape (org.locationtech.spatial4j.shape.Shape)1