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

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

Members

  All
Properties
Methods
Description
如何删除要素类   IFeatureWorkspace  接口介绍(1) CreateFeatureClass Creates a new standalone feature class under the workspace.
如何删除要素类   IFeatureWorkspace  接口介绍(1) CreateFeatureDataset Creates a new feature dataset.
如何删除要素类   IFeatureWorkspace  接口介绍(1) CreateQueryDef Create a query definition object.
如何删除要素类   IFeatureWorkspace  接口介绍(1) CreateRelationshipClass Creates a new relationship class.
如何删除要素类   IFeatureWorkspace  接口介绍(1) CreateTable Creates a new table.
如何删除要素类   IFeatureWorkspace  接口介绍(1) OpenFeatureClass Opens an existing feature class.
如何删除要素类   IFeatureWorkspace  接口介绍(1) OpenFeatureDataset Opens an existing feature dataset.
如何删除要素类   IFeatureWorkspace  接口介绍(1) OpenFeatureQuery Opens a feature dataset containing a single feature class defined by the specified Query.
如何删除要素类   IFeatureWorkspace  接口介绍(1) OpenRelationshipClass Opens an existing relationship class.
如何删除要素类   IFeatureWorkspace  接口介绍(1) OpenRelationshipQuery The table of a relationship join query.
如何删除要素类   IFeatureWorkspace  接口介绍(1) OpenTable Opens an existing table.
Classes that implement IFeatureWorkspace
Classes Description
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();
 
            } 
        }

 
上一篇:Redis --> Redis的接口介绍及使用


下一篇:iic接口介绍