找个输入IPoint在某个FeatureClass上距离最近的要素
/// <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上距离最近的要素的更多相关文章
- [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 ...
- [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 ...
- AE 获取地图上当前选中的要素
樱木 原文 AE开发----获取地图上当前选中的要素 Code1 int selCount = axMapControl1.Map.SelectionCount; IEnumFeature pEnum ...
- 719. 找出第 K 小的数对距离
719. 找出第 K 小的数对距离 这道题其实有那么一点二分猜答案的意思,也有很多类似题目,只不过这道题确实表达的不是很清晰不容易想到,题没问题,我的问题.既然是猜答案,那么二分边界自然就是距离最大值 ...
- 用JAVA实现找出输入字符串中的出现次数最多的字符及其次数;
//通过Map 类实现,通过键值对的方式,可以将输入的字符串的每一个字符,作为键,每个字符出现的次数作为值:如下: public class Find { public static void mai ...
- input输入时光标位置靠上问题解决
在css中如果我们定义了input高度在输入时会发现光标位置靠上了不在居中了,在Chrome浏览器中,当设置了line-height时,input无文字,光标高度与line-height一致:inpu ...
- 9、面向对象以及winform的简单运用(输入输出流、图像的上传和读取)
一.输入输出流 1.概念: 输入输出流主要用于保存.读取文件,其内容保存在内存中. 2.使用方法: using System.IO; //System.IO 命名空间包含允许读写文件和数据流的类型以及 ...
- 开始ubuntu 14.04 的装X模式---终端模式下中文输入,听歌,上irc 开启framebuffer看电影 截图
先上图吧 卡卡的全是在tty1 下的操作,看电影,听歌,截图 ,看图 ,上irc 等等,相当适合在小白面前装屁! 需要安装的软件: 为了能正常显示中文:安装fbterm sudo apt-get i ...
- 灰度直方图及处理“cvQueryHistValue_1D”: 找不到标识符”的问题(上)
// HIstogram.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include "opencv2/opencv.hpp ...
随机推荐
- cdoj 574 High-level ancients dfs序+线段树
High-level ancients Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/s ...
- BZOJ 1607: [Usaco2008 Dec]Patting Heads 轻拍牛头 筛法
1607: [Usaco2008 Dec]Patting Heads 轻拍牛头 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.lyds ...
- C# 制作外挂常用的API
C#做外挂的常用API,本人用了很久,基本没发现问题 using System; using System.Collections.Generic; using System.Text; using ...
- Python的包管理工具Pip
接触了Ruby,发现它有个包管理工具RubyGem非常好用,而且有非常完备的文档系统http://rdoc.info 发现Python下也有相同的工具,包含easy_install和Pip.只是,我没 ...
- TV
https://github.com/Xs4allWebTV/androidhttps://github.com/mode89/video-feedhttp://www.javaapk.com/sou ...
- WWDC2015—图解
- android139 360 黑名单 增删改查-数据库操作
BlackNumberOpenHelper.java package com.itheima52.mobilesafe.db.dao; import android.content.Context; ...
- WinServer 之 Windows Server 2008 R2安装IIS
1.在"服务器管理器"中选择"添加角色",如下图: 2.在"服务器角色"步骤选择"Web 服务器(IIS)",如下图: ...
- Peter's Hobby
Problem Description Recently, Peter likes to measure the humidity of leaves. He recorded a leaf humi ...
- 使用dispatch_group实现并封装分组并发网络请求
在实际开发中我们通常会遇到这样一种需求:某个页面加载时通过网络请求获得相应的数据,再做某些操作.有时候加载的内容需要通过好几个请求的数据组合而成,比如有两个请求A和B,我们通常为了省事,会将B请求放在 ...