1 if (pOutFtrClass == null) 2 { 3 //continue; 4 //创建featureclass 5 //得到规范的字段集 6 IFields pFields = pFeatureClass.Fields; 7 //在目标工作空间中创建要素类 8 IFieldChecker fieldChecker = new FieldCheckerClass(); 9 IEnumFieldError enumFieldError = null; 10 IFields validatedFields = null; 11 fieldChecker.ValidateWorkspace = pDataset.Workspace; 12 fieldChecker.Validate(pFields, out enumFieldError, out validatedFields); 13 pOutFtrClass = (pDataset.Workspace as IFeatureWorkspace).CreateFeatureClass((pFeatureClass as IDataset).Name, validatedFields, null, null, esriFeatureType.esriFTSimple, "SHAPE", ""); 14 //为此featureclass赋别名 15 IClassSchemaEdit classedit = pOutFtrClass as IClassSchemaEdit; 16 string aliasName = pFeatureClass.AliasName; 17 if (!string.IsNullOrEmpty(aliasName)) 18 { 19 classedit.AlterAliasName(aliasName); 20 } 21 //把此featureclass移动到目标数据集下 22 (pDataset as IDatasetContainer).AddDataset(pOutFtrClass as IDataset); 23 24 }
另,若要在
在sde的工作空间中.CreateFeatureClass需用 esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB许可