24小时热门版块排行榜    

查看: 1355  |  回复: 10
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

zzahkj

木虫 (著名写手)

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

我刚刚接触这个,望高手给个详细解答,谢谢!我的代码如下,为什么我生成的点状图层不显示呢?
Dim pShpWksFact As IWorkspaceFactory = New ShapefileWorkspaceFactory()
            Dim pFeatWks As IFeatureWorkspace
            pFeatWks = CType(pShpWksFact.OpenFromFile(filePath, 0), IFeatureWorkspace)
            Const strShapeFieldName As String = "Shape"
            Dim pFields1 As IFields
            Dim pFieldsEdit1 As IFieldsEdit
            pFields1 = New FieldsClass()
            pFieldsEdit1 = CType(pFields1, IFieldsEdit)
            Dim pField1 As IField = New FieldClass()
            Dim pFieldEdit1 As IFieldEdit = New FieldClass()
            pFieldEdit1.Name_2 = strShapeFieldName
            pFieldEdit1.Type_2 = esriFieldType.esriFieldTypeGeometry
            pField1 = CType(pFieldEdit1, IField)
            Dim pGeomDef1 As IGeometryDef = New GeometryDefClass()
            Dim pGeomDefEdit1 As IGeometryDefEdit = New GeometryDefClass()
            pGeomDefEdit1 = CType(pGeomDef1, IGeometryDefEdit)
            pGeomDefEdit1.GeometryType_2 = esriGeometryType.esriGeometryPoint
            pGeomDefEdit1.SpatialReference_2 = Main.AxMapControl1.Map.SpatialReference
            pFieldEdit1.GeometryDef_2 = pGeomDef1
            pFieldsEdit1.AddField(pField1)
            pFields1 = CType(pFieldsEdit1, IFields)
            Dim pFeatureClass1 As IFeatureClass
            pFeatureClass1 = pFeatWks.CreateFeatureClass("点", pFields1, Nothing, Nothing, esriFeatureType.esriFTSimple, strShapeFieldName, "" )
            Dim pPointCol As IPointCollection = New MultipointClass()

            Dim sr As StreamReader = New StreamReader(My.Computer.FileSystem.CurrentDirectory & "\shu\dianceng.txt" )

            Dim str As String = sr.ReadLine()
            Dim own As Long = 0
            While str IsNot Nothing
                Dim strs() As String = Regex.Split(str, "        " )
                Dim x As Double = Convert.ToDouble(strs(0))
                Dim y As Double = Convert.ToDouble(strs(1))
                 Dim pPoint As IPoint = New PointClass()
                pPoint.X = x
                pPoint.Y = y
                Dim missing As Object = Type.Missing
                pPointCol.AddPoint(pPoint, missing, missing)
                str = sr.ReadLine()
            End While
Main.AxMapControl1.AddShapeFile(filePath, "点" )

[ Last edited by zzahkj on 2011-4-19 at 23:29 ]
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

不要迷恋哥,哥只是一个过客!
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yanggis

木虫 (著名写手)

小木虫GIS家族族长

【答案】应助回帖

如果你仅仅就这一个数据集,那就到ArcMap中直接生成显示就可以了。没必要写程序。如果有很多数据集》100个。可以自己先学一下再做。没有调试环境,没法给你说哪里错了。
4楼2011-04-21 19:49:05
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 11 个回答

zzahkj

木虫 (著名写手)

太不给力了,没人理!
不要迷恋哥,哥只是一个过客!
2楼2011-04-21 09:52:01
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xiangling1

金虫 (正式写手)

【答案】应助回帖

zzahkj(金币+1): 2011-04-28 14:02:48
应该是后面的程序问题,你生成的点集没有添加到图层当中!
Dim pPointCol As IPointCollection = New MultipointClass()
......
pPointCol.AddPoint(pPoint, missing, missing);
后面应该加东西
黄沙百战穿金甲,不破楼兰终不还!
3楼2011-04-21 18:59:13
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yanggis

木虫 (著名写手)

小木虫GIS家族族长

【答案】应助回帖

zzahkj(金币+9): 1 2011-04-28 14:03:05
engine 中编辑数据要从StartEditing开始,然后Creat feature,然后写入属性。最后Stopediting(true),保存编辑才行。
5楼2011-04-21 19:50:38
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 为什么国自然不能直接公布 +5 bjdxyxy 2026-08-26 5/250 2026-09-01 17:54 by 小伟大博士
[文学芳草园] 梦想 +5 myrtle 2026-08-26 7/350 2026-09-01 15:18 by myrtle
[论文投稿] 小白求助 投论文要求的highlights应该如何写 5+3 l1963982152 2026-08-29 4/200 2026-09-01 09:04 by 北京莱茵编辑
[基金申请] 麻烦专家们看看评委们的意见(F口面上) +7 gdd2018 2026-08-28 12/600 2026-09-01 08:32 by 尼古拉斯小虫
[基金申请] 怎么看青基中了没有啊 +6 叶九微 2026-08-26 6/300 2026-08-31 23:54 by yudaoqian88
[基金申请] 国社科又开始会评了,不知道这次命运如何 +7 雨打竹帘 2026-08-30 11/550 2026-08-31 23:16 by hittle2008
[基金申请] 基金未中,这种答复是模板吗? +6 zhaosm1982 2026-08-27 7/350 2026-08-31 21:18 by qdxxmc
[基金申请] 哪位高人中了,把查询到的截图贴出来让我看看,让我长长见识 +6 yuleib84 2026-08-26 7/350 2026-08-31 19:46 by 鱼翔浅底1
[基金申请] 中青基了要发朋友圈吗? +7 349506619 2026-08-28 7/350 2026-08-31 13:39 by 冼亮淀粉酶
[基金申请] 基金不中,共勉 +12 eulota 2026-08-26 12/600 2026-08-31 08:42 by ZJTJZ
[基金申请] 为什么到现在没收到通知? +5 tannykie 2026-08-29 5/250 2026-08-30 21:05 by purplejack
[基金申请] 国自然评审意见 +13 wangmingqi 2026-08-28 19/950 2026-08-29 10:22 by Poppy1104
[基金申请] 2026年叶企孙基金 +4 bud_bud 2026-08-27 7/350 2026-08-29 07:23 by foolishmani
[基金申请] 基金系统什么内容也没有 30+4 winsaint 2026-08-27 9/450 2026-08-28 11:06 by maolC
[基金申请] 看板上这么多中的,有点像50人群里49个人都是骗子的那种感觉…… +5 a089 2026-08-26 6/300 2026-08-27 14:05 by jonewore
[基金申请] 国合里面能看到了 +7 一怀馨秋 2026-08-26 7/350 2026-08-26 11:23 by zhaosm1982
[基金申请] 国际合作可查了,中了面上 (EPI+1)(金币+50) +18 Ldrop2023 2026-08-26 18/900 2026-08-26 11:15 by cmrandy
[基金申请] 系统进不去 +4 yanglien 2026-08-26 5/250 2026-08-26 11:10 by wenfengw83
[基金申请] 国合可查了 +3 paperzjh 2026-08-26 3/150 2026-08-26 10:41 by LemmonTr
[基金申请] 牛来!米来!面来! +8 beefly 2026-08-26 8/400 2026-08-26 08:37 by xuzhipiao
信息提示
请填处理意见