コード例 #1
0
 /// <summary>
 /// 复制
 /// </summary>
 /// <returns></returns>
 public ZField Clone()
 {
     if (field.Type == esriFieldType.esriFieldTypeGeometry)
     {
         IGeometryDef      pGeoDefEdit = field.GeometryDef;
         ZSpatialReference sr          = new ZSpatialReference(pGeoDefEdit.SpatialReference);
         return(new ZField((GeometryType)pGeoDefEdit.GeometryType, sr, field.Name));
     }
     else
     {
         return(new ZField(field.Name, field.AliasName, (Enum.FieldType)field.Type, field.Length, field.Precision, field.IsNullable, field.Editable, field.DefaultValue));
     }
 }
コード例 #2
0
        /// <summary>
        /// 创建图形字段
        /// </summary>
        /// <param name="geoType"></param>
        /// <param name="sr"></param>
        /// <param name="name"></param>
        public ZField(GeometryType geoType, ZSpatialReference sr, string name = "SHAPE")
        {
            field = new FieldClass();
            IFieldEdit pFieldEdit = (IFieldEdit)field;

            pFieldEdit.Name_2 = name;
            pFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;
            //设置图形类型
            IGeometryDefEdit pGeoDef     = new GeometryDefClass();
            IGeometryDefEdit pGeoDefEdit = pGeoDef as IGeometryDefEdit;

            pGeoDefEdit.GeometryType_2 = (esriGeometryType)geoType;
            if (sr != null)
            {
                pGeoDefEdit.SpatialReference_2 = sr.Value;
            }
            pFieldEdit.GeometryDef_2 = pGeoDef;
        }
コード例 #3
0
        /// <summary>
        /// 添加图形字段
        /// </summary>
        /// <param name="geoType"></param>
        /// <param name="srHelper"></param>
        /// <param name="name"></param>
        public void AddShapeField(GeometryType geoType, ZSpatialReference sr, string name = "SHAPE")
        {
            ZField zfield = new ZField(geoType, sr, name);

            AddField(zfield);
        }