如何缓冲 IPoint 或 IGeometry? (如何对 IPoint 进行缓冲相交检查?)
如何缓冲 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));
}
How would I buffer an IPoint to do an intersection check using IRelationalOperator?
I have, for arguments sake:
IPoint p1 = xxx;
IPoint p2 = yyy;
IRelationalOperator rel1 = (IRelationalOperator)p1;
if (rel.Intersects (p2))
// Do something
But now I want to add a tolerance to my check, so I assume the right way to do that is by either buffering p1 or p2. Right?
How do I add such a buffer?
Note: the Intersects method I am using is an extension method I wrote to simplify my code. Here it is:
/// <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));
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我找到了答案。或者一个答案。
使用 ITopologicalOperator 接口。
OK, I found the answer. Or an answer.
Use the ITopologicalOperator interface.