ArcEngine获取mdb下要素类FeatureClass,独立要素类,没有dataset获取要素类

功能说明

ArcEngine获取mdb下要素类FeatureClass,独立要素类,没有dataset获取要素类

获取mdb数据库要素类的名称


1.通过IWorkspace的Datasets属性获取工作空间中的所有Dataset对象(IEnumDataset)
2.枚举EnumDataset,获取Dataset对象
3.如果该Dataset是FeatureDataset
4.QI到IFeatureClassContainer接口
for(int i=0;i < pFClContainer.ClassCount;i++)
{
   IFeatureClass pFeatureClass= pFClContainer.Class(i);
   IDataset pDataset = pFeatureClass as IDataset;
   string pFeaClsName= pDataset.Name;
   ……
}

获取独立于要素数据集的要素类

/// <summary>  
/// 获取独立的要素类  
/// </summary>  
/// <param name="IN_SomeFeatureDataset">工作空间下任意一个要素数据集</param>  
/// <param name="IN_FeatureClassName">独立要素类的名称</param>  
/// <returns>找的的独立要素类</returns>  
private IFeatureClass PRV_GetIndependentFeatureClass(IFeatureDataset IN_SomeFeatureDataset,string IN_FeatureClassName)  
{  
        //获取所有独立的要素类  
        IEnumDataset Temp_AllIndependentFeatureClass=(IN_SomeFeatureDataset.Workspace.get_Datasets(esriDatasetType.esriDTFeatureClass));  
        //获取每一个独立的要素类  
        IFeatureClass Each_IndependentFeatureClass = Temp_AllIndependentFeatureClass.Next() as IFeatureClass;  
        //遍历所有要素类  
        while (Each_IndependentFeatureClass != null)  
        {  
            //如果找到了就返回  
            if (Each_IndependentFeatureClass.AliasName==IN_FeatureClassName)  
                return Each_IndependentFeatureClass;  
        }  
        return null;  
}

You may also like...

1 Response

  1. I appreciate you sharing this blog post. Thanks Again. Cool.

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

CAPTCHAis initialing...