AE Identify快捷查询接口介绍

(摘抄来自:https://blog.csdn.net/muzai/article/details/5748829)

利用ArcEngine 空间查询,大多数人会马上想到利用IQueryFilter 接口,的确,IQueryFilter 接口是我们经常使用的 查询接口而且使用比较简单,但是在大数据量查询数据,尤其是空间查询时效率会很低,导致速度会很慢。

 

给大家推荐一个接口,给刚刚入门或者还不知道该接口的朋友提供一点参考。

IIdentify 继承了 FeatureLayer 、RasterLayer 、 CadFeatureLayer 等 N 种图层种类,而且查询效率比IQueryFilter要高

缺点:只有与查询图形相交一种查询方式没有IQueryfilter 的查询方式多样

 

 

 

// 获得查询图形

IActiveView act = myMapControl.ActiveView.FocusMap as IActiveView;

IPoint pp = act.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);

//QI FeatureLayer QI   IIdentif

IIdentify pIdentify = needLayer as IIdentify;

IArray pIDs = pIdentify.Identify((IGeometry)pp);

if (pIDs == null || pIDs.Count == 0)

{

      return;

}

// 取 第一个实体

IFeatureIdentifyObj pFeatIdObj = pIDs.get_Element(0) as IFeatureIdentifyObj;

// 1 :获得IFeature 对象

IFeature pFea= pFeatIdObj.Feature;

myMapControl.FlashShape(needFeat.Shape, 3, 300, null);

//2 :获得IRow 对象

IRowIdentifyObject pRowObj = pFeatIdObj as IRowIdentifyObject;

IRow pRow= = pRowObj.Row ;

posted @ 2018-05-10 09:21  xiaomozi  阅读(154)  评论(0编辑  收藏  举报