/// <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. TC srm 673 300 div1

    TC srm.673 300 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 Description 给你n(n<=50)匹马和n个人,一匹马和一个人能 ...

  2. Codeforces gym 100685 C. Cinderella 水题

    C. CinderellaTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100685/problem/C ...

  3. android 访问SMS短信收件箱

    访问 SMS收件箱是另一个常见的需求.首先,需要将读取 SMS 的权限   <uses-permission android:name="android.permission.READ ...

  4. 关于在android手机中腾讯、阿里产品不自定义虚拟键盘的想法

    1,自定义虚拟键盘,影响用户体验.你每个用户的喜好不一样,都有自己心仪的一款输入法.腾讯或是阿里设计出来的输入法很难满足上亿用户的喜好,到时候又是一场口水战,再说了就是专业的输入法肯定要比应用里嵌套的 ...

  5. 1015. Reversible Primes (20)

    the problem is from PAT,which website is http://pat.zju.edu.cn/contests/pat-a-practise/1015 this pro ...

  6. scala Option 里的 orNull orElse getOrElse 区别和使用

    Scala Option Scala Option类型用来表示一个值是可选的(有值或无值) Option[T] 是一个类型为 T 的可选值的容器: 如果值存在, Option[T] 就是一个 Some ...

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

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

  8. cocos2d-x调度器原理

    程序运行后每达到一帧的时间间隔就会执行一次mainLoop void CCDisplayLinkDirector::mainLoop(void) { //判断是否需要释放CCDirector,通常游戏 ...

  9. [置顶] 《MFC游戏开发》笔记一 系列简介

    本系列文章由七十一雾央编写,转载请注明出处.  http://blog.csdn.net/u011371356/article/details/9299121 作者:七十一雾央 新浪微博:http:/ ...

  10. Redis' High Availability

    Redis Sentinel is a system designed to help managing Redis instances. It performs the following thre ...