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

x33g5p2x  于2022-01-26 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(188)

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

Polygon.contains介绍

暂无

代码示例

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

if (shell.contains(hole)) {
  ((List<LinearRing>) shell.getUserData()).add(hole);
  break outer;

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

public boolean contains(Geometry g) {
  return polygon.contains(g);
}

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

/** As if the ring is the outer ring of a polygon */
SpatialRelation relateEnclosedRing(LinearRing ring) {
 SpatialRelation rel = relateLineString(ring);
 if (rel == SpatialRelation.DISJOINT
     && ctx.getGeometryFactory().createPolygon(ring, null).contains(ctrGeom)) {
  // If it contains the circle center point, then the result is CONTAINS
  rel = SpatialRelation.CONTAINS;
 }
 return rel;
}

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

|| (line23.ptSegDist(point2D) <= TOLERANCE)) {
  ret = ON_EDGE;
} else if (poly.contains(nPoint)) {
  ret = INSIDE;
} else {

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

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

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

public void testSampleForCentralPoint() throws Exception {
  // create a "C" shape polygon that won't contain it's centroid
  Polygon g =
      (Polygon)
          new WKTReader()
              .read(
                  "POLYGON ((-112.534433451864 43.8706532611928,-112.499157652296 44.7878240499628,-99.6587666095152 44.7878240499628,-99.7242788087131 43.2155312692142,-111.085391877449 43.099601544023,-110.744593363875 36.1862602686501,-98.6760836215473 35.9436771582516,-98.7415958207452 33.5197257879307,-111.77852346112 33.9783111823157,-111.758573671673 34.6566040234952,-113.088767445077 34.7644575726901,-113.023255245879 43.8706532611928,-112.534433451864 43.8706532611928))");
  Point p = g.getCentroid();
  assertFalse(g.contains(p));
  // test with few samples, we shouldn't hit the inside
  assertNull(RendererUtilities.sampleForInternalPoint(g, p, null, null, -1, 2));
  // up the  samples, we should hit the inside now
  assertNotNull(RendererUtilities.sampleForInternalPoint(g, p, null, null, -1, 10));
}

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

/**
 * Splits a Polygon using a LineString.
 *
 * @param polygon
 * @param lineString
 * @return
 */
private static Collection<Polygon> polygonWithLineSplitter(Polygon polygon, LineString lineString) throws SQLException {
  Collection<Polygon> polygons = splitPolygonizer(polygon, lineString);
  if (polygons != null && polygons.size() > 1) {
    List<Polygon> pols = new ArrayList<Polygon>();
    for (Polygon pol : polygons) {
      if (polygon.contains(pol.getInteriorPoint())) {
        pols.add(pol);
      }
    }
    return pols;
  }
  return null;
}

代码示例来源:origin: com.graphhopper/graphhopper-isochrone

if (shell.contains(hole)) {
  ((List<LinearRing>) shell.getUserData()).add(hole);
  break outer;

代码示例来源:origin: org.jaitools/jt-vectorize

if (!poly.contains(insidePt)) {
  throw new RuntimeException("Can't locate interior point for polygon");

代码示例来源:origin: org.geotools/gt-graph

|| (line23.ptSegDist(point2D) <= TOLERANCE)) {
  ret = ON_EDGE;
} else if (poly.contains(nPoint)) {
  ret = INSIDE;
} else {

相关文章