コード例 #1
0
 public ZFeatureClass(IFeatureClass fc)
 {
     if (fc == null)
     {
         throw new Exception("IFeatureClass不能为空");
     }
     featureClass = fc;
     zFields      = new ZFields(fc);
 }
コード例 #2
0
 /// <summary>
 /// 创建FeatureClass
 /// </summary>
 /// <param name="Name"></param>
 /// <param name="fieldsHelper"></param>
 /// <param name="iFeatureType"></param>
 /// <param name="ShapeFieldName"></param>
 /// <param name="ConfigKeyword"></param>
 public ZFeatureClass CreateFeatureClass(string Name, ZFields fields, FeatureType type = FeatureType.esriFTSimple, string ShapeFieldName = "SHAPE", string ConfigKeyword = "")
 {
     try
     {
         IFeatureWorkspace space = workspace as IFeatureWorkspace;
         IFeatureClass     fc    = space.CreateFeatureClass(Name, fields.Value, null, null, (esriFeatureType)type, ShapeFieldName, ConfigKeyword);
         return(new ZFeatureClass(fc));
     }
     catch (Exception ex)
     {
         Logger.log("ZWorkspace.CreateFeatureClass", ex);
         return(null);
     }
 }
コード例 #3
0
        /// <summary>
        /// 复制字段
        /// </summary>
        /// <param name="filter">是否过滤</param>
        /// <returns></returns>
        public ZFields Clone(bool filter = true)
        {
            List <ZField> _lst    = ZFieldList;
            ZFields       zFields = new ZFields();

            if (filter)
            {
                _lst = _lst.Where(delegate(ZField zField)
                {
                    return(!zField.Name.Contains("."));
                }).ToList();
            }
            _lst.ForEach(zField => zFields.AddField(zField.Clone()));
            return(zFields);
        }
コード例 #4
0
        /// <summary>
        /// 复制图层
        /// </summary>
        /// <param name="oldName"></param>
        /// <param name="newName"></param>
        /// <param name="copyReords">思否复制记录</param>
        public ZFeatureClass CopyFeatureClass(string oldName, string newName, bool copyReords = false)
        {
            ZFeatureClass oldFClass = OpenFeatureClass(oldName);

            if (oldFClass != null)
            {
                ZFields       fields    = oldFClass.zFields.Clone();
                ZFeatureClass newFClass = CreateFeatureClass(newName, fields, oldFClass.FeatureType, oldFClass.ShapeFieldName);
                if (copyReords)
                {
                    newFClass.CopyFrom(oldFClass);
                }
                return(newFClass);
            }
            return(null);
        }