本文整理汇总了C#中IGeometry.SymmetricDifference方法的典型用法代码示例。如果您正苦于以下问题:C# IGeometry.SymmetricDifference方法的具体用法?C# IGeometry.SymmetricDifference怎么用?C# IGeometry.SymmetricDifference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGeometry
的用法示例。
在下文中一共展示了IGeometry.SymmetricDifference方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SymDifference
/// <summary>
/// Computes the set-theoretic symmetric difference of two <c>Geometry</c>s, using enhanced precision.
/// </summary>
/// <param name="geom0">The first Geometry.</param>
/// <param name="geom1">The second Geometry.</param>
/// <returns>The Geometry representing the set-theoretic symmetric difference of the input Geometries.</returns>
public static IGeometry SymDifference(IGeometry geom0, IGeometry geom1)
{
ApplicationException originalEx;
try
{
IGeometry result = geom0.SymmetricDifference(geom1);
return result;
}
catch (ApplicationException ex)
{
originalEx = ex;
}
/*
* If we are here, the original op encountered a precision problem
* (or some other problem). Retry the operation with
* enhanced precision to see if it succeeds
*/
try
{
CommonBitsOp cbo = new CommonBitsOp(true);
IGeometry resultEP = cbo.SymDifference(geom0, geom1);
// check that result is a valid point after the reshift to orginal precision
if (!resultEP.IsValid)
throw originalEx;
return resultEP;
}
catch (ApplicationException)
{
throw originalEx;
}
}
示例2: InvokeGeometryOverlayMethod
public static IGeometry InvokeGeometryOverlayMethod(SpatialFunction opCode, IGeometry g0, IGeometry g1)
{
switch (opCode)
{
case SpatialFunction.Intersection:
return g0.Intersection(g1);
case SpatialFunction.Union:
return g0.Union(g1);
case SpatialFunction.Difference:
return g0.Difference(g1);
case SpatialFunction.SymDifference:
return g0.SymmetricDifference(g1);
}
throw new ArgumentException(@"Unknown overlay op code");
}
示例3: IsApproximateCoincident
private static bool IsApproximateCoincident(IGeometry g1, IGeometry g2, double tolerance)
{
IGeometry symdiff;
if (g1.Dimension < Dimensions.Surface && g2.Dimension < Dimensions.Surface)
{
g1 = g1.Buffer(tolerance);
g2 = g2.Buffer(tolerance);
symdiff = g1.SymmetricDifference(g2).Buffer(tolerance);
}
else
{
symdiff = g1.SymmetricDifference(g2);
}
double relError = symdiff.Area / (g1.Area + g2.Area);
return relError < tolerance;
}
示例4: symDifference
public static IGeometry symDifference(IGeometry a, IGeometry b)
{
return a.SymmetricDifference(b);
}