如何缓冲IPoint或IGeometry? (如何对IPoint进行缓冲交叉检查?)

时间:2010-05-10 10:08:23

标签: arcobjects

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

为了论证,我有:

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));
}

1 个答案:

答案 0 :(得分: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