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

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

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

Geometry.isSimple介绍

[英]Tests whether this Geometry is simple. The SFS definition of simplicity follows the general rule that a Geometry is simple if it has no points of self-tangency, self-intersection or other anomalous points.

Simplicity is defined for each Geometry subclass as follows:

  • Valid polygonal geometries are simple, since their rings must not self-intersect. isSimple tests for this condition and reports false if it is not met. (This is a looser test than checking for validity).
  • Linear rings have the same semantics.
  • Linear geometries are simple iff they do not self-intersect at points other than boundary points.
  • Zero-dimensional geometries (points) are simple iff they have no repeated points.
  • Empty Geometrys are always simple.
    [中]测试此几何图形是否简单。SFS简单性定义遵循的一般规则是,如果几何体没有自切点、自相交点或其他异常点,则几何体是简单的。
    每个几何体子类的简单性定义如下:
    *有效的多边形几何体很简单,因为它们的环不能自相交。isSimple测试此条件,如果不满足,则报告false。(这是一个比检查有效性更宽松的测试)。
    *线性环具有相同的语义。
    *线性几何体很简单,除非它们在边界点以外的点上不自相交。
    *零维几何(点)是简单的,如果它们没有重复的点。
    *空的Geometry总是很简单的。

代码示例

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

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

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

  1. public boolean isSimple() {
  2. return geometry.isSimple();
  3. }

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

  1. @DescribeProcess(
  2. title = "Simple Test",
  3. description =
  4. "Tests if a geometry is topologically simple. Points, polygons, closed line strings, and linear rings are always simple. Other geometries are considered simple if no two points are identical."
  5. )
  6. @DescribeResult(description = "True if the input is simple")
  7. public static boolean isSimple(
  8. @DescribeParameter(name = "geom", description = "Input geometry") Geometry geom) {
  9. return geom.isSimple();
  10. }

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

  1. /**
  2. * @param geometry Geometry instance
  3. * @return True if the provided geometry has no points of self-tangency, self-intersection or other anomalous points.
  4. */
  5. public static Boolean isSimple(Geometry geometry) {
  6. if(geometry==null) {
  7. return null;
  8. }
  9. return geometry.isSimple();
  10. }
  11. }

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

  1. public static boolean isSimple(Geometry g) { return g.isSimple(); }
  2. public static boolean isValid(Geometry g) { return g.isValid(); }

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

  1. /**
  2. * Returns true if this object does not cross itself.
  3. */
  4. @Override
  5. public final boolean isSimple() {
  6. org.locationtech.jts.geom.Geometry jtsGeom = getJTSGeometry();
  7. return jtsGeom.isSimple();
  8. }

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

  1. /**
  2. * Returns (TRUE) if this Geometry has no anomalous geometric points, such as self intersection
  3. * or self tangency.
  4. */
  5. public static boolean ST_IsSimple ( byte[] wkb ) {
  6. if ( wkb == null ) {
  7. return false;
  8. }
  9. Geometry g = gFromWKB(wkb);
  10. return g.isSimple();
  11. }

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

  1. /**
  2. * Returns (TRUE) if this Geometry has no anomalous geometric points, such as self intersection
  3. * or self tangency.
  4. */
  5. public static boolean ST_IsSimple ( byte[] wkb ) {
  6. if ( wkb == null ) {
  7. return false;
  8. }
  9. Geometry g = gFromWKB(wkb);
  10. return g.isSimple();
  11. }

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

  1. /**
  2. * @param geometry Geometry instance
  3. * @return True if the provided geometry is a ring; null otherwise
  4. */
  5. public static Boolean isRing(Geometry geometry) {
  6. if(geometry==null){
  7. return null;
  8. }
  9. if (geometry instanceof MultiLineString) {
  10. MultiLineString mString = ((MultiLineString) geometry);
  11. return mString.isClosed() && mString.isSimple();
  12. } else if (geometry instanceof LineString) {
  13. LineString line = (LineString) geometry;
  14. return line.isClosed() && geometry.isSimple();
  15. }
  16. return null;
  17. }
  18. }

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

  1. public void testMultiPolygonIsSimple2() throws Exception {
  2. Geometry g = reader.read("MULTIPOLYGON("
  3. + "((10 10, 10 20, 20 20, 20 15, 10 10)), "
  4. + "((60 60, 70 70, 80 60, 60 60)) )");
  5. assertTrue(g.isSimple());
  6. }

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

  1. public void testPointIsSimple() throws Exception {
  2. Geometry g = reader.read("POINT (10 10)");
  3. assertTrue(g.isSimple());
  4. }

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

  1. public void testPolygonIsSimple() throws Exception {
  2. Geometry g = reader.read("POLYGON((10 10, 10 20, 202 0, 20 15, 10 10))");
  3. assertTrue(g.isSimple());
  4. }

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

  1. public void testMultiPolygonIsSimple1() throws Exception {
  2. Geometry g = reader.read("MULTIPOLYGON (((10 10, 10 20, 20 20, 20 15, 10 10)), ((60 60, 70 70, 80 60, 60 60)))");
  3. assertTrue(g.isSimple());
  4. }

相关文章