/// <summary>
/// 得到输入点在输入图层上的最近点
/// </summary>
/// <param name="randomPoints">输入的点,注意小数位数不能太长,具体支持多长没有测试,我用小数点2位可以成功,但是七八位肯定不行</param>
/// <param name="feaPoints">输出在featureclass上距离最近的要素,这里是点类型输出的是点</param>
/// <param name="length">输入点到featureclass上最近点的距离</param>
/// <returns></returns>
public bool NearestPoint(IPoint[] randomPoints, out IPoint[] feaPoints, out double length)
{
feaPoints = new IPoint[randomPoints.Length];
length = ;
try
{
fd = (LinkReady.ReadPipeLineWorkspace() as IFeatureWorkspace).OpenFeatureDataset(LY.UG.Common.DictionaryConfig.DatasetName["道路网络数据集名称"]);//("SDE.地下管线");
nc = fd as INetworkCollection;
IFeatureClass feaRoadJunction = (fd as IFeatureClassContainer).get_ClassByName(LY.UG.Common.DictionaryConfig.DatasetName["道路网络点图层"]); int[] feaID = new int[randomPoints.Length];
double[] feaDis = new double[randomPoints.Length];
IFeatureIndex pFeatureIndex = new FeatureIndex();
IIndexQuery pIndexQuery;
IGeoDataset geodataset = (IGeoDataset)feaRoadJunction; ITrackCancel trackCancel = new TrackCancel();
pFeatureIndex.FeatureClass = feaRoadJunction;//.setFeatureClassByRef(pFeatureClass1); pFeatureIndex.Index(trackCancel, geodataset.Extent);
pIndexQuery = pFeatureIndex as IIndexQuery;
for (int i = ; i < randomPoints.Length; i++)
{
pIndexQuery.NearestFeature(randomPoints.GetValue(i) as IPoint, out feaID[i], out feaDis[i]);
feaPoints[i] = new PointClass();
feaPoints[i] = feaRoadJunction.GetFeature(feaID[i]).ShapeCopy as IPoint;
length = length + feaDis[i];
} return true;
}
catch (Exception ee)
{
return false;
}
}

 

找个输入IPoint在某个FeatureClass上距离最近的要素的更多相关文章

  1. [LeetCode] Find K-th Smallest Pair Distance 找第K小的数对儿距离

    Given an integer array, return the k-th smallest distance among all the pairs. The distance of a pai ...

  2. [LeetCode] 719. Find K-th Smallest Pair Distance 找第K小的数对儿距离

    Given an integer array, return the k-th smallest distance among all the pairs. The distance of a pai ...

  3. AE 获取地图上当前选中的要素

    樱木 原文 AE开发----获取地图上当前选中的要素 Code1 int selCount = axMapControl1.Map.SelectionCount; IEnumFeature pEnum ...

  4. 719. 找出第 K 小的数对距离

    719. 找出第 K 小的数对距离 这道题其实有那么一点二分猜答案的意思,也有很多类似题目,只不过这道题确实表达的不是很清晰不容易想到,题没问题,我的问题.既然是猜答案,那么二分边界自然就是距离最大值 ...

  5. 用JAVA实现找出输入字符串中的出现次数最多的字符及其次数;

    //通过Map 类实现,通过键值对的方式,可以将输入的字符串的每一个字符,作为键,每个字符出现的次数作为值:如下: public class Find { public static void mai ...

  6. input输入时光标位置靠上问题解决

    在css中如果我们定义了input高度在输入时会发现光标位置靠上了不在居中了,在Chrome浏览器中,当设置了line-height时,input无文字,光标高度与line-height一致:inpu ...

  7. 9、面向对象以及winform的简单运用(输入输出流、图像的上传和读取)

    一.输入输出流 1.概念: 输入输出流主要用于保存.读取文件,其内容保存在内存中. 2.使用方法: using System.IO; //System.IO 命名空间包含允许读写文件和数据流的类型以及 ...

  8. 开始ubuntu 14.04 的装X模式---终端模式下中文输入,听歌,上irc 开启framebuffer看电影 截图

    先上图吧 卡卡的全是在tty1 下的操作,看电影,听歌,截图 ,看图  ,上irc 等等,相当适合在小白面前装屁! 需要安装的软件: 为了能正常显示中文:安装fbterm sudo apt-get i ...

  9. 灰度直方图及处理“cvQueryHistValue_1D”: 找不到标识符”的问题(上)

    // HIstogram.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include "opencv2/opencv.hpp ...

随机推荐

  1. POJ 3522 Slim Span 最小差值生成树

    Slim Span Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://poj.org/problem?id=3522 Description Gi ...

  2. 奇妙华为3c手机, 出现安装未成功问题。

    1.我会命令adb uninstall 先卸载我们有签名的安装包. 2.用开发模式在手机上执行我们的应用. 3.然后測试就把手机拿走了,就用应用管理器把我们的应用卸载了. 4.继续装我们的开发包,死活 ...

  3. C++ CheckBox_Porerty

    主题 1. s       Caption属性 CheckBox   CheckDlgButton BOOL CheckDlgButton(      HWND hDlg,      // handl ...

  4. [Javascript] Monads

    Monads allow you to nest computations. They are a pointed functor that adds mjoin and chain function ...

  5. [Javascript] Function scope

    We have code like: var numbers = [1,2,3]; for(var i in numbers){ setTimeout(function(){console.log(n ...

  6. 文件尾存在EOF吗?

    参考:http://bbs.csdn.net/topics/290027166 我們先一起來看看FILE是怎么定義的:   FILE                          <STDI ...

  7. AngularJS - 插件,module注入

    Index.html <body> <div ng-app="myApp"> <div ng-controller="firstContro ...

  8. 《Entity Framework 6 Recipes》中文翻译——第九章EntityFramework在N层架构程序中的应用(七)

    在WCF服务中的序列化代理 问题 您有一个从查询返回的动态代理对象,你想要把它像POCO对象已经进行序列化.在序列化基于实体对象的POCO(普通旧CLR对象)时,实体框架会自动生成一个动态生成的派生类 ...

  9. Google翻译,3个步骤灭绝人类

    今儿这事儿得从一个新闻说起:<谷歌又飙车了,刚发布了神经机器翻译系统,没见过的语言它也能翻译> 大家如果懒的看原文,可以直接看我这个简单白话列表: Google又出来嘚瑟了,发布了基于神经 ...

  10. iOS搜索框

    在iOS8以前搜索框是作为一个控件添加到TableViewController中, 有系统自带的搜索变量self.searchDisplayController 遵守一个搜索显示的协议<UISe ...