case MULTIPOLYGON: Coordinate coordinate = ((JtsGeometry) shape).getGeom().getCoordinates()[position]; return new Geoshape.Point(coordinate.y, coordinate.x); case POINT: case CIRCLE: case BOX: if (position == 0) return new Geoshape.Point(shape.getBoundingBox().getMinY(), shape.getBoundingBox().getMinX()); else return new Geoshape.Point(shape.getBoundingBox().getMaxY(), shape.getBoundingBox().getMaxX()); case GEOMETRYCOLLECTION: return ((ShapeCollection<Shape>) shape).getShapes().stream()
/** * Returns the singleton point of this shape. Only applicable for point and circle shapes. * * @return */ public Point getPoint() { Preconditions.checkArgument(getType()==Type.POINT || getType()==Type.CIRCLE,"Shape does not have a single point"); return new Point(shape.getCenter().getY(), shape.getCenter().getX()); }