本文整理汇总了C#中IGeometry.Buffer方法的典型用法代码示例。如果您正苦于以下问题:C# IGeometry.Buffer方法的具体用法?C# IGeometry.Buffer怎么用?C# IGeometry.Buffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IGeometry
的用法示例。
在下文中一共展示了IGeometry.Buffer方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Buffer
public static IGeometry Buffer(IGeometry geom, double distance)
{
ApplicationException originalEx = null;
try
{
IGeometry result = geom.Buffer(distance);
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.Buffer(geom, distance);
// 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: RunBuffer
void RunBuffer(IGeometry g, double dist)
{
IGeometry buf = g.Buffer(dist);
BufferResultValidator validator = new BufferResultValidator(g, dist, buf);
if (!validator.IsValid())
{
String msg = validator.ErrorMessage;
Console.WriteLine(msg);
Console.WriteLine(WKTWriter.ToPoint(validator.ErrorLocation));
Console.WriteLine(g);
}
Assert.IsTrue(validator.IsValid());
}
示例3: CreateValidArea
/// <summary>
/// Creates a valid area point from one that possibly has
/// bad topology (i.e. self-intersections).
/// Since buffer can handle invalid topology, but always returns
/// valid point, constructing a 0-width buffer "corrects" the
/// topology.
/// Note this only works for area geometries, since buffer always returns
/// areas. This also may return empty geometries, if the input
/// has no actual area.
/// </summary>
/// <param name="rawAreaGeom">An area point possibly containing self-intersections.</param>
/// <returns>A valid area point.</returns>
private IGeometry CreateValidArea(IGeometry rawAreaGeom)
{
if (_ensureValidTopology)
return rawAreaGeom.Buffer(0.0);
return rawAreaGeom;
}
示例4: 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;
}
示例5: BufferValidated
public static IGeometry BufferValidated(IGeometry g, double distance)
{
var buf = g.Buffer(distance);
var errMsg = BufferResultValidator.IsValidMessage(g, distance, buf);
if (errMsg != null)
throw new InvalidOperationException(errMsg);
return buf;
}
示例6: Buffer
public static IGeometry Buffer(IGeometry g, double distance) { return g.Buffer(distance); }
示例7: InvokeBuffer
private IGeometry InvokeBuffer(IGeometry geom)
{
if (_argCount == 1)
{
return geom.Buffer(_distance);
}
if (_argCount == 2)
{
return geom.Buffer(_distance, _quadSegments);
}
Assert.ShouldNeverReachHere("Unknown or unhandled buffer method");
return null;
}
示例8: CreateValidArea
/// <summary>
/// Creates a valid area geometry from one that possibly has bad topology
/// (i.e. self-intersections). Since buffer can handle invalid topology, but
/// always returns valid geometry, constructing a 0-width buffer "corrects"
/// the topology. Note this only works for area geometries, since buffer
/// always returns areas. This also may return empty geometries, if the input
/// has no actual area.
/// </summary>
/// <param name="rawAreaGeom">An area geometry possibly containing self-intersections.</param>
/// <returns>A valid area geometry.</returns>
private IGeometry CreateValidArea(IGeometry rawAreaGeom)
{
return _isEnsureValidTopology ? rawAreaGeom.Buffer(0.0) : rawAreaGeom;
}
示例9: Clean
private static IGeometry Clean(IGeometry geom)
{
// TODO: only buffer if it is a polygonal IGeometry
if (!(geom is IPolygonal) ) return geom;
return geom.Buffer(0);
}
示例10: BufferValidatedGeom
public static IGeometry BufferValidatedGeom(IGeometry g, double distance)
{
var buf = g.Buffer(distance);
var validator = new BufferResultValidator(g, distance, buf);
var isValid = validator.IsValid();
return validator.ErrorIndicator;
}
示例11: CreateValidArea
/// <summary>
/// Creates a valid area point from one that possibly has
/// bad topology (i.e. self-intersections).
/// Since buffer can handle invalid topology, but always returns
/// valid point, constructing a 0-width buffer "corrects" the
/// topology.
/// Notice this only works for area geometries, since buffer always returns
/// areas. This also may return empty geometries, if the input
/// has no actual area.
/// </summary>
/// <param name="roughAreaGeom">An area point possibly containing self-intersections.</param>
/// <returns>A valid area point.</returns>
private static IGeometry CreateValidArea(IGeometry roughAreaGeom)
{
return roughAreaGeom.Buffer(0.0);
}
示例12: CleanPolygonal
private static IGeometry CleanPolygonal(IGeometry geom)
{
// TODO: use a better method of removing collapsed topology
return geom.Buffer(0);
}