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

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

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

Geometry.within介绍

[英]Tests whether this geometry is within the specified geometry.

The within predicate has the following equivalent definitions:

  • Every point of this geometry is a point of the other geometry, and the interiors of the two geometries have at least one point in common.
  • The DE-9IM Intersection Matrix for the two geometries matches [T*F**F***]
  • g.contains(this) = true
    (within is the converse of #contains)
    An implication of the definition is that "The boundary of a Geometry is not within the Geometry". In other words, if a geometry A is a subset of the points in the boundary of a geometry B, A.within(B) = false (As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.) For a predicate with similar behaviour but avoiding this subtle limitation, see #coveredBy.
    [中]测试此几何图形是否在指定的几何图形内。
    within谓词具有以下等效定义:
    *此几何图形的每个点都是其他几何图形的一个点,两个几何图形的内部至少有一个公共点。
    *两种几何图形的DE-9IM相交矩阵匹配[T*F**F***]
  • g.contains(this) = true
    within是#contains的反义词)
    该定义的含义是“几何体的边界不在几何体内”。换句话说,如果几何体a是几何体B边界上点的子集,A.within(B) = false(作为一个具体示例,将a作为位于多边形B边界上的线字符串)对于具有类似行为但避免这种微妙限制的谓词,请参见#coveredBy。

代码示例

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

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

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

public boolean within(Geometry g) {
    return geometry.within(g);
  }
}

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

@Override
  protected boolean basicEvaluate(Geometry left, Geometry right) {

    Envelope envLeft = left.getEnvelopeInternal();
    Envelope envRight = right.getEnvelopeInternal();

    if (envRight.contains(envLeft)) return left.within(right);
    else return false;
  }
}

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

@DescribeProcess(
  title = "Within Test",
  description = "Tests if the first geometry is contained in the second geometry."
)
@DescribeResult(description = "True if the first input is within the second input")
public static boolean within(
    @DescribeParameter(name = "a", description = "First input geometry") Geometry a,
    @DescribeParameter(name = "b", description = "Second input geometry") Geometry b) {
  return a.within(b);
}

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

/**
 * Default implementation.
 */
public boolean within(Geometry g)
{
 return baseGeom.within(g);
}

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

public boolean isTrue(Geometry g) {
  return g.within(mask);
 }
});

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

@Override
 public boolean apply(Geometry geom1, Geometry geom2) {
  return geom1.within(geom2);
 }
}

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

public static boolean within(Geometry a, Geometry b) {    return a.within(b);    }
public static boolean overlaps(Geometry a, Geometry b) {    return a.overlaps(b);    }

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

/**
   * @param a Surface Geometry.
   * @param b Geometry instance
   * @return true if the geometry A is within the geometry B
   */
  public static Boolean isWithin(Geometry a,Geometry b) {
    if(a==null || b==null) {
      return null;
    }
    return a.within(b);
  }
}

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

Geometry gt2 = (Geometry) tmp2.getDefaultGeometry();
if (gt2.within(gt)) {
  return true;

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

Geometry gt2 = (Geometry) tmp2.getDefaultGeometry();
if (gt2.within(gt)) {
  return false;

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

if (!pt.getBoundary().within(ls)) {
  r = true;

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

if (g1.within(g2) != expected) {
  results.error(
      f1,

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

/**
 * Returns true if the geometry A is completely inside geometry B
 */
public static boolean ST_Within( byte[] wkb1, byte[] wkb2) {
  if ( wkb1 == null || wkb2 == null ) {
    return false;
  }
  
  Geometry g1 = gFromWKB(wkb1);
  Geometry g2 = gFromWKB(wkb2);
  
  return g1.within( g2 );
}
/*

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

/**
 * Returns true if the geometry A is completely inside geometry B
 */
public static boolean ST_Within( byte[] wkb1, byte[] wkb2) {
  if ( wkb1 == null || wkb2 == null ) {
    return false;
  }
  
  Geometry g1 = gFromWKB(wkb1);
  Geometry g2 = gFromWKB(wkb2);
  
  return g1.within( g2 );
}
/*

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

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

代码示例来源:origin: com.orientechnologies/orientdb-lucene

@Override
public boolean within(Shape shape, Shape shape1) {
 if(shape instanceof ShapeCollection || shape1 instanceof ShapeCollection){
  return shape.relate(shape1).equals(SpatialRelation.WITHIN);
 }
 Geometry geometry = factory.toGeometry(shape);
 Geometry geometry1 = factory.toGeometry(shape1);
 return geometry.within(geometry1);
}

代码示例来源: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() );
}

相关文章