示例#1
0
        /// <summary>
        /// 导出拓扑错误图形, 在指定要素数据集(IFeatureDataset)或工作空间(IWorkspace)新建要素类以保存拓扑错误图形
        /// </summary>
        /// <param name="topologyRule">拓扑规则</param>
        /// <param name="topology">拓扑</param>
        /// <param name="resultObject">指定的要素数据集(IFeatureDataset)或工作空间(IWorkspace),用于创建新要素类,保存拓扑错误图形</param>
        public static IFeatureClass TopoErrorToNewFeatureClass(this ITopologyRule topologyRule, ITopology topology, object resultObject, string resultClassName = null)
        {
            //获得指定拓扑规则类型的拓扑错误要素
            var errorFeatures = GetTopoErrorFeatures(topologyRule, topology);

            if (errorFeatures.Count < 1)
            {
                return(null);
            }

            //创建保存拓扑错误的要素类
            var feature = errorFeatures[0] as IFeature;
            var geoType = feature.Shape.GeometryType;

            if (string.IsNullOrEmpty(resultClassName))
            {
                resultClassName = topologyRule.TopologyRuleType.ToString();
            }

            IFeature tmpFeature         = errorFeatures[0] as IFeature;
            var      resultFeatureClass = FeatureClassEx.Create(resultObject, resultClassName,
                                                                tmpFeature.Shape.SpatialReference, geoType, new FieldsClass());

            //将拓扑错误要素存入要素类中
            TopoErrorInsertToFeatureClass(errorFeatures, resultFeatureClass);
            return(resultFeatureClass);
        }
示例#2
0
 /// <summary>
 /// 创建要素类
 /// </summary>
 /// <param name="name">要素类名称(如果为shapefile,不能包含文件扩展名".shp")</param>
 /// <param name="sptialRef">空间参考坐标系。若参数obj为IFeatureDataset则应赋值为null;否则不能为null,
 /// 可使用<see cref="SpatialRefOpt.CreateSpatialRef(esriSRProjCS4Type)"/>或其重载方法进行创建</param>
 /// <param name="geometryType">几何类型(点/线/面等)</param>
 /// <param name="fields">要创建的字段集(可以为null,该方法自动修改或加入OID和SHAPE字段以确保几何类型、坐标系与参数一致)</param>
 /// <returns></returns>
 public static IFeatureClass CreateFeatureClass(this IWorkspace workspace, string name, ISpatialReference sptialRef, esriGeometryType geometryType, IFields fields = null)
 {
     return(FeatureClassEx.Create(workspace, name, sptialRef, geometryType, fields));
 }
示例#3
0
 /// <summary>
 /// 创建要素类
 /// </summary>
 /// <param name="obj">IWorkspace、IFeatureWorkspace或IFeatureDataset对象,在该对象中创建要素类</param>
 /// <param name="name">要素类名称(如果为shapefile,不能包含文件扩展名".shp")</param>
 /// <param name="fields">要创建的字段集(必须包含SHAPE字段),可参考<see cref="FieldOpt.CreateBaseFields"/>等方法创建字段集</param>
 /// <returns></returns>
 public static IFeatureClass CreateFeatureClass(this IWorkspace workspace, string name, IFields fields)
 {
     return(FeatureClassEx.Create(workspace, name, fields));
 }