您的位置:首页 > 其它

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

2012-08-09 11:30 204 查看
在要素图层上点选要素的快速方法

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
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: