• 如何删除要素类 IFeatureWorkspace 接口介绍(1)


    如何删除要素类
    要想删除一个要素类,那么必须先得到这个,在得到这个要素类的时候,我们要学习一个新的接口IFeatureWorkspace。
    IFeatureWorkspace  接口介绍
    这个接口主要是用于管理基于矢量数据的,如表,,要素类,要素数据集等。

    Members

     Description
    Method CreateFeatureClass Creates a new standalone feature class under the workspace.
    Method CreateFeatureDataset Creates a new feature dataset.
    Method CreateQueryDef Create a query definition object.
    Method CreateRelationshipClass Creates a new relationship class.
    Method CreateTable Creates a new table.
    Method OpenFeatureClass Opens an existing feature class.
    Method OpenFeatureDataset Opens an existing feature dataset.
    Method OpenFeatureQuery Opens a feature dataset containing a single feature class defined by the specified Query.
    Method OpenRelationshipClass Opens an existing relationship class.
    Method OpenRelationshipQuery The table of a relationship join query.
    Method OpenTable Opens an existing table.
    Classes that implement IFeatureWorkspace
    ClassesDescription
    Sde3Workspace (esriDataSourcesGDB) ESRI SDE (3.x) Feature Database.
    Sde4Workspace (esriDataSourcesGDB) ESRI SDE (4.x) Feature Database.
    VersionedWorkspace VersionedWorkspace Object.
    Workspace Workspace Object.

     OpenDataset,OpenTable,OpenFeatureClass都是要传入一个相应的名称,如要打开一个名称为PointTest的要素类,只需要在OpenFeatureClass中传入这个要素类的名称,代码如下:
        IWorkspaceFactory pWsFt = new AccessWorkspaceFactoryClass(); 
          IWorkspace pWs = pWsFt.OpenFromFile(WsName, 0); 
        IFeatureWorkspace pFWs = pWs as  IFeatureWorkspace;
     
                    IFeatureClass pFClass = pFWs.OpenFeatureClass("PointTest");
     
    如果是在ArcMap中,我们会切换到Catalog中然后进入相应的数据库,然后删除相应的要素类,这种操作会让我们想到FeatureClas这个对象会提供删除的方法,其实不然,这个删除的方法是定义在Dataset这
    个对象中。
    private void button1_Click(object sender, EventArgs e)
            {
                string WsName = WsPath();
     
                if( WsName !="")
                {
     
     
                    IWorkspaceFactory pWsFt = new AccessWorkspaceFactoryClass();
     
                    IWorkspace pWs = pWsFt.OpenFromFile(WsName, 0);
     
                    IFeatureWorkspace pFWs = pWs as  IFeatureWorkspace;
     
                    IFeatureClass pFClass = pFWs.OpenFeatureClass("PointTest");
     
                    IDataset pDatset = pFClass as IDataset;
     
                    pDatset.Delete();
     
                } 
            }

     

     
  • 相关阅读:
    luogu P4009 汽车加油行驶问题
    luogu P4015 运输问题
    luogu P2763 试题库问题
    luogu P4011 孤岛营救问题
    luogu P2765 魔术球问题
    linux 网卡
    linux yum错误
    ubuntu登录备注信息
    Ubuntu网卡配置
    linux 走三层内网添加静态路由
  • 原文地址:https://www.cnblogs.com/qiushuixizhao/p/3242585.html
Copyright © 2020-2023  润新知