IProximityOperator接口的详细解释---附代码
2018-02-05 15:19
288 查看
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;
}
}
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;
}
}
相关文章推荐
- 计算机中栈区,堆区,静态存储区,文字常量存储区,代码区的详细解释
- pmtest6.asm代码详细解释,对分页的形成过程有详细的解释
- CNN卷积神经网络应用于人脸识别(详细流程+代码实现)和相应的超参数解释
- 计算机中栈区,堆区,静态存储区,文字常量存储区,代码区的详细解释
- 带详细解释的冲击波原代码
- python实现的 K-近邻算法代码详细解释
- 基于基站定位数据的商圈分析代码详细解释
- 计算机中栈区,堆区,静态存储区,文字常量存储区,代码区的详细解释
- 【caffe】Caffe的Python接口-官方教程-00-classification-详细说明(含代码)
- 软件工程网络工程第二次训练(AC代码和详细解释)(C语言描述)
- JVM基础性问题,说出以下代码的输出结果,并作出详细的解释。
- 0-1背包详细解释加代码注释
- Android App更新版本以及提示用户下载最新apk(有图,有代码,有最终效果图)详细解释及思路
- 第四章:LABEL_FILENAME_FOUND,LABEL_GOON_LOADING_FILE,GetFATEntry ,ReadSector四段代码一起详细解释
- 母函数代码思路的详细解释
- TensorFlow实现word2vec 详细代码解释
- IIS 状态代码:IIS详细错误代码以及解释 【转载】
- 【caffe】Caffe的Python接口-官方教程-01-learning-Lenet-详细说明(含代码)
- 数据结构 - 线性表(顺序表)C语言代码实现-处理整型数据(附详细解释)。 _清风明月
- ROI Pooling层解析_代码原理详细解释和存在目的