Exemple #1
0
 public void Init()
 {
     if (this.m_HasLicense)
     {
         this.m_list.Clear();
         if (!(this.m_CanEdit && (this.m_pMap != null)))
         {
             this.DisEnable();
         }
         else if (this.m_pMap.SelectionCount == 0)
         {
             this.DisEnable();
         }
         else
         {
             List <object> list = new List <object>();
             UID           uid  = new UIDClass
             {
                 Value = "{6CA416B1-E160-11D2-9F4E-00C04F6BC78E}"
             };
             IEnumLayer layer2 = this.m_pMap.get_Layers(uid, true);
             layer2.Reset();
             for (ILayer layer3 = layer2.Next(); layer3 != null; layer3 = layer2.Next())
             {
                 IFeatureLayer layer = layer3 as IFeatureLayer;
                 if (((layer != null) && Yutai.ArcGIS.Common.Editor.Editor.CheckLayerCanEdit(layer)) &&
                     ((layer as IFeatureSelection).SelectionSet.Count > 0))
                 {
                     ICursor cursor;
                     list.Add(layer);
                     (layer as IFeatureSelection).SelectionSet.Search(null, false, out cursor);
                     this.AddSelectToList(cursor, this.m_list);
                     ComReleaser.ReleaseCOMObject(cursor);
                 }
             }
             if (this.m_list.Count == 0)
             {
                 this.DisEnable();
             }
             else
             {
                 this.ZoomTo.Enabled      = true;
                 this.FlashObject.Enabled = true;
                 if (this.m_list.Count == 1)
                 {
                     object obj2 = this.m_list[0];
                     if (obj2 is IAnnotationFeature)
                     {
                         this.m_pAttributeListControl.SelectObject = obj2 as IObject;
                         this.m_pAnnoEditControl.AnnotationFeature = obj2 as IAnnotationFeature;
                         if (this.m_SelectType != 2)
                         {
                             this.tabControl1.Visible = true;
                             this.panel1.Visible      = false;
                             this.panel2.Visible      = false;
                             this.tabControl2.Visible = true;
                             this.m_SelectType        = 2;
                         }
                     }
                     else if (RepresentationAssist.HasRepresentation(obj2 as IFeature))
                     {
                         if (list.Count > 0)
                         {
                             this.m_pAttributeListControl2.FeatureLayer = list[0] as IFeatureLayer;
                         }
                         this.m_pAttributeListControl2.SelectObject = obj2 as IObject;
                         if (this.m_SelectType != 4)
                         {
                             this.tabControl2.Visible = false;
                             this.panel1.Visible      = true;
                             this.panel2.Visible      = false;
                             this.tabControl1.Visible = true;
                             this.m_SelectType        = 4;
                         }
                     }
                     else
                     {
                         if (list.Count > 0)
                         {
                             this.m_pAttributeListControl1.FeatureLayer = list[0] as IFeatureLayer;
                         }
                         this.m_pAttributeListControl1.SelectObject = obj2 as IObject;
                         if (this.m_SelectType != 1)
                         {
                             this.tabControl1.Visible = false;
                             this.panel1.Visible      = true;
                             this.panel2.Visible      = false;
                             this.tabControl2.Visible = true;
                             this.m_SelectType        = 1;
                         }
                         this.m_pAttributeListControl1.Visible = true;
                     }
                 }
                 else
                 {
                     this.m_pMultiAttributeListControl.LayerList = list;
                     if (this.m_SelectType != 3)
                     {
                         this.tabControl1.Visible = false;
                         this.panel2.Visible      = true;
                         this.panel1.Visible      = false;
                         this.tabControl2.Visible = false;
                         this.m_SelectType        = 3;
                     }
                 }
             }
         }
     }
 }
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            this.m_list.Clear();
            IFeatureLayer tag = null;

            if (e.Node.Tag is IFeatureLayer)
            {
                tag = e.Node.Tag as IFeatureLayer;
                for (int i = 0; i < e.Node.Nodes.Count; i++)
                {
                    this.m_list.Add(e.Node.Nodes[i].Tag);
                }
            }
            else if (e.Node.Tag is IRow)
            {
                tag = e.Node.Parent.Tag as IFeatureLayer;
                this.m_list.Add(e.Node.Tag);
            }
            if (this.m_list.Count == 0)
            {
                this.DisEnable();
            }
            else
            {
                this.ZoomTo.Enabled      = true;
                this.FlashObject.Enabled = true;
                if (this.m_list.Count == 1)
                {
                    object obj2 = this.m_list[0];
                    if (obj2 is IAnnotationFeature)
                    {
                        this.m_pAttributeListControl.SelectObject = obj2 as IObject;
                        this.m_pAnnoEditControl.AnnotationFeature = obj2 as IAnnotationFeature;
                        if (this.m_SelectType != 2)
                        {
                            this.tabControl1.Visible = true;
                            this.panel1.Visible      = false;
                            this.panel2.Visible      = false;
                            this.tabControl2.Visible = true;
                            this.m_SelectType        = 2;
                        }
                    }
                    else if (RepresentationAssist.HasRepresentation(obj2 as IFeature))
                    {
                        if (tag != null)
                        {
                            this.m_pAttributeListControl2.FeatureLayer = tag;
                        }
                        this.m_pAttributeListControl2.SelectObject = obj2 as IObject;
                        if (this.m_SelectType != 4)
                        {
                            this.tabControl2.Visible = false;
                            this.panel1.Visible      = true;
                            this.panel2.Visible      = false;
                            this.tabControl1.Visible = true;
                            this.m_SelectType        = 4;
                        }
                    }
                    else
                    {
                        if (tag != null)
                        {
                            this.m_pAttributeListControl1.FeatureLayer = tag;
                        }
                        this.m_pAttributeListControl1.SelectObject = obj2 as IObject;
                        if (this.m_SelectType != 1)
                        {
                            this.tabControl1.Visible = false;
                            this.panel1.Visible      = true;
                            this.panel2.Visible      = false;
                            this.tabControl2.Visible = true;
                            this.m_SelectType        = 1;
                        }
                        this.m_pAttributeListControl1.Visible = true;
                    }
                }
                else
                {
                    List <object> list = new List <object>
                    {
                        tag
                    };
                    this.m_pMultiAttributeListControl.LayerList = list;
                    if (this.m_SelectType != 3)
                    {
                        this.tabControl1.Visible = false;
                        this.panel2.Visible      = true;
                        this.panel1.Visible      = false;
                        this.tabControl2.Visible = false;
                        this.m_SelectType        = 3;
                    }
                }
            }
        }