zzouc
路人甲
路人甲
  • 注册日期2011-04-10
  • 发帖数6
  • QQ
  • 铜币130枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2041回复:2

[求助]ArcEngine生成的点状图层不显示?

楼主#
更多 发布于:2011-04-19 23:23
<P>初学者高不清状况,望高手帮我耐心解答,谢谢!我的代码如下:</P>
<P>Dim pShpWksFact As IWorkspaceFactory = New ShapefileWorkspaceFactory()<BR>            Dim pFeatWks As IFeatureWorkspace<BR>            pFeatWks = CType(pShpWksFact.OpenFromFile(filePath, 0), IFeatureWorkspace)<BR>            Const strShapeFieldName As String = "Shape"<BR>            Dim pFields1 As IFields<BR>            Dim pFieldsEdit1 As IFieldsEdit<BR>            pFields1 = New FieldsClass()<BR>            pFieldsEdit1 = CType(pFields1, IFieldsEdit)<BR>            Dim pField1 As IField = New FieldClass()<BR>            Dim pFieldEdit1 As IFieldEdit = New FieldClass()<BR>            pFieldEdit1.Name_2 = strShapeFieldName<BR>            pFieldEdit1.Type_2 = esriFieldType.esriFieldTypeGeometry<BR>            pField1 = CType(pFieldEdit1, IField)<BR>            Dim pGeomDef1 As IGeometryDef = New GeometryDefClass()<BR>            Dim pGeomDefEdit1 As IGeometryDefEdit = New GeometryDefClass()<BR>            pGeomDefEdit1 = CType(pGeomDef1, IGeometryDefEdit)<BR>            pGeomDefEdit1.GeometryType_2 = esriGeometryType.esriGeometryPoint<BR>            pGeomDefEdit1.SpatialReference_2 = Main.AxMapControl1.Map.SpatialReference<BR>            pFieldEdit1.GeometryDef_2 = pGeomDef1<BR>            pFieldsEdit1.AddField(pField1)<BR>            pFields1 = CType(pFieldsEdit1, IFields)<BR>            Dim pFeatureClass1 As IFeatureClass<BR>            pFeatureClass1 = pFeatWks.CreateFeatureClass("点", pFields1, Nothing, Nothing, esriFeatureType.esriFTSimple, strShapeFieldName, "")<BR>            Dim pPointCol As IPointCollection = New MultipointClass()<BR><BR>            Dim sr As StreamReader = New StreamReader(My.Computer.FileSystem.CurrentDirectory ; "\shu\dianceng.txt")<BR><BR>            Dim str As String = sr.ReadLine()<BR>            Dim own As Long = 0<BR>            While str IsNot Nothing<BR>                Dim strs() As String = Regex.Split(str, "        ")<BR>                Dim x As Double = Convert.ToDouble(strs(0))<BR>                Dim y As Double = Convert.ToDouble(strs(1))<BR>                 Dim pPoint As IPoint = New PointClass()<BR>                pPoint.X = x<BR>                pPoint.Y = y<BR>                Dim missing As Object = Type.Missing<BR>                pPointCol.AddPoint(pPoint, missing, missing)<BR>                str = sr.ReadLine()<BR>            End While<BR>Main.AxMapControl1.AddShapeFile(filePath, "点")<BR>可我不知道生成的点状图层为什么不显示?</P>
喜欢0 评分0
zzouc
路人甲
路人甲
  • 注册日期2011-04-10
  • 发帖数6
  • QQ
  • 铜币130枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2011-04-21 13:34
<P>顶一下,防止沉没!</P>
举报 回复(0) 喜欢(0)     评分
zzouc
路人甲
路人甲
  • 注册日期2011-04-10
  • 发帖数6
  • QQ
  • 铜币130枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2011-04-22 10:36
<P><FONT face=Verdana>我在后面加了如下代码,可还是不显示点图,但这次属性表中有了信息!</FONT></P>
<P><FONT face=Verdana>Dim newFeature As IFeature = pFeatureClass1.CreateFeature</FONT></P>
<P><FONT face=Verdana>newFeature.Store()</FONT></P>
举报 回复(0) 喜欢(0)     评分
游客

返回顶部