private void FlashCommand(object sender, RoutedEventArgs e)
 {
     LogLog.Instance.Logger[LogLogEnum.Debug]("TableSearch:FlashCommand");
     try {
         IActiveView  av    = ArcMap.Document.ActiveView as IActiveView;
         FeatureModel aFeat = dataGrid1.SelectedItem as FeatureModel;
         av.ScreenDisplay.UpdateWindow();
         IFeatureIdentifyObj featIdentify = new FeatureIdentifyObject();
         featIdentify.Feature = aFeat.Feature;
         IIdentifyObj identify = featIdentify as IIdentifyObj;
         identify.Flash(av.ScreenDisplay);
     } catch (Exception ex) {
         LogLog.Instance.Logger[LogLogEnum.Error](ex.Message);
     }
 }
Esempio n. 2
0
 private void objTree_AfterSelect(object sender, TreeViewEventArgs e)
 {
     try
     {
         if ((this.objTree.SelectedNode != null) && (this.objTree.SelectedNode.Tag != null))
         {
             IActiveView view;
             object      tag = null;
             tag = this.objTree.SelectedNode.Tag;
             if (tag is IIdentifyObj)
             {
                 IIdentifyObj obj3 = tag as IIdentifyObj;
                 this.Infolist.Visible = true;
                 if (obj3 is IFeatureIdentifyObj)
                 {
                     this.ifeature_0 = (obj3 as IRowIdentifyObject).Row as IFeature;
                     view            = (IActiveView)this.ibasicMap_0;
                     this.method_6(obj3.Layer as IFeatureLayer, this.ifeature_0);
                     obj3.Flash(view.ScreenDisplay);
                 }
                 else
                 {
                     int          num;
                     string[]     strArray;
                     string       str;
                     string       str2;
                     ListViewItem item;
                     if (obj3 is IRasterIdentifyObj2)
                     {
                         this.panel5.AutoSize = true;
                         this.Infolist.Items.Clear();
                         num      = 0;
                         strArray = new string[2];
                         while (true)
                         {
                             try
                             {
                                 (obj3 as IRasterIdentifyObj2).GetPropAndValues(num, out str, out str2);
                                 if (str == null)
                                 {
                                     break;
                                 }
                                 strArray[0] = str;
                                 strArray[1] = str2;
                                 item        = new ListViewItem(strArray);
                                 this.Infolist.Items.Add(item);
                                 num++;
                             }
                             catch
                             {
                                 break;
                             }
                         }
                         view = (IActiveView)this.ibasicMap_0;
                         obj3.Flash(view.ScreenDisplay);
                     }
                     else
                     {
                         Exception exception;
                         if (obj3 is ITinIdentifyObj2)
                         {
                             this.panel5.AutoSize = true;
                             this.Infolist.Items.Clear();
                             num      = 0;
                             strArray = new string[2];
                             while (true)
                             {
                                 try
                                 {
                                     (obj3 as ITinIdentifyObj2).SetupEntity();
                                     (obj3 as ITinIdentifyObj2).GetPropAndValues(num, out str, out str2);
                                     if (str == null)
                                     {
                                         break;
                                     }
                                     strArray[0] = str;
                                     strArray[1] = str2;
                                     item        = new ListViewItem(strArray);
                                     this.Infolist.Items.Add(item);
                                     num++;
                                 }
                                 catch (Exception exception1)
                                 {
                                     exception = exception1;
                                     string message = exception.Message;
                                     break;
                                 }
                             }
                             view = (IActiveView)this.ibasicMap_0;
                             obj3.Flash(view.ScreenDisplay);
                         }
                         else if (obj3 is ICadIdentifyObj2)
                         {
                             this.panel5.AutoSize = true;
                             this.Infolist.Items.Clear();
                             num      = 0;
                             strArray = new string[2];
                             while (true)
                             {
                                 try
                                 {
                                     (obj3 as ICadIdentifyObj2).SetupEntity();
                                     (obj3 as ICadIdentifyObj2).GetPropAndValues(num, out str, out str2);
                                     if (str == null)
                                     {
                                         break;
                                     }
                                     strArray[0] = str;
                                     strArray[1] = str2;
                                     item        = new ListViewItem(strArray);
                                     this.Infolist.Items.Add(item);
                                     num++;
                                 }
                                 catch (Exception exception2)
                                 {
                                     exception = exception2;
                                     string text2 = exception.Message;
                                     break;
                                 }
                             }
                             view = (IActiveView)this.ibasicMap_0;
                             obj3.Flash(view.ScreenDisplay);
                         }
                         else if (obj3 is IIdentifyObject)
                         {
                             object obj4;
                             object obj5;
                             this.panel5.AutoSize = true;
                             (obj3 as IIdentifyObject).PropertySet.GetAllProperties(out obj4, out obj5);
                             this.Infolist.Items.Clear();
                             strArray = new string[2];
                             System.Array array  = obj4 as Array;
                             System.Array array2 = obj5 as Array;
                             for (int i = 0; i < array.Length; i++)
                             {
                                 strArray[0] = array.GetValue(i).ToString();
                                 strArray[1] = array2.GetValue(i).ToString();
                                 item        = new ListViewItem(strArray);
                                 this.Infolist.Items.Add(item);
                             }
                             view = (IActiveView)this.ibasicMap_0;
                             obj3.Flash(view.ScreenDisplay);
                         }
                     }
                 }
             }
             else if (tag is IFeature)
             {
                 this.Infolist.Visible = true;
                 this.ifeature_0       = tag as IFeature;
                 view = (IActiveView)this.ibasicMap_0;
                 this.method_5(this.ifeature_0);
                 Flash.FlashFeature(view.ScreenDisplay, this.ifeature_0);
             }
             else
             {
                 this.Infolist.Visible = false;
             }
         }
     }
     catch
     {
     }
 }
Esempio n. 3
0
 public override void OnMouseDown(int Button, int Shift, int X, int Y)
 {
     if (Button == 1)
     {
         List <ILayer> layers = EngineAPI.GetLayers(this.m_hookHelper.FocusMap, "{6CA416B1-E160-11D2-9F4E-00C04F6BC78E}", null);
         if (layers.Count == 0)
         {
             IdentifyManager.instance.FrmIdentify.Close();
             IdentifyManager.instance.FrmIdentify      = null;
             EnviVars.instance.MapControl.CurrentTool  = null;
             EnviVars.instance.MapControl.MousePointer = esriControlsMousePointer.esriPointerDefault;
         }
         else
         {
             foreach (ILayer current in layers)
             {
                 IIdentify identify = current as IIdentify;
                 IPoint    point    = this.m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
                 IArray    array    = identify.Identify(point);
                 if (array != null && array.Count != 0)
                 {
                     IdentifyManager.instance.FrmIdentify.treeList1.ClearNodes();
                     IIdentifyObj identifyObj = array.get_Element(0) as IIdentifyObj;
                     identifyObj.Flash(this.m_hookHelper.ActiveView.ScreenDisplay);
                     TreeListNode treeListNode = IdentifyManager.instance.FrmIdentify.treeList1.AppendNode(new object[]
                     {
                         identifyObj.Layer.Name
                     }, 0, identifyObj);
                     DataColumn column    = new DataColumn("字段", typeof(string));
                     DataColumn column2   = new DataColumn("值", typeof(string));
                     DataTable  dataTable = new DataTable();
                     dataTable.Columns.Add(column);
                     dataTable.Columns.Add(column2);
                     if (current is IFeatureLayer)
                     {
                         IFeature     feature       = (identifyObj as IRowIdentifyObject).Row as IFeature;
                         TreeListNode treeListNode2 = IdentifyManager.instance.FrmIdentify.treeList1.AppendNode(new object[]
                         {
                             feature.OID.ToString()
                         }, treeListNode);
                         int num = feature.Fields.FindField((current as IFeatureLayer).FeatureClass.ShapeFieldName);
                         for (int i = 0; i < feature.Fields.FieldCount; i++)
                         {
                             if (num != i)
                             {
                                 DataRow dataRow = dataTable.NewRow();
                                 dataRow["字段"] = feature.Fields.get_Field(i).AliasName;
                                 dataRow["值"]  = feature.get_Value(i).ToString();
                                 dataTable.Rows.Add(dataRow);
                             }
                         }
                         treeListNode2.Tag = dataTable;
                     }
                     else if (current is IRasterLayer)
                     {
                         IRasterLayer rasterLayer = current as IRasterLayer;
                         IRaster2     raster      = rasterLayer.Raster as IRaster2;
                         int          num2        = raster.ToPixelRow(point.Y);
                         int          num3        = raster.ToPixelColumn(point.X);
                         double       num4        = CommonAPI.ConvertToDouble(raster.GetPixelValue(0, num3, num2));
                         this.AddRow(dataTable, "像素值", num4);
                         this.AddRow(dataTable, "行号", num2);
                         this.AddRow(dataTable, "列号", num3);
                         IRasterIdentifyObj rasterIdentifyObj = array.get_Element(0) as IRasterIdentifyObj;
                         if (rasterLayer.BandCount != 1)
                         {
                             Regex           regex           = new Regex("\\d{2,3}");
                             MatchCollection matchCollection = regex.Matches(rasterIdentifyObj.MapTip);
                             if (matchCollection.Count == 3)
                             {
                                 this.AddRow(dataTable, "R", matchCollection[0].Value);
                                 this.AddRow(dataTable, "G", matchCollection[1].Value);
                                 this.AddRow(dataTable, "B", matchCollection[2].Value);
                             }
                         }
                         IdentifyManager.instance.FrmIdentify.treeList1.AppendNode(new object[]
                         {
                             rasterIdentifyObj.Name
                         }, treeListNode, dataTable);
                     }
                     IdentifyManager.instance.FrmIdentify.UpdateStatusText(string.Format("X:{0:0.000 },Y:{1:0.000}", point.X, point.Y));
                     IdentifyManager.instance.FrmIdentify.treeList1.ExpandAll();
                     if (treeListNode.Nodes.Count > 0)
                     {
                         IdentifyManager.instance.FrmIdentify.treeList1.FocusedNode = treeListNode.Nodes[0];
                     }
                     IdentifyManager.instance.FrmIdentify.Show();
                     break;
                 }
                 IdentifyManager.instance.FrmIdentify.Close();
                 IdentifyManager.instance.FrmIdentify = null;
             }
         }
     }
 }