在要素图层上点选要素的快速方法

在要素图层上点选要素的快速方法

IFeatureLayer  ,  IFeature ,  

IIdentify2 ,  
IRowIdentifyObject


//鼠标按下  事件
        public override void OnMouseDown(int button, int shift, int x, int y)
        {            
            IPoint point;
            this.feat_dk = null;           
            point = this.HookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y);
            if (featureLayer != null)
            {                
                IFeature feature1 = null; 
                ESRI.ArcGIS.esriSystem.IArray arr = (this.featureLayer as IIdentify2).Identify(point as IGeometry,null);
                if (arr != null && arr.Count > 0)
                {
                    object fiobj = arr.get_Element(0);
                    if (fiobj is IRowIdentifyObject)
                    {
                        feature1 = (fiobj as IRowIdentifyObject).Row as IFeature;
                    }
                }
                if (feature1 != null)
                {
                    ZhFeature zhfeat = new ZHFeaturePolygon(feature1);
                    this.feat_dk=feature1;

                    IFeatureSelection selection1 = this.featureLayer as IFeatureSelection;
                    selection1.Clear();
                    selection1.Add(feature1);                    
                    IEnvelope env = this.HookHelper.ActiveView.Extent;
                    this.HookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, this.featureLayer, env);
                    this.selDelegate();   //调用代理方法(执行回调)                    
                }               
            } //end if
        }


你可能感兴趣的:(object,null,button)