本文整理了Java中org.locationtech.jts.geom.Geometry.symDifference()
方法的一些代码示例,展示了Geometry.symDifference()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.symDifference()
方法的具体详情如下:
包路径:org.locationtech.jts.geom.Geometry
类名称:Geometry
方法名:symDifference
[英]Computes a Geometry
representing the closure of the point-set which is the union of the points in this Geometry
which are not contained in the other
Geometry, with the points in the other
Geometry not contained in this Geometry
. If the result is empty, it is an atomic geometry with the dimension of the highest input dimension.
Non-empty GeometryCollection arguments are not supported.
[中]计算表示点集闭合的Geometry
,该点集是Geometry
中未包含在other
几何图形中的点的并集,而other
几何图形中的点未包含在Geometry
几何图形中。如果结果为空,则它是维度为最高输入维度的原子几何体。
不支持非空GeometryCollection参数。
代码示例来源:origin: geotools/geotools
public static Geometry symDifference(Geometry arg0, Geometry arg1) {
if (arg0 == null || arg1 == null) return null;
Geometry _this = arg0;
return _this.symDifference(arg1);
}
代码示例来源:origin: geotools/geotools
public Geometry symDifference(Geometry other) {
return geometry.symDifference(other);
}
代码示例来源:origin: geotools/geotools
@DescribeProcess(
title = "Symmetric Difference",
description =
"Returns a geometry representing the points contained in either one of two geometries but not in both. The result may be a heterogeneous geometry collection."
)
@DescribeResult(description = "Symmetric difference of the two geometries")
public static Geometry symDifference(
@DescribeParameter(name = "a", description = "First input geometry") Geometry a,
@DescribeParameter(name = "b", description = "Second input geometry") Geometry b) {
return a.symDifference(b);
}
代码示例来源:origin: orbisgis/h2gis
/**
* @param a Geometry instance.
* @param b Geometry instance
* @return the symmetric difference between two geometries
*/
public static Geometry symDifference(Geometry a,Geometry b) {
if(a==null || b==null) {
return null;
}
return a.symDifference(b);
}
}
代码示例来源:origin: locationtech/jts
public static Geometry symDifference(Geometry a, Geometry b) { return a.symDifference(b); }
public static Geometry difference(Geometry a, Geometry b) { return a.difference(b); }
代码示例来源:origin: locationtech/jts
(new FailureChecker() { void operation() {
b.symDifference(a);
} }).check(IllegalArgumentException.class);
}
代码示例来源:origin: locationtech/jts
public static Geometry symDifference(Geometry geomA, Geometry geomB, double scaleFactor) {
Geometry[] geom = snapClean(geomA, geomB, scaleFactor);
return geom[0].symDifference(geom[1]);
}
代码示例来源:origin: locationtech/jts
(new FailureChecker() { void operation() {
a.symDifference(b);
} }).check(IllegalArgumentException.class);
代码示例来源:origin: locationtech/jts
/**
* Computes the set-theoretic symmetric difference of two geometries,
* using enhanced precision.
* @param geom0 the first Geometry
* @param geom1 the second Geometry
* @return the Geometry representing the set-theoretic symmetric difference of the input Geometries.
*/
public Geometry symDifference(Geometry geom0, Geometry geom1)
{
Geometry[] geom = removeCommonBits(geom0, geom1);
return computeResultPrecision(geom[0].symDifference(geom[1]));
}
代码示例来源:origin: locationtech/jts
public boolean isSymDiffAreaInTolerance(Geometry actualBuffer, Geometry expectedBuffer)
{
double area = expectedBuffer.getArea();
Geometry diff = actualBuffer.symDifference(expectedBuffer);
// System.out.println(diff);
double areaDiff = diff.getArea();
// can't get closer than difference area = 0 ! This also handles case when symDiff is empty
if (areaDiff <= 0.0)
return true;
double frac = Double.POSITIVE_INFINITY;
if (area > 0.0)
frac = areaDiff / area;
return frac < MAX_RELATIVE_AREA_DIFFERENCE;
}
代码示例来源:origin: locationtech/jts
public static Geometry invokeGeometryOverlayMethod(int opCode, Geometry g0, Geometry g1)
{
switch (opCode) {
case OverlayOp.INTERSECTION: return g0.intersection(g1);
case OverlayOp.UNION: return g0.union(g1);
case OverlayOp.DIFFERENCE: return g0.difference(g1);
case OverlayOp.SYMDIFFERENCE: return g0.symDifference(g1);
}
throw new IllegalArgumentException("Unknown overlay op code");
}
代码示例来源:origin: org.jaitools/jt-utils
/**
* Returns a new instance which is the exclusive OR of this ROI and {@code roi}.
* This is only possible if {@code roi} is an instance of ROIGeometry
* or {@link ROIShape}.
*
* @param roi the ROI to add
* @return the union as a new instance
* @throws UnsupportedOperationException if {@code roi} is not an instance
* of ROIGeometry or {@link ROIShape}
*/
@Override
public ROI exclusiveOr(ROI roi) {
final Geometry geom = getGeometry(roi);
if (geom != null) {
return buildROIGeometry(theGeom.getGeometry().symDifference(geom));
}
throw new UnsupportedOperationException(UNSUPPORTED_ROI_TYPE);
}
代码示例来源:origin: it.geosolutions.jaiext.vectorbin/jt-vectorbin
/**
* Returns a new instance which is the exclusive OR of this ROI and {@code roi}.
* This is only possible if {@code roi} is an instance of ROIGeometry
* or {@link ROIShape}.
*
* @param roi the ROI to add
* @return the union as a new instance
*/
@Override
public ROI exclusiveOr(ROI roi) {
try {
final Geometry geom = getGeometry(roi);
if (geom != null) {
return buildROIGeometry(theGeom.getGeometry().symDifference(geom));
}
} catch(TopologyException e) {
if(LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Failed to perform operation using geometries, falling back on raster path", e);
}
}
// fallback on robust path
return super.exclusiveOr(roi);
}
代码示例来源:origin: geosolutions-it/jai-ext
/**
* Returns a new instance which is the exclusive OR of this ROI and {@code roi}.
* This is only possible if {@code roi} is an instance of ROIGeometry
* or {@link ROIShape}.
*
* @param roi the ROI to add
* @return the union as a new instance
*/
@Override
public ROI exclusiveOr(ROI roi) {
try {
final Geometry geom = getGeometry(roi);
if (geom != null) {
return buildROIGeometry(theGeom.getGeometry().symDifference(geom));
}
} catch(TopologyException e) {
if(LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Failed to perform operation using geometries, falling back on raster path", e);
}
}
// fallback on robust path
return super.exclusiveOr(roi);
}
代码示例来源:origin: locationtech/jts
Geometry result = geom0.symDifference(geom1);
return result;
代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-queryalgebra-geosparql
public Shape symDifference(Shape s1, Shape s2) {
Geometry symDiff = shapeFactory.getGeometryFrom(s1).symDifference(shapeFactory.getGeometryFrom(s2));
if (symDiff.isEmpty()) {
return shapeFactory.pointXY(Double.NaN, Double.NaN);
}
return shapeFactory.makeShapeFromGeometry(symDiff);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-queryalgebra-geosparql
public Shape symDifference(Shape s1, Shape s2) {
Geometry symDiff = shapeFactory.getGeometryFrom(s1).symDifference(shapeFactory.getGeometryFrom(s2));
if (symDiff.isEmpty()) {
return shapeFactory.pointXY(Double.NaN, Double.NaN);
}
return shapeFactory.makeShapeFromGeometry(symDiff);
}
代码示例来源:origin: org.opengeo/geodb
public static byte[] ST_SymDifference(byte[] wkb1, byte[] wkb2) {
if (wkb1 == null) {
return wkb2;
}
if (wkb2 == null) {
return wkb1;
}
Geometry geometry1 = gFromWKB(wkb1);
Geometry geometry2 = gFromWKB(wkb2);
if (geometry1 == null) {
return gToWKB(geometry2);
}
if (geometry2 == null) {
return gToWKB(geometry1);
}
return gToWKB(geometry1.symDifference(geometry2));
}
代码示例来源:origin: jdeolive/geodb
public static byte[] ST_SymDifference(byte[] wkb1, byte[] wkb2) {
if (wkb1 == null) {
return wkb2;
}
if (wkb2 == null) {
return wkb1;
}
Geometry geometry1 = gFromWKB(wkb1);
Geometry geometry2 = gFromWKB(wkb2);
if (geometry1 == null) {
return gToWKB(geometry2);
}
if (geometry2 == null) {
return gToWKB(geometry1);
}
return gToWKB(geometry1.symDifference(geometry2));
}
代码示例来源:origin: orbisgis/h2gis
getArealGeometryFromLinearRing(interiorRing).apply(new PolygonExtracter(polys));
geom = geom.symDifference(geom.getFactory().buildGeometry(polys));
内容来源于网络,如有侵权,请联系作者删除!