Java Code Examples for com.vividsolutions.jts.geom.Geometry#convexHull()

The following examples show how to use com.vividsolutions.jts.geom.Geometry#convexHull() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NominatimGeocoder.java    From DataHubSystem with GNU Affero General Public License v3.0 6 votes vote down vote up
private static Geometry convexHullOneLevel(final Geometry geometry)
{
   if (geometry.getNumGeometries() > 1)
   {
      Geometry [] convex_hulls = new Geometry [geometry.getNumGeometries()];
      for (int igeom=0; igeom<geometry.getNumGeometries(); igeom++)
      {
         convex_hulls[igeom] = geometry.getGeometryN(igeom).convexHull();
      }
      return
         geometry.getFactory().createGeometryCollection(convex_hulls);
   }
   else
   {
      return geometry.convexHull();
   }
}
 
Example 2
Source File: ConstructionFunctions.java    From jts with GNU Lesser General Public License v2.1 votes vote down vote up
public static Geometry convexHull(Geometry g) {      return g.convexHull();  }