如何创建一个要素数据类
创建要素类用到了IFeatureWorkspace.CreateFeatureClass方法,在这个方法中有众多的参数,为了满足这些参数,我们要学习和了解下面的接口.
IField,IFieldEdit,IFields,IFieldsEditI,GeometryDef,IGeometryDefEdit接口
字段对应表中的一列,一个要素类必须有至少2个字段,而多个字段的集合就构成了字段集,在要素类中,有一个特殊的字段,描述了空间对象,我们称之为几何字段,其中GeometryDef是用来设计几何字段的。这个几何字段定义了要素类的类型,比如说我们要在Catalog创建一个点要素类,那么我们必须指定他的类型为Point。

而上面这6个接口,其实是三类,以Edit结尾的接口是可写的,也就是说对字段,字段集合,以及几何字段的编辑都是通过后者完成的。空间数据的一个重要属性就是参考系,参考系也是在GeometryDef中定义的。
注意 在NET中,会遇到以“_2”结尾的属性,这些属性是可写的。

IGeometryDefEdit Interface接口

Members

  All
Properties
Methods
Inherited
Non-inherited
Description
AvgNumPoints The estimated average number of points per feature.
AvgNumPoints The estimated average number of points per feature.
GeometryType The enumerated geometry type.
GeometryType The geometry type.
GridCount The number of spatial index grids.
GridCount The number of spatial index grids.
GridSize The size of a spatial index grid.
GridSize The size of a spatial index grid.
HasM Indicates if the feature class has measure (M) values.
HasM Indicates if the feature class will support M values.
HasZ Indicates if the feature class will support Z values.
HasZ Indicates if the featureClass has Z values.
SpatialReference The spatial reference for the dataset.
SpatialReference The spatial reference of the dataset.

Inherited Interfaces

Interfaces Description
IGeometryDef Provides access to members that return information about the geometry definition.
 

Classes that implement IGeometryDefEdit

Classes Description
GeometryDef ESRI Geometry Definition object.

//定义一个几何字段,类型为点类型
             ISpatialReference pSpatialReference = axMapControl1.ActiveView.FocusMap.SpatialReference; //空间参考系
 
             IGeometryDefEdit pGeoDef = new GeometryDefClass();
             IGeometryDefEdit pGeoDefEdit = pGeoDef as IGeometryDefEdit;
             pGeoDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint;
             pGeoDefEdit.SpatialReference_2 = pSpatialReference;
 
             //定义一个字段集合对象
             IFields pFields = new FieldsClass();
             IFieldsEdit pFieldsEdit = (IFieldsEdit)pFields;
 
             //定义单个的字段
             IField pField = new FieldClass();
             IFieldEdit pFieldEdit = (IFieldEdit)pField;
 
             pFieldEdit.Name_2 = "SHAPE";
             pFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;
             pFieldsEdit.AddField(pField);
             pFieldEdit.GeometryDef_2 = pGeoDef;
 
             //定义单个的字段,并添加到字段集合中
             pField = new FieldClass();
             pFieldEdit = (IFieldEdit)pField;
             pFieldEdit.Name_2 = "STCD";
             pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
             pFieldsEdit.AddField(pField);
 
             //定义单个的字段,并添加到字段集合中
             pField = new FieldClass();
             pFieldEdit = (IFieldEdit)pField;
             pFieldEdit.Name_2 = "SLM10";
             pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
             pFieldsEdit.AddField(pField);
             //定义单个的字段,并添加到字段集合中
             pField = new FieldClass();
             pFieldEdit = (IFieldEdit)pField;
             pFieldEdit.Name_2 = "SLM20";
             pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
             pFieldsEdit.AddField(pField);
             //定义单个的字段,并添加到字段集合中
             pField = new FieldClass();
             pFieldEdit = (IFieldEdit)pField;
             pFieldEdit.Name_2 = "SLM40";
             pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
             pFieldsEdit.AddField(pField);
 
             IWorkspaceFactory pFtWsFct = new AccessWorkspaceFactory();
 
             IFeatureWorkspace pWs = pFtWsFct.OpenFromFile(@"E:\arcgis\Engine\s.mdb", 0) as
IFeatureWorkspace;
 
 
             IFeatureClass pFtClass = pWs.CreateFeatureClass("Test", pFields, null, null,
esriFeatureType.esriFTSimple, "SHAPE", null)

如何创建一个要素数据类 IField,IFieldEdit,IFields,IFieldsEditI,GeometryDef,IGeometryDefEdit接口的更多相关文章

  1. 编写Java程序,创建一个父类交通工具类(Vehicles),以及两个子类,分别是轿车类(Car)和卡车类(Truck)。

    返回本章节 返回作业目录 需求说明: 创建一个父类交通工具类(Vehicles),以及两个子类,分别是轿车类(Car)和卡车类(Truck). 父类有属性品牌(brand)和颜色(color). 在父 ...

  2. 编写Java程序,创建一个数学工具类,将该类设计为final类,Final 修饰符的使用。

    返回本章节 返回作业目录 需求说明: 创建一个数学工具类. 将该类设计为final类. 将该类的构造方法的访问权限定义为私有,以防止外界实例化该类. 在该类定义静态double类型常量π,其值为3.1 ...

  3. entity framework 6 我写了一个公用数据类

    public class BaseDAL { string strConn = ""; public BaseDAL(string connString) { strConn = ...

  4. 【iOS开展-50】使用它来创建一个新的类的实现代码包,因此,不自觉地练习简单MVC实验,附带动画

    接下来说说代码封装最后一个个案. 最后一种情况看:[iOS开展-48]九宫格案例:自己主动布局.字典转模型运用.id和instancetype差别.xib反复视图运用及与nib关系 (1)代码封装的原 ...

  5. (转载)使用SQL-Server创建一个银行数据管理系统Ⅰ

    首先,要创建一个完整的数据管理系统,不是一蹴而就的,一定要要一步一步的来,不断完善,最终方能达到自己想要的结果,所以我在这里也是一点一点分步来做的. 创建数据库,数据库属性在这里用的是默认(不推荐使用 ...

  6. 创建一个动作-Action类:

    让我们创建一个Java文件HelloWorldAction.java的Java资源> SRC下一个的包名com.yiibai.struts2与下面的内容. package com.yiibai. ...

  7. UE4编程之C++创建一个FPS工程(二)角色网格、动画、HUD、子弹类

    转自:http://blog.csdn.net/u011707076/article/details/44243103 紧接上回,本篇文章将和大家一同整理总结UE4关于角色网格.动画.子弹类和HUD的 ...

  8. UE4的编程C++创建一个FPSproject(两)角色网格、动画、HUD、子弹类

    立即归还,本文将总结所有这些整理UE4有关角色的网络格.动画.子弹类HUD一个简单的实现. (五)角色加入网格 Character类为我们默认创建了一个SkeletaMeshComponent组件,所 ...

  9. 创建一个抽象的员工类, 抽象开发累继承员工类,JavaEE ,和安卓继承开发类在测试类中进行测试

    /* 1 定义一个员工类  所有的子类都抽取(抽象类)  Employee            属性:姓名  工号(生成get  set  )       方法:工作  抽象     2 定义一个研 ...

随机推荐

  1. .net项目svn项目管理文件清单

    You can add the following files to Visual Studio source control: Solution files (*.sln). Project fil ...

  2. 关于table参数的一些问题

    1.关于单元格合并 写在td标签上,如: <td rowspan="3"></td> 跨行合并:rowspan 跨列合并:colspan 2.关于多行输入框 ...

  3. ubuntu 设置vpn

    百度了资料 http://jingyan.baidu.com/article/fa4125aca7f1b628ad709271.html 1. 设置 VPN CONNECTION 2.configur ...

  4. 百度,google的地理编码

    1.百度的地理编码:(不支持中国以外的其它城市) http://api.map.baidu.com/geocoder/v2/?ak=E974997f80db18330f8f5c61d084a677&a ...

  5. LightOJ 1336 Sigma Function 算数基本定理

    题目大意:f(n)为n的因子和,给出 n 求 1~n 中f(n)为偶数的个数. 题目思路:算数基本定理: n=p1^e1*p2^e1 …… pn^en (p为素数): f(n)=(1+p1+p1^2+ ...

  6. HDU<1372>/bfs

    题目连接 简单bfs搜索 #include <set> #include <map> #include <cmath> #include <queue> ...

  7. 设计模式-中介者模式(Mediator)

    /***中介者模式在消息队列中的应用*/package test.mediator; public abstract class Message { private Messages messages ...

  8. 视频 -> 帧 浅析

    原创:转载请注明出处 关于帧率 首先以下几个概念必须弄清楚 1.一个帧就是一个画面 2.视频有无数个帧组成 3.表达时间的量  CMTime 的定义: typedef struct { CMTimeV ...

  9. ReactiveCocoa 用法实例

      我个人非常推崇ReactiveCocoa,它就像中国的太极,太极生两仪,两仪生四象,四象生八卦,八卦生万物.ReactiveCocoa是一个高度抽象的编程框架,它真的很抽象,初看你不知道它是要干嘛 ...

  10. C语言版的16进制与字符串互转函数

    http://www.cnblogs.com/nio-nio/p/3309367.html /* // C prototype : void StrToHex(BYTE *pbDest, BYTE * ...