org.locationtech.jts.geom.Geometry.convexHull()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中org.locationtech.jts.geom.Geometry.convexHull()方法的一些代码示例,展示了Geometry.convexHull()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.convexHull()方法的具体详情如下:
包路径:org.locationtech.jts.geom.Geometry
类名称:Geometry
方法名:convexHull

Geometry.convexHull介绍

[英]Computes the smallest convex Polygon that contains all the points in the Geometry. This obviously applies only to Geometry s which contain 3 or more points; the results for degenerate cases are specified as follows: Number of Points in argument Geometry``Geometry class of result 0 empty GeometryCollection1 Point2 LineString3 or more Polygon
[中]

代码示例

代码示例来源:origin: geotools/geotools

public static Geometry convexHull(Geometry arg0) {
  if (arg0 == null) return null;
  Geometry _this = arg0;
  return _this.convexHull();
}

代码示例来源:origin: geotools/geotools

public Geometry convexHull() {
  return geometry.convexHull();
}

代码示例来源:origin: geotools/geotools

@DescribeProcess(
  title = "Convex Hull",
  description = "Returns the smallest convex polygon that contains the entire input geometry."
)
@DescribeResult(description = "Convex hull of input geometry")
public static Geometry convexHull(
    @DescribeParameter(name = "geom", description = "Input geometry") Geometry geom) {
  return geom.convexHull();
}

代码示例来源:origin: orbisgis/h2gis

/**
   * @param geometry
   * @return smallest convex Polygon that contains all the points in the Geometry
   */
  public static Geometry convexHull(Geometry geometry) {
    if(geometry==null) {
      return null;
    }
    return geometry.convexHull();
  }
}

代码示例来源:origin: locationtech/jts

public static Geometry convexHull(Geometry g) {      return g.convexHull();  }
public static Geometry centroid(Geometry g) {      return g.getCentroid();  }

代码示例来源:origin: locationtech/spatial4j

jtsGeom = makeShape(geom.convexHull());
} else if (getValidationRule() == ValidationRule.repairBuffer0) {
 jtsGeom = makeShape(geom.buffer(0));

代码示例来源:origin: jdeolive/geodb

public static byte[] ST_ConvexHull(byte[] wkb) {
  Geometry geometry = gFromWKB(wkb);
  if (geometry != null) {
    Geometry boundary = geometry.convexHull();
    if (boundary != null) {
      return gToWKB(boundary);
    }
  }
  return null;
}

代码示例来源:origin: org.opengeo/geodb

public static byte[] ST_ConvexHull(byte[] wkb) {
  Geometry geometry = gFromWKB(wkb);
  if (geometry != null) {
    Geometry boundary = geometry.convexHull();
    if (boundary != null) {
      return gToWKB(boundary);
    }
  }
  return null;
}

代码示例来源:origin: org.eclipse.rdf4j/rdf4j-queryalgebra-geosparql

public Shape convexHull(Shape s) {
  return shapeFactory.makeShapeFromGeometry(shapeFactory.getGeometryFrom(s).convexHull());
}

代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-queryalgebra-geosparql

public Shape convexHull(Shape s) {
  return shapeFactory.makeShapeFromGeometry(shapeFactory.getGeometryFrom(s).convexHull());
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * Returns the geometric convex hull of this geometry.
 */
@Override
public final Geometry getConvexHull() {
  final org.locationtech.jts.geom.Geometry jtsGeom = getJTSGeometry();
  final org.locationtech.jts.geom.Geometry jtsHull = jtsGeom.convexHull();
  return JTSUtils.toISO(jtsHull, getCoordinateReferenceSystem());
}

代码示例来源:origin: orbisgis/h2gis

/**
 * Compute the max distance
 */
private void computeMaxDistance() {
  HashSet<Coordinate> coordinatesA = new HashSet<Coordinate>(Arrays.asList(geomA.convexHull().getCoordinates()));
  Geometry fullHull = geomA.getFactory().createGeometryCollection(new Geometry[]{geomA, geomB}).convexHull();
  maxDistanceFilter = new MaxDistanceFilter(coordinatesA);
  fullHull.apply(maxDistanceFilter);
}

代码示例来源:origin: locationtech/jts

public void test4() throws Exception {
 WKTReader reader = new WKTReader(new GeometryFactory(new PrecisionModel(1), 0));
 Geometry geometry = reader.read("MULTIPOINT (0 0, 10 0, 10 0)");
 LineString convexHull = (LineString) reader.read("LINESTRING (0 0, 10 0)");
 assertTrue(convexHull.equalsExact(geometry.convexHull()));
}

代码示例来源:origin: locationtech/jts

public void test2() throws Exception {
 WKTReader reader = new WKTReader(new GeometryFactory(new PrecisionModel(1), 0));
 Geometry geometry = reader.read("MULTIPOINT (130 240, 130 240, 130 240, 570 240, 570 240, 570 240, 650 240)");
 LineString convexHull = (LineString) reader.read("LINESTRING (130 240, 650 240)");
 assertTrue(convexHull.equalsExact(geometry.convexHull()));
}

代码示例来源:origin: locationtech/jts

public void test5() throws Exception {
 WKTReader reader = new WKTReader(new GeometryFactory(new PrecisionModel(1), 0));
 Geometry geometry = reader.read("MULTIPOINT (0 0, 5 0, 10 0)");
 LineString convexHull = (LineString) reader.read("LINESTRING (0 0, 10 0)");
 assertTrue(convexHull.equalsExact(geometry.convexHull()));
}

代码示例来源:origin: locationtech/jts

public void test3() throws Exception {
 WKTReader reader = new WKTReader(new GeometryFactory(new PrecisionModel(1), 0));
 Geometry geometry = reader.read("MULTIPOINT (0 0, 0 0, 10 0)");
 LineString convexHull = (LineString) reader.read("LINESTRING (0 0, 10 0)");
 assertTrue(convexHull.equalsExact(geometry.convexHull()));
}

代码示例来源:origin: locationtech/jts

public void test7() throws Exception {
 WKTReader reader = new WKTReader(new GeometryFactory(new PrecisionModel(1), 0));
 Geometry geometry = reader.read("MULTIPOINT (0 0, 0 0, 5 0, 5 0, 10 0, 10 0)");
 LineString convexHull = (LineString) reader.read("LINESTRING (0 0, 10 0)");
 assertTrue(convexHull.equalsExact(geometry.convexHull()));
}

代码示例来源:origin: locationtech/jts

public void test6() throws Exception {
 WKTReader reader = new WKTReader(new GeometryFactory(new PrecisionModel(1), 0));
 Geometry actualGeometry = reader.read("MULTIPOINT (0 0, 5 1, 10 0)").convexHull();
 Geometry expectedGeometry = reader.read("POLYGON ((0 0, 5 1, 10 0, 0 0))");
 assertEquals(expectedGeometry.toString(), actualGeometry.toString());
}

代码示例来源:origin: locationtech/jts

Geometry convexHull = input.convexHull();

代码示例来源:origin: locationtech/jts

Geometry result = geom[0].convexHull();
assertEqualsExact(expectedConvexHull, result, " expected convex hull "
   + expectedConvexHull.toText() + " , found " + result.toText());

相关文章