zoukankan      html  css  js  c++  java
  • 获取数据库中的要素类

    在ArcGIS Engine中,要得到某一个类,首要要获取工作空间,然后进入工作空间再得到相应的东西,我
    们定义一个函数用来获取个人数据库的路径
    public  string  WsPath()
            {
     
                string WsFileName="";
     
                OpenFileDialog OpenFile = new OpenFileDialog();
     
                OpenFile.Filter = "个人数据库(MDB)|*.mdb";
     
                DialogResult DialogR = OpenFile.ShowDialog();
     
                if (DialogR == DialogResult.Cancel)
                {
                   
                }
                else
                {
     
                    WsFileName = OpenFile.FileName;
                }
     
     
                return WsFileName;
               
            }
    要获取要素类,首先要进入
    private void button2_Click(object sender, EventArgs e)
            {
                     string WsName = WsPath();
     
                if (WsName != "")
                {
     
                    IWorkspaceFactory pWsFt = new AccessWorkspaceFactoryClass();
     
                    IWorkspace pWs = pWsFt.OpenFromFile(WsName, 0);
     
                    IEnumDataset pEDataset = pWs.get_Datasets(esriDatasetType.esriDTAny);
     
                    IDataset pDataset = pEDataset.Next();
     
                    while (pDataset != null)
                    {
                        if (pDataset.Type ==esriDatasetType.esriDTFeatureClass)
                        {
                            FeatureClassBox.Items.Add(pDataset.Name);
                        }
                           //如果是数据集
                        else if (pDataset.Type == esriDatasetType.esriDTFeatureDataset)
                        {
                            IEnumDataset pESubDataset = pDataset.Subsets;
     
                            IDataset pSubDataset = pESubDataset.Next();
     
                            while (pSubDataset != null)
                            {
                                FeatureClassBox.Items.Add(pSubDataset.Name);
     
                                pSubDataset = pESubDataset.Next();
                            }
                        }
                       
     
     
                        pDataset = pEDataset.Next();
                    }
     
                }
     
                FeatureClassBox.Text = FeatureClassBox.Items[0].ToString();
    }

    判断要素是否被编辑
    IDatasetEdit.IsBeingEdited

  • 相关阅读:
    Pandas高级教程之:category数据类型
    Pandas高级教程之:处理缺失数据
    Pandas高级教程之:处理text数据
    密码学系列之:blowfish对称密钥分组算法
    架构之:数据流架构
    ES6中的新特性:Iterables和iterators
    密码学系列之:feistel cipher
    Pandas高级教程之:Dataframe的重排和旋转
    Electron实用技巧-electron-builder中用户协议(license)的使用及多语言支持
    Electron实用技巧-开机启动时隐藏主窗口,只显示系统托盘
  • 原文地址:https://www.cnblogs.com/qiushuixizhao/p/3242413.html
Copyright © 2011-2022 走看看