图层元素识别
图层元素识别,用于点选或者框选
// 接受识别数据的数组
IArray pIDArray;
/// 创建包络区域
IEnvelope pEnv;
/// 包络区域的四个边界的指定
r.bottom = e.y + 5;
r.top = e.y - 5;
r.left = e.x - 5;
r.right = e.x + 5;
//也可以自定义画框来识别
// pEnv = axMapControl1.TrackRectangle();
// 创建识别接口,并将要识别的图层定义为识别接口
IIdentify pIdentify;
pIdentify = (IIdentify)GetGallery(this.ActiveGallery);
pIDArray = pIdentify.Identify(pEnv);
IFeatureIdentifyObj pFeatIdObj;
pFeatIdObj = (IFeatureIdentifyObj)pIDArray.get_Element(0);
IIdentifyObj pIdObj = (IIdentifyObj)pFeatIdObj;
IFeature pFeature = pRowObj.Row as IFeature;