use of org.locationtech.jts.geom.PrecisionModel in project arctic-sea by 52North.
the class MultiPointCoverage method getExtent.
/**
* Get the extent of all {@link Point}s
*
* @return The extent as {@link Polygon}
*/
public Polygon getExtent() {
if (isSetValue()) {
int srid = -1;
List<Coordinate> coordinates = Lists.newLinkedList();
for (PointValuePair pointValuePair : getValue()) {
Point point = pointValuePair.getPoint();
coordinates.add(point.getCoordinate());
if (point.getSRID() != srid) {
srid = point.getSRID();
}
}
GeometryFactory geometryFactory;
if (srid > 0) {
geometryFactory = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), srid);
} else {
geometryFactory = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING));
}
return geometryFactory.createPolygon(coordinates.toArray(new Coordinate[coordinates.size()]));
}
return null;
}
Aggregations