iwannafly
路人甲
路人甲
  • 注册日期2005-12-03
  • 发帖数35
  • QQ
  • 铜币274枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:4296回复:4

arcengine如何新建新图层

楼主#
更多 发布于:2006-09-13 11:18
<P>用arcengine如何新建一个全新图层呢?我想这应该还涉及到图层类型,图层数据结构的确立吧.大家有知道的请指教了!</P>
喜欢0 评分0
hsghxm
路人甲
路人甲
  • 注册日期2004-10-27
  • 发帖数517
  • QQ4604052
  • 铜币1枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2006-09-14 09:14
<P>CreateFeatureClass Method (esriGeoDatabase)</P>
<P><br>Example    <br>    </P>
<P>Creates a new standalone feature class under the workspace. </P>
<P>Syntax</P>
<P>Set variable = object.CreateFeatureClass (Name, Fields, CLSID, EXTCLSID, FeatureType, ShapeFieldName, ConfigKeyword )</P>
<P>The CreateFeatureClass method syntax has the following object qualifier and arguments:</P>
<P>Part Description <br>object An object expression that evaluates to an object in the Applies To list. <br>variable A reference to an object that implements IFeatureClass. <br>Name Required. A string expression that represents the Name. <br>Fields Required. An IFields object. <br>CLSID Required. An IUID object. <br>EXTCLSID Required. An IUID object. <br>FeatureType Required. An esriFeatureType constant whose value represents the FeatureType. <br>ShapeFieldName Required. A string expression that represents the ShapeFieldName. <br>ConfigKeyword Required. A string expression that represents the ConfigKeyword. <br></P>
MSN:hsghxm@163.com QQ:4604052 (很少用,最好别加) Email:hsghxm@163.com 我的BOLG:http://www.gisempire.com/blog/user1/864/index.htm
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
2楼#
发布于:2006-09-14 09:43
How to use: <BR>拷贝代码到你的 VB 或者 VBA 程序里.<BR>在你的程序里Call下面的函数.<BR>Public Sub CreateShapefile()<BR><BR>  Const strFolder As String = "D:\Data"<BR>  Const strName As String = "MyShapeFile" ' Dont include .shp extension<BR>  Const strShapeFieldName As String = "Shape"<BR>  <BR>  ' Open the folder to contain the shapefile as a workspace<BR>  Dim pFWS As IFeatureWorkspace<BR>  Dim pWorkspaceFactory As IWorkspaceFactory<BR>  Set pWorkspaceFactory = New ShapefileWorkspaceFactory<BR>  Set pFWS = pWorkspaceFactory.OpenFromFile(strFolder, 0)<BR>  <BR>  ' Set up a simple fields collection<BR>  Dim pFields As IFields<BR>  Dim pFieldsEdit As IFieldsEdit<BR>  Set pFields = New esriCore.Fields<BR>  Set pFieldsEdit = pFields<BR>  <BR>  Dim pField As IField<BR>  Dim pFieldEdit As IFieldEdit<BR>  <BR>  ' Make the shape field<BR>  ' it will need a geometry definition, with a spatial reference<BR>  Set pField = New esriCore.Field<BR>  Set pFieldEdit = pField<BR>  pFieldEdit.Name = strShapeFieldName<BR>  pFieldEdit.Type = esriFieldTypeGeometry<BR>  <BR>  Dim pGeomDef As IGeometryDef<BR>  Dim pGeomDefEdit As IGeometryDefEdit<BR>  Set pGeomDef = New GeometryDef<BR>  Set pGeomDefEdit = pGeomDef<BR>  With pGeomDefEdit<BR>    .GeometryType = esriGeometryPolygon<BR>    Set .SpatialReference = New UnknownCoordinateSystem<BR>  End With<BR>  Set pFieldEdit.GeometryDef = pGeomDef<BR>  pFieldsEdit.AddField pField<BR><BR>  ' Add another miscellaneous text field<BR>  Set pField = New esriCore.Field<BR>  Set pFieldEdit = pField<BR>  With pFieldEdit<BR>      .Length = 30<BR>      .Name = "MiscText"<BR>      .Type = esriFieldTypeString<BR>  End With<BR>  pFieldsEdit.AddField pField<BR>  <BR>  ' Create the shapefile<BR>  ' (some parameters apply to geodatabase options and can be defaulted as Nothing)<BR>  Dim pFeatClass As IFeatureClass<BR>  Set pFeatClass = pFWS.CreateFeatureClass(strName, pFields, Nothing, _<BR>                                           Nothing, esriFTSimple, strShapeFieldName, "")<BR>End Sub<BR>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
iwannafly
路人甲
路人甲
  • 注册日期2005-12-03
  • 发帖数35
  • QQ
  • 铜币274枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2006-09-17 11:01
<P>谢谢!!!</P>
<P>我已经按照sample里的例子用c#实现了</P>
<P>但是现在有这样一个问题,我之前做了地图编辑的功能,都是在打开mxd文件和shape文件的基础上对其进行编辑.但是现在要求全部数据存储到数据库中,用sde进行读取.那么该怎么样把图层加载到mapcontrol控件中呢?之前的地图编辑和其他功能都是对mapcontrol控件的图层进行操作的,如果用sde读取数据库的话原来的代码还能正常运行吗?</P>
<P>这个问题真是严重了,希望大家指导!!!!!!</P>
举报 回复(0) 喜欢(0)     评分
langyan8973
路人甲
路人甲
  • 注册日期2006-07-12
  • 发帖数90
  • QQ
  • 铜币456枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2006-11-07 11:02
谢谢gis,这个我正需要呢。<img src="images/post/smile/dvbbs/em04.gif" />
举报 回复(0) 喜欢(0)     评分
游客

返回顶部