Esempio n. 1
0
        public static void StartZDEdit()
        {
            ZDEditTools.StartEditDateTime = System.DateTime.Now;
            IMap editMap = Editor.Editor.EditMap;

            System.Collections.Generic.List <IFeatureLayer> list = new System.Collections.Generic.List <IFeatureLayer>();
            for (int i = 0; i < editMap.LayerCount; i++)
            {
                ILayer layer = editMap.get_Layer(i);
                if (layer is IGroupLayer)
                {
                    ZDEditTools.CheckGroupLayerEdit(list, layer as ICompositeLayer);
                }
                else if (layer is IFeatureLayer)
                {
                    IFeatureLayer featureLayer = layer as IFeatureLayer;
                    if (ZDEditTools.CheckLayerIsCanEditZD(featureLayer))
                    {
                        list.Add(featureLayer);
                    }
                }
            }
            if (list.Count == 0)
            {
                System.Windows.Forms.MessageBox.Show("当前没有可编辑的宗地图层!");
            }
            else if (list.Count == 1)
            {
                ZDEditTools.ZDFeatureLayer    = list[0];
                ZDEditTools.ZDFeatureClass    = ZDEditTools.ZDFeatureLayer.FeatureClass;
                ZDEditTools.ZDHisFeatureClass = ZDRegister.GetHistoryFeatureClass(ZDEditTools.ZDFeatureClass);
                ZDEditTools.FireStartZDEdit();
            }
            else
            {
                frmSelectEditZD frmSelectEditZD = new frmSelectEditZD();
                frmSelectEditZD.FeatureLayers = list;
                if (frmSelectEditZD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    ZDEditTools.ZDFeatureLayer    = frmSelectEditZD.SelectFeatureLayer;
                    ZDEditTools.ZDFeatureClass    = ZDEditTools.ZDFeatureLayer.FeatureClass;
                    ZDEditTools.ZDHisFeatureClass = ZDRegister.GetHistoryFeatureClass(ZDEditTools.ZDFeatureClass);
                    ZDEditTools.FireStartZDEdit();
                }
            }
        }
Esempio n. 2
0
 private static void CheckGroupLayerEdit(System.Collections.Generic.List <IFeatureLayer> list_0,
                                         ICompositeLayer icompositeLayer_0)
 {
     for (int i = 0; i < icompositeLayer_0.Count; i++)
     {
         ILayer layer = icompositeLayer_0.get_Layer(i);
         if (layer is IGroupLayer)
         {
             ZDEditTools.CheckGroupLayerEdit(list_0, layer as ICompositeLayer);
         }
         else if (layer is IFeatureLayer)
         {
             IFeatureLayer featureLayer = layer as IFeatureLayer;
             if (ZDEditTools.CheckLayerIsCanEditZD(featureLayer))
             {
                 list_0.Add(featureLayer);
             }
         }
     }
 }