private void HandleIdentify_MouseDown(object sender, ISceneControlEvents_OnMouseDownEvent e)
{
this.PipeSceneControl.Scene.ClearSelection();//清除之前的选择集,去除高亮显示
IHit3DSet pHit3DSet = null;
this.PipeSceneControl.SceneGraph.LocateMultiple(this.PipeSceneControl.SceneViewer, e.x, e.y, esriScenePickMode.esriScenePickAll, false, out pHit3DSet);
pHit3DSet.OnePerLayer();
if (pHit3DSet.Hits.Count == )
{
MessageBox.Show("没有选中任何要素!");
return;
}
IHit3D pHit3D = pHit3DSet.Hits.get_Element() as IHit3D;
IFeature pFeature = pHit3D.Object as IFeature;//pHit3D.Owner其实是一个ILayer类型,pHit3D.Object是一个IFeature类型
IFields pFields = pFeature.Fields;
StringBuilder Info = new StringBuilder();
for (int i = ; i < pFields.FieldCount;i++ )
{
IField pField = pFields.get_Field(i);
if (pField.Type != esriFieldType.esriFieldTypeGeometry)
{
Info.Append(pField.Name + ":" + pFeature.get_Value(pFields.FindField(pField.Name)) + "\n");
}
}
MessageBox.Show(Info.ToString());
IDisplay3D pDisplay3D = this.PipeSceneControl.SceneGraph as IDisplay3D;
pDisplay3D.FlashGeometry(pHit3D.Owner, pHit3D.Object);//闪烁一次,pHit3D.Owner是一个ILayer类型,pHit3D.Object是一个IFeature类型
//pDisplay3D.AddFlashFeature(pFeature.Shape);//保持高亮
this.PipeSceneControl.Scene.SelectFeature(pHit3D.Owner as ILayer, pFeature);//加入选择集,并自动高亮
}

文章来源:http://blog.csdn.net/iispring/article/details/7284077

05-11 23:03