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

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

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

Geometry.relate介绍

[英]Returns the DE-9IM IntersectionMatrix for the two Geometrys.
[中]返回两个Geometry的DE-9IM相交矩阵。

代码示例

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

public static boolean relatePattern(Geometry arg0, Geometry arg1, String arg2) {
  if (arg0 == null || arg1 == null || arg2 == null) return false;
  Geometry _this = arg0;
  return _this.relate(arg1, arg2);
}

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

public IntersectionMatrix relate(Geometry g) {
  return geometry.relate(g);
}

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

public boolean relate(Geometry g, String intersectionPattern) {
  return geometry.relate(g, intersectionPattern);
}

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

public static String relate(Geometry arg0, Geometry arg1) {
  if (arg0 == null || arg1 == null) return null;
  Geometry _this = arg0;
  return _this.relate(arg1).toString();
}

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

@DescribeProcess(
  title = "Relate Matrix String",
  description =
      "Returns the DE-9IM intersection matrix string for the spatial relationship between the input geometries. The matrix string is in the form [II][IB][IE][BI][BB][BE][EI][EB][EE] where I=interior, B=boundary, and E=exterior. Matrix symbols are 2, 1, 0 or F."
)
@DescribeResult(description = "Intersection matrix string")
public static String relate(
    @DescribeParameter(name = "a", description = "First input geometry") Geometry a,
    @DescribeParameter(name = "b", description = "Second input geometry") Geometry b) {
  return a.relate(b).toString();
}

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

@DescribeProcess(
  title = "Relate Test",
  description =
      "Tests if the spatial relationship between two geometries matches the given DE-9IM intersection matrix pattern. The pattern is given in the form [II][IB][IE][BI][BB][BE][EI][EB][EE] where I=interior, B=boundary, and E=exterior. Pattern symbols can be 2, 1, 0, F or *."
)
@DescribeResult(description = "True if the inputs have the given relationship")
public static boolean relatePattern(
    @DescribeParameter(name = "a", description = "First input geometry") Geometry a,
    @DescribeParameter(name = "b", description = "First input geometry") Geometry b,
    @DescribeParameter(name = "Relate pattern", description = "Intersection matrix pattern")
        String pattern) {
  return a.relate(b, pattern);
}

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

protected SpatialRelation relate(Geometry oGeom) {
 //see http://docs.geotools.org/latest/userguide/library/jts/dim9.html#preparedgeometry
 if (oGeom instanceof org.locationtech.jts.geom.Point) {
  if (preparedGeometry != null)
   return preparedGeometry.disjoint(oGeom) ? SpatialRelation.DISJOINT : SpatialRelation.CONTAINS;
  return geom.disjoint(oGeom) ? SpatialRelation.DISJOINT : SpatialRelation.CONTAINS;
 }
 if (preparedGeometry == null)
  return intersectionMatrixToSpatialRelation(geom.relate(oGeom));
 else if (preparedGeometry.covers(oGeom))
  return SpatialRelation.CONTAINS;
 else if (preparedGeometry.coveredBy(oGeom))
  return SpatialRelation.WITHIN;
 else if (preparedGeometry.intersects(oGeom))
  return SpatialRelation.INTERSECTS;
 return SpatialRelation.DISJOINT;
}

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

IntersectionMatrix relate(Geometry a, Geometry b) {
 return a.relate(b);
}

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

if (g1.relate(g2, "1********") != expected) {

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

/**
 * @param a Geometry Geometry.
 * @param b Geometry instance
 * @return 9-character String representation of the 2 geometries IntersectionMatrix
 */
public static String relate(Geometry a,Geometry b) {
  if(a==null || b==null) {
    return null;
  }
  return a.relate(b).toString();
}

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

public static String relate(Geometry a, Geometry b) {
 return a.relate(b).toString();
}
public static boolean intersects(Geometry a, Geometry b) {    return a.intersects(b);    }

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

(new FailureChecker() { void operation() {
 b.relate(a);
}  }).check(IllegalArgumentException.class);

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

void runRelate() {
  Geometry[] geom = getGeometries();
  if (geom[0] == null || geom[1] == null) {
   return;
  }
  testable.setIntersectionMatrix(geom[0].relate(geom[1]));
 }
}

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

public static boolean ST_Relate(byte[] wkb1, byte[] wkb2, String intersectionPattern) {
  Geometry geometry1 = gFromWKB(wkb1);
  Geometry geometry2 = gFromWKB(wkb1);
  if (geometry1 != null && geometry2 != null) {
    return geometry1.relate(geometry2, intersectionPattern);
  }
  return false;
}

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

public static boolean ST_Relate(byte[] wkb1, byte[] wkb2, String intersectionPattern) {
  Geometry geometry1 = gFromWKB(wkb1);
  Geometry geometry2 = gFromWKB(wkb1);
  if (geometry1 != null && geometry2 != null) {
    return geometry1.relate(geometry2, intersectionPattern);
  }
  return false;
}

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

SimpleFeature f2 = fr2.next();
Geometry g2 = (Geometry) f2.getDefaultGeometry();
if (g1.relate(g2, de9im) != expected) {
  results.error(
      f1,

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

/**
 * Default implementation.
 */
public boolean containsProperly(Geometry g)
{
  // since raw relate is used, provide some optimizations
  
 // short-circuit test
 if (! baseGeom.getEnvelopeInternal().contains(g.getEnvelopeInternal()))
  return false;
  
 // otherwise, compute using relate mask
 return baseGeom.relate(g, "T**FF*FF*");
}

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

public static String ST_Relate(byte[] wkb1, byte[] wkb2) {
  Geometry geometry1 = gFromWKB(wkb1);
  Geometry geometry2 = gFromWKB(wkb1);
  if (geometry1 != null && geometry2 != null) {
    IntersectionMatrix result = geometry1.relate(geometry2);
    return result.toString();
  }
  return null;
}

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

public static String ST_Relate(byte[] wkb1, byte[] wkb2) {
  Geometry geometry1 = gFromWKB(wkb1);
  Geometry geometry2 = gFromWKB(wkb1);
  if (geometry1 != null && geometry2 != null) {
    IntersectionMatrix result = geometry1.relate(geometry2);
    return result.toString();
  }
  return null;
}

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

public void doPredicates(Geometry a, Geometry b) throws Exception
{
 assertTrue( a.contains(b) == a.relate(b).isContains() );
 assertTrue( a.crosses(b) == a.relate(b).isCrosses(a.getDimension(), b.getDimension()) );
 assertTrue( a.disjoint(b) == a.relate(b).isDisjoint() );
 assertTrue( a.equals(b) == a.relate(b).isEquals(a.getDimension(), b.getDimension()) );
 assertTrue( a.intersects(b) == a.relate(b).isIntersects() );
 assertTrue( a.overlaps(b) == a.relate(b).isOverlaps(a.getDimension(), b.getDimension()) );
 assertTrue( a.touches(b) == a.relate(b).isTouches(a.getDimension(), b.getDimension()) );
 assertTrue( a.within(b) == a.relate(b).isWithin() );
}

相关文章