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

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

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

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

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

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

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

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

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

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

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

  1. @DescribeProcess(
  2. title = "Relate Matrix String",
  3. description =
  4. "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."
  5. )
  6. @DescribeResult(description = "Intersection matrix string")
  7. public static String relate(
  8. @DescribeParameter(name = "a", description = "First input geometry") Geometry a,
  9. @DescribeParameter(name = "b", description = "Second input geometry") Geometry b) {
  10. return a.relate(b).toString();
  11. }

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

  1. @DescribeProcess(
  2. title = "Relate Test",
  3. description =
  4. "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 *."
  5. )
  6. @DescribeResult(description = "True if the inputs have the given relationship")
  7. public static boolean relatePattern(
  8. @DescribeParameter(name = "a", description = "First input geometry") Geometry a,
  9. @DescribeParameter(name = "b", description = "First input geometry") Geometry b,
  10. @DescribeParameter(name = "Relate pattern", description = "Intersection matrix pattern")
  11. String pattern) {
  12. return a.relate(b, pattern);
  13. }

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

  1. protected SpatialRelation relate(Geometry oGeom) {
  2. //see http://docs.geotools.org/latest/userguide/library/jts/dim9.html#preparedgeometry
  3. if (oGeom instanceof org.locationtech.jts.geom.Point) {
  4. if (preparedGeometry != null)
  5. return preparedGeometry.disjoint(oGeom) ? SpatialRelation.DISJOINT : SpatialRelation.CONTAINS;
  6. return geom.disjoint(oGeom) ? SpatialRelation.DISJOINT : SpatialRelation.CONTAINS;
  7. }
  8. if (preparedGeometry == null)
  9. return intersectionMatrixToSpatialRelation(geom.relate(oGeom));
  10. else if (preparedGeometry.covers(oGeom))
  11. return SpatialRelation.CONTAINS;
  12. else if (preparedGeometry.coveredBy(oGeom))
  13. return SpatialRelation.WITHIN;
  14. else if (preparedGeometry.intersects(oGeom))
  15. return SpatialRelation.INTERSECTS;
  16. return SpatialRelation.DISJOINT;
  17. }

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

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

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

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

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

  1. /**
  2. * @param a Geometry Geometry.
  3. * @param b Geometry instance
  4. * @return 9-character String representation of the 2 geometries IntersectionMatrix
  5. */
  6. public static String relate(Geometry a,Geometry b) {
  7. if(a==null || b==null) {
  8. return null;
  9. }
  10. return a.relate(b).toString();
  11. }

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

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

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

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

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

  1. void runRelate() {
  2. Geometry[] geom = getGeometries();
  3. if (geom[0] == null || geom[1] == null) {
  4. return;
  5. }
  6. testable.setIntersectionMatrix(geom[0].relate(geom[1]));
  7. }
  8. }

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

  1. public static boolean ST_Relate(byte[] wkb1, byte[] wkb2, String intersectionPattern) {
  2. Geometry geometry1 = gFromWKB(wkb1);
  3. Geometry geometry2 = gFromWKB(wkb1);
  4. if (geometry1 != null && geometry2 != null) {
  5. return geometry1.relate(geometry2, intersectionPattern);
  6. }
  7. return false;
  8. }

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

  1. public static boolean ST_Relate(byte[] wkb1, byte[] wkb2, String intersectionPattern) {
  2. Geometry geometry1 = gFromWKB(wkb1);
  3. Geometry geometry2 = gFromWKB(wkb1);
  4. if (geometry1 != null && geometry2 != null) {
  5. return geometry1.relate(geometry2, intersectionPattern);
  6. }
  7. return false;
  8. }

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

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

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

  1. /**
  2. * Default implementation.
  3. */
  4. public boolean containsProperly(Geometry g)
  5. {
  6. // since raw relate is used, provide some optimizations
  7. // short-circuit test
  8. if (! baseGeom.getEnvelopeInternal().contains(g.getEnvelopeInternal()))
  9. return false;
  10. // otherwise, compute using relate mask
  11. return baseGeom.relate(g, "T**FF*FF*");
  12. }

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

  1. public static String ST_Relate(byte[] wkb1, byte[] wkb2) {
  2. Geometry geometry1 = gFromWKB(wkb1);
  3. Geometry geometry2 = gFromWKB(wkb1);
  4. if (geometry1 != null && geometry2 != null) {
  5. IntersectionMatrix result = geometry1.relate(geometry2);
  6. return result.toString();
  7. }
  8. return null;
  9. }

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

  1. public static String ST_Relate(byte[] wkb1, byte[] wkb2) {
  2. Geometry geometry1 = gFromWKB(wkb1);
  3. Geometry geometry2 = gFromWKB(wkb1);
  4. if (geometry1 != null && geometry2 != null) {
  5. IntersectionMatrix result = geometry1.relate(geometry2);
  6. return result.toString();
  7. }
  8. return null;
  9. }

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

  1. public void doPredicates(Geometry a, Geometry b) throws Exception
  2. {
  3. assertTrue( a.contains(b) == a.relate(b).isContains() );
  4. assertTrue( a.crosses(b) == a.relate(b).isCrosses(a.getDimension(), b.getDimension()) );
  5. assertTrue( a.disjoint(b) == a.relate(b).isDisjoint() );
  6. assertTrue( a.equals(b) == a.relate(b).isEquals(a.getDimension(), b.getDimension()) );
  7. assertTrue( a.intersects(b) == a.relate(b).isIntersects() );
  8. assertTrue( a.overlaps(b) == a.relate(b).isOverlaps(a.getDimension(), b.getDimension()) );
  9. assertTrue( a.touches(b) == a.relate(b).isTouches(a.getDimension(), b.getDimension()) );
  10. assertTrue( a.within(b) == a.relate(b).isWithin() );
  11. }

相关文章