0

我将如何缓冲一个 IPoint 以使用 IRelationalOperator 进行交叉检查?

为了争论,我有:

IPoint p1 = xxx;
IPoint p2 = yyy;
IRelationalOperator rel1 = (IRelationalOperator)p1;
   if (rel.Intersects (p2))
    // Do something

但是现在我想在我的检查中添加一个容差,所以我认为正确的方法是缓冲 p1 或 p2。对?如何添加这样的缓冲区?

注意:我使用的 Intersects 方法是我为简化代码而编写的扩展方法。这里是:

/// <summary>
/// Returns true if the IGeometry is intersected.
/// This method negates the Disjoint method.
/// </summary>
/// <param name="relOp">The rel op.</param>
/// <param name="other">The other.</param>
/// <returns></returns>
public static bool Intersects (
    this IRelationalOperator relOp,
    IGeometry other)
{
    return (!relOp.Disjoint (other));
}
4

1 回答 1

2

好的,我找到了答案。或者一个答案。使用 ITopologicalOperator 接口。

IPoint p1 = xxx;
IPoint p2 = yyy;
ITopologicalOperator topoOp = (ITopologicalOperator)p2 ;
IGeometry p2Bufferd = topoOp.Buffer (bufferSize);

IRelationalOperator rel1 = (IRelationalOperator)p1;
   if (rel.Intersects (p2Bufferd))
    // Do something
于 2010-05-10T11:35:23.453 回答