/** * Returns a {@link Geometry} that represents the concave hull of the input * geometry according to the threshold. * The returned geometry contains the minimal number of points needed to * represent the concave hull. * * @return if the concave hull contains 3 or more points, a {@link Polygon}; * 2 points, a {@link LineString}; * 1 point, a {@link Point}; * 0 points, an empty {@link GeometryCollection}. */ public Geometry getConcaveHull() { if (this.geometries.getNumGeometries() == 0) { return this.geomFactory.createGeometryCollection(null); } if (this.geometries.getNumGeometries() == 1) { return this.geometries.getGeometryN(0); } if (this.geometries.getNumGeometries() == 2) { return this.geomFactory.createLineString(this.geometries.getCoordinates()); } return concaveHull(); }
LOG.warn("No triangulation for " + this.filteredPoints.getNumPoints() + " points!!"); LOG.warn(" --> Unique id for the group of points: " + facilityIdentifier); Coordinate[] ca = this.filteredPoints.getCoordinates(); if(ca.length == 3){ LOG.warn(" --> Instead, a polygon (triangle) of the three points will be returned."); double xSum = 0; double ySum = 0; for(Coordinate c :this.filteredPoints.getCoordinates()){ xSum += c.x; ySum += c.y; double newX = xSum / ((double)this.filteredPoints.getCoordinates().length); double newY = ySum / ((double)this.filteredPoints.getCoordinates().length); LOG.warn(" --> Unique id for the group of points: " + facilityIdentifier); LOG.warn(" --> Unique points (" + this.filteredPoints.getNumGeometries() + "):"); Coordinate[] ca = this.filteredPoints.getCoordinates(); for(Coordinate c : ca){ LOG.warn(" (" + c.x + ";" + c.y + ")"); return geomFactory.createMultiPoint(this.filteredPoints.getCoordinates()).convexHull();
return this.geomFactory.createLineString(this.filteredPoints.getCoordinates());