private List <ILayer> AnalyzeLayerBase(string filePath, CheckedListBox checkedlistBox)
        {
            IWorkspace workspace = WorkspaceManager.OpenAccessWorkSpace(filePath);

            if (workspace == null)
            {
                MessageBox.Show(string.Format("打开文件{0}失败,未获取Workspace变量", System.IO.Path.GetFileNameWithoutExtension(filePath)));
                return(null);
            }
            List <ILayer> list = WorkspaceManager.AnalyzeLayers(workspace);

            checkedlistBox.Items.Clear();
            foreach (var item in list)
            {
                checkedlistBox.Items.Add(item.Name, true);
            }
            return(list);
        }
        public bool Init()
        {
            _messages = new List <string>();
            _tool     = new Clip();
            var clipWorkspace = WorkspaceManager.OpenAccessWorkSpace(ClipDataBasePath);

            if (clipWorkspace == null)
            {
                return(false);
            }
            var clipLayers = WorkspaceManager.AnalyzeLayers(clipWorkspace);

            foreach (var cliplayer in clipLayers)
            {
                if (ClipLayers.Contains(cliplayer.Name))
                {
                    if (cliplayer is IFeatureLayer)
                    {
                        var featureLayer = cliplayer as IFeatureLayer;
                        if (featureLayer != null)
                        {
                            var featureClass = featureLayer.FeatureClass;
                            if (featureClass != null)
                            {
                                var name             = featureClass.AliasName;
                                var saveDataBasePath = System.IO.Path.Combine(SaveFolder, name + ".mdb");
                                if (System.IO.File.Exists(saveDataBasePath))
                                {
                                    System.IO.File.Delete(saveDataBasePath);
                                }
                                if (!ArcGISFileHelper.CreatePersonalDataBase(saveDataBasePath))
                                {
                                    continue;
                                }

                                Program(saveDataBasePath, featureClass);
                            }
                        }
                    }
                }
            }
            return(_messages.Count == 0);
        }
Exemplo n.º 3
0
 private void AnalyzeLayer()
 {
     this.LayercomboBox.Items.Clear();
     this.FieldcomboBox.Items.Clear();
     if (!string.IsNullOrEmpty(this.MDBtextBox.Text))
     {
         var workspace = WorkspaceManager.OpenAccessWorkSpace(this.MDBtextBox.Text);
         if (workspace == null)
         {
             MessageBox.Show("打开数据库失败");
             return;
         }
         _workspace = workspace;
         var layers = WorkspaceManager.AnalyzeLayers(workspace);
         foreach (var layer in layers)
         {
             this.LayercomboBox.Items.Add(layer.Name);
         }
         _layers = layers;
     }
 }