本文整理汇总了Java中com.vividsolutions.jts.operation.overlay.OverlayOp.INTERSECTION属性的典型用法代码示例。如果您正苦于以下问题:Java OverlayOp.INTERSECTION属性的具体用法?Java OverlayOp.INTERSECTION怎么用?Java OverlayOp.INTERSECTION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.vividsolutions.jts.operation.overlay.OverlayOp
的用法示例。
在下文中一共展示了OverlayOp.INTERSECTION属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOverlay
public List<String> getOverlay(final Geometry layer1,
final Geometry layer2, final int op) {
final List<String> resultLayer = new ArrayList<String>();
Geometry geomContorno = null;
switch (op) {
case OverlayOp.INTERSECTION:
geomContorno = EnhancedPrecisionOp.intersection(
layer1.buffer(TOLERANCIA), layer2.buffer(TOLERANCIA));
break;
case OverlayOp.DIFFERENCE:
geomContorno = EnhancedPrecisionOp.difference(
layer1.buffer(TOLERANCIA), layer2.buffer(TOLERANCIA));
break;
case OverlayOp.SYMDIFFERENCE:
geomContorno = EnhancedPrecisionOp.symDifference(
layer1.buffer(TOLERANCIA), layer2.buffer(TOLERANCIA));
break;
default:
break;
}
if (geomContorno != null) {
if (geomContorno instanceof Polygon) {
resultLayer.add(geomContorno.toText());
} else if (geomContorno instanceof MultiPolygon) {
final MultiPolygon multiPolygon = (MultiPolygon) geomContorno;
for (int i = 0; i < multiPolygon.getNumGeometries(); i++) {
final Polygon pol = (Polygon) multiPolygon.getGeometryN(i);
resultLayer.add(pol.toText());
}
} else if (geomContorno instanceof GeometryCollection) {
final GeometryCollection gc = (GeometryCollection) geomContorno;
for (int i = 0; i < gc.getNumGeometries(); i++) {
final Geometry geom = gc.getGeometryN(i);
resultLayer.add(geom.toText());
}
}
}
return resultLayer;
}