ArcEngine实现捕捉节点
来自:http://blog.sina.com.cn/s/blog_4d0b75870100o960.html
//获取最近的结点,然后在 OnMouseMove中显示
//pnt:鼠标移动点
//mapSize:设置的地理范围
public static IPoint GetNearestVertex(IActiveView actview, IPoint pnt, double mapSize)
{
IPoint vetex = null;
IPoint hitPnt=new PointClass();
IHitTest hitTest = null;
IPointCollection pntColl =new MultipointClass();
IProximityOperator prox = null;
double hitdis=0;
int hitpartindex=0,hitsegindex=0;
Boolean rside = false;
IFeatureCache2 featCache = new FeatureCacheClass();
double pixelSize = ConvertMapUnitsToPixels(actview, mapSize); //将地理范围转化为像素
featCache.Initialize(pnt, pixelSize); //初始化缓存
for (int i = 0; i < actview.FocusMap.LayerCount; i++)
{
//只有点、线、面并且可视的图层才加入缓存
IFeatureLayer featLayer =(IFeatureLayer) actview.FocusMap.get_Layer(i);
if (featLayer != null && featLayer.Visible == true &&
(featLayer.FeatureClass.ShapeType==esriGeometryType.esriGeometryPolyline ||
featLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon ||
featLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint))
{
featCache.AddFeatures(featLayer.FeatureClass, null);
for (int j = 0; j < featCache.Count; j++)
{
IFeature feat = featCache.get_Feature(j);
hitTest =(IHitTest ) feat.Shape;
//捕捉节点,另外可以设置esriGeometryHitPartType,捕捉边线点,中间点等。
if (hitTest.HitTest(pnt, mapSize, esriGeometryHitPartType.esriGeometryPartVertex, hitPnt, ref hitdis, ref hitpartindex, ref hitsegindex, ref rside))
{
object obj=Type.Missing ;
pntColl.AddPoint(hitPnt,ref obj,ref obj);
break;
}
}
}
}
prox =(IProximityOperator)pnt;
double minDis=0, dis=0;
for (int i = 0; i < pntColl.PointCount; i++)
{
IPoint tmpPnt=pntColl.get_Point(i);
dis= prox.ReturnDistance(tmpPnt);
if (i == 0)
{
minDis = dis;
vetex = tmpPnt;
}
else
{
if (dis < minDis)
{
minDis = dis;
vetex = tmpPnt;
}
}
}
return vetex;
}
ArcEngine实现捕捉节点的更多相关文章
- C# Arcgis Engine 捕捉功能实现
namespace 捕捉 { public partial class Form1 : Form { private bool bCreateElement=true; ; ; private IEl ...
- DeepWalk论文精读:(1)解决问题&相关工作
模块1 1. 研究背景 随着互联网的发展,社交网络逐渐复杂化.多元化.在一个社交网络中,充斥着不同类型的用户,用户间产生各式各样的互动联系,形成大小不一的社群.为了对社交网络进行研究分析,需要将网络中 ...
- Host–Parasite(主从关系): Graph LSTM-in-LSTM for Group Activity Recognition
This article aims to tackle the problem of group activity recognition in the multiple-person scene. ...
- 知识图谱-生物信息学-医学顶刊论文(Briefings in Bioinformatics-2021):生物信息学中的图表示学习:趋势、方法和应用
4.(2021.6.24)Briefings-生物信息学中的图表示学习:趋势.方法和应用 论文标题: Graph representation learning in bioinformatics: ...
- ArcEngine拓扑
空间拓扑描述的是自然界地理对象的空间位置关系-相邻,重合,连通等,是地理对象空间属性的一部分.目前ESRI提供的数据存储方式中,Coverage和GeoDatabase能够建立拓扑,Shape格式的数 ...
- ArcEngine中合并断开的线要素(根据几何判断)
在上一篇ArcEngine环境下合并断开的线要素(根据属性)随笔中介绍了如何通过shp文件属性表中相同的属性字段进行线要素的合并.今天刚把通过几何条件判断的方式连接断开的线要素的ArcGIS 插件完成 ...
- Arcengine实现创建网络数据集札记(二)
四 ArcEngine实现创建网络数据集 ArcEngine创建网络数据集的过程,与ArcMap设置的过程类似,主要通过六个步骤即可以实现. 1 定义网络数据集对象,并设置基本属性,包括网络数据集名称 ...
- arcengine 开发经典帖
http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=25575&page=1&extra= 使用ArcGIS Engine 开发自定义 ...
- 光荣与梦想 | XMove动作捕捉系统(一)
XMove是我和几个死党从2010年开始开发的一套人体动作捕捉系统,软硬件全部自行开发,投入了大量的精力,历经三年,发展四个版本. 今年春节回到老家,翻出了2011年春节时焊电路用过的松香和和硬盘角落 ...
随机推荐
- cf754 A. Lesha and array splitting
应该是做麻烦了,一开始还没A(幸好上一次比赛水惨了) #include<bits/stdc++.h> #define lowbit(x) x&(-x) #define LL lon ...
- ASP.NET|跳转(redirect)到其它站点,提示:当前线程终止。
在XAF中,如果使用HttpContext.Response.Redirect()进行跳转,会出现”当前线程终止“的报错,跳转失败. 这时候,应该改用WebApplication.Redirect() ...
- Thread message loop for a thread with a hidden window? Make AllocateHwnd safe
Thread message loop for a thread with a hidden window? I have a Delphi 6 application that has a thre ...
- maven中解决javax.servlet.jsp.PageContext cannot be resolved to a type
在eclipse环境下用maven出现:javax.servlet.jsp.PageContext cannot be resolved to a type. 这是由于没有引入jsp-api引发的问题 ...
- 记录一下centos安装httpd+php+mysql的过程
1.安装apache httpd 这个貌似安装完centos后自带了,如果没有,也可以用yum安装 yum -y install httpd 2.安装php yum -y install php ph ...
- BZOJ 1083: [SCOI2005]繁忙的都市 kruskal
1083: [SCOI2005]繁忙的都市 题目连接: http://www.lydsy.com/JudgeOnline/problem.php?id=1083 Description 城市C是一个非 ...
- dsPIC33EP timer1 初始化设置及应用
//文件 p33timer1.h #ifndef _P33TIMER1_H_ #define _P33TIMER1_H_ //#include "p33timer1.h" #def ...
- [Angular 2] Nesting Elements in Angular 2 Components with ng-content (AKA Angular 2 Transclusion)
You can place content inside of the instance of your component element then manage it inside of the ...
- windows 支持curl命令
curl 是一般linux发行版中都带有的小工具,利用这个工具可以很方便的下载文件, 我一般使用这个工具来查看某个页面相应的HTTP头信息,在Windows系统中我们也一样可以使用这个工具,如果不需要 ...
- SQL Server事务日志介绍
SQL Server中的数据库都是由一或多个数据文件以及一或多个事务日志文件组成的. 顾名思意,数据文件主要存储数据库的数据,包括数据库内容结构,数据页,索引页等等.那么事务日志到底是干什么的呢?它主 ...