com.vividsolutions.jts.geom.Polygon.intersection()方法的使用及代码示例

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

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

Polygon.intersection介绍

暂无

代码示例

代码示例来源:origin: opentripplanner/OpenTripPlanner

private void createNamedAreas(AreaEdgeList edgeList, Ring ring, Collection<Area> areas) {
  Polygon containingArea = ring.toJtsPolygon();
  for (Area area : areas) {
    Geometry intersection = containingArea.intersection(area.toJTSMultiPolygon());
    if (intersection.getArea() == 0) {
      continue;
    }
    NamedArea namedArea = new NamedArea();
    OSMWithTags areaEntity = area.parent;
    int cls = StreetEdge.CLASS_OTHERPATH;
    cls |= OSMFilter.getStreetClasses(areaEntity);
    namedArea.setStreetClass(cls);
    String id = "way (area) " + areaEntity.getId() + " (splitter linking)";
    I18NString name = handler.getNameForWay(areaEntity, id);
    namedArea.setName(name);
    WayProperties wayData = wayPropertySet.getDataForWay(areaEntity);
    Double safety = wayData.getSafetyFeatures().first;
    namedArea.setBicycleSafetyMultiplier(safety);
    namedArea.setOriginalEdges(intersection);
    StreetTraversalPermission permission = OSMFilter.getPermissionsForEntity(areaEntity,
        StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE);
    namedArea.setPermission(permission);
    edgeList.addArea(namedArea);
  }
}

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

public Geometry intersection(Geometry other) {
  return polygon.intersection(other);
}

代码示例来源:origin: aseldawy/pigeon

corners[1][0], corners[1][1], corners[0][1], corners[0][0] }),
    null);
parts[0] = q0.intersection(geom);
Polygon q1 = geomFactory
  .createPolygon(
      corners[1][1], corners[1][2], corners[0][2], corners[0][1]}),
      null);
parts[1] = q1.intersection(geom);
Polygon q2 = geomFactory
  .createPolygon(
      corners[2][0], corners[2][1], corners[1][1], corners[1][0] }),
      null);
parts[2] = q2.intersection(geom);
Polygon q3 = geomFactory
  .createPolygon(
      corners[2][1], corners[2][2], corners[1][2], corners[1][1] }),
      null);
parts[3] = q3.intersection(geom);

代码示例来源:origin: stackoverflow.com

import com.vividsolutions.jts.util.*

GeometricShapeFactory gsf = new GeometricShapeFactory();
gsf.setSize(100);
gsf.setNumPoints(100);
gsf.setBase(new Coordinate(100, 100));
//configure the circle as appropriate
Polygon circleA = gsf.createCircle();

//configure again and create a separate circle
Polygon circleB = gsf.createCircle();

//configure a rectangle this time
Polygon rectangle = gsf.createRectangle();

Geometry circleIntersection = circleA.intersection(circleB);
return rectangle.intersects(circleIntersection);

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

new Coordinate(minX, minY)});
Polygon p = gf.createPolygon(ring, null);
Geometry intersection = p.intersection(ls);
if(intersection instanceof LineString) {
  LineString ils = ((LineString) intersection);

代码示例来源:origin: kiselev-dv/gazetteer

/**
   * Tests if two polygons intersect.
   * @param a1 Area of first polygon
   * @param a2 Area of second polygon
   * @param eps an area threshold, everything below is considered an empty intersection
   * @return intersection kind
   */
  public static PolygonIntersection polygonIntersection(Polygon a1, Polygon a2, double eps) {

    com.vividsolutions.jts.geom.Geometry inter = a1.intersection(a2);

    Envelope bounds = inter.getEnvelopeInternal();

    if (inter.isEmpty() || bounds.getHeight()*bounds.getWidth() <= eps) {
      return PolygonIntersection.OUTSIDE;
    } else if (inter.equals(a1)) {
      return PolygonIntersection.FIRST_INSIDE_SECOND;
    } else if (inter.equals(a2)) {
      return PolygonIntersection.SECOND_INSIDE_FIRST;
    } else {
      return PolygonIntersection.CROSSING;
    }
  }
}

代码示例来源:origin: kiselev-dv/gazetteer

.intersection(cityPolygon);
if (!intersection.isEmpty()) {
  String neighbourId = neighbours.get(neighbourPolygon

代码示例来源:origin: org.geoserver.extension/imagemap

Geometry clippedGeometry=clippingBox.intersection(geo);                	
   ft.setDefaultGeometry(clippedGeometry);
} catch (Throwable e) {

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

geometry = JTS.toGeometry((Envelope) coverageEnvelope).intersection(geometry);
geometryEnvelope = new ReferencedEnvelope(geometry.getEnvelopeInternal(),
    dataCoverage.getCoordinateReferenceSystem());

相关文章