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

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

本文整理了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

  1. public static Geometry convexHull(Geometry arg0) {
  2. if (arg0 == null) return null;
  3. Geometry _this = arg0;
  4. return _this.convexHull();
  5. }

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

  1. public Geometry convexHull() {
  2. return geometry.convexHull();
  3. }

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

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

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

  1. /**
  2. * @param geometry
  3. * @return smallest convex Polygon that contains all the points in the Geometry
  4. */
  5. public static Geometry convexHull(Geometry geometry) {
  6. if(geometry==null) {
  7. return null;
  8. }
  9. return geometry.convexHull();
  10. }
  11. }

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

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

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

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

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

  1. public static byte[] ST_ConvexHull(byte[] wkb) {
  2. Geometry geometry = gFromWKB(wkb);
  3. if (geometry != null) {
  4. Geometry boundary = geometry.convexHull();
  5. if (boundary != null) {
  6. return gToWKB(boundary);
  7. }
  8. }
  9. return null;
  10. }

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

  1. public static byte[] ST_ConvexHull(byte[] wkb) {
  2. Geometry geometry = gFromWKB(wkb);
  3. if (geometry != null) {
  4. Geometry boundary = geometry.convexHull();
  5. if (boundary != null) {
  6. return gToWKB(boundary);
  7. }
  8. }
  9. return null;
  10. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. Geometry convexHull = input.convexHull();

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

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

相关文章