IProximityOperator接口
来源:互联网 发布:软件著作权属于专利 编辑:程序博客网 时间:2024/06/06 02:51
IProximityOperator接口用于获取两个几何图形的距离,以及给定一个Point,求另一个几何图形上离离给定点最近的点。IProximityOperator接口的主要方法有:QueryNearesPoint,ReturnDistance, ReturnNearestPoint
ReturnDistance方法用于返回两个几何对象间的最短距离,QueryNearesPoint方法用于查询获取几何对象上离给定输入点的最近距离的点的引用,ReturnNearestPoint方法用于创建并返回几何对象上离给定输入点的最近距离的点。
以下代码片段演示如何使用IProximityOperator接口获取给定点与要查询的几何图形的最近点:
/// 在pGeometry上返回一个离pInputPoint最近的point
/// </summary>
/// <param name="pInputPoint">给定的点对象</param>
/// <param name="pGeometry">要查询的几何图形</param>
/// <returns>the nearest Point</returns>
private IPoint NearestPoint(IPoint pInputPoint, IGeometry pGeometry)
{
try
{
IProximityOperator pProximity = (IProximityOperator)pGeometry;
IPoint pNearestPoint = pProximity.ReturnNearestPoint(pInputPoint, esriSegmentExtension.esriNoExtension);
return pNearestPoint;
}
catch(Exception Err)
{
MessageBox.Show(Err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return null;
}
}
以下代码片段演示如何使用IProximityOperator接口查询给定的两个几何对象的距离:
/// <summary>
/// 获取两个几何图形的距离
/// </summary>
/// <param name="pGeometryA">几何图形A</param>
/// <param name="pGeometryB">几何图形B</param>
/// <returns>两个几何图形的距离</returns>
private double GetTwoGeometryDistance(IGeometry pGeometryA, IGeometry pGeometryB)
{
IProximityOperator pProOperator = pGeometryA as IProximityOperator;
if (pGeometryA!=null|| pGeometryB !=null)
{
double distance= pProOperator.ReturnDistance(pGeometryB);
return distance;
}
else
{
return 0;
}
}
- IProximityOperator接口
- IProximityOperator接口
- 空间分析相关接口(ITopologicalOperator,IRelationalOperator,IProximityOperator)
- 接口
- 接口
- 接口
- 接口
- 接口
- 接口
- 接口
- 接口
- 接口
- 接口
- 接口
- 接口
- 接口
- 接口
- 接口
- UIImage+Alpha
- 黑马程序员_异常
- android java开发 第三天 之 Activity 与 Service 绑定(activiey 调用service中方法)
- XML Schema Validation with JAXP
- JavaScript中的闭包
- IProximityOperator接口
- UIImage+Resize
- 用ProcessExplorer和WinDbg排查并解决“无响应”
- 项目总结
- http://blog.csdn.net/ronghao100/article/details/7949291
- 非农数据不及预期,欧元强劲反弹
- 删除badi及badi interface
- Android编译系统详解(一)
- Flex中实现Flex页面跳转