| 查看: 1113 | 回復: 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 ] |

木蟲 (著名寫手)
龍

金蟲 (正式寫手)

木蟲 (著名寫手)
小木蟲GIS家族族長
木蟲 (著名寫手)
小木蟲GIS家族族長
木蟲 (著名寫手)
龍
|
我后面加了些代碼,你看為什么出現(xiàn)未將對象引用設置到對象的實例的錯誤! Dim i As Integer = 0 If i < pPointCol.PointCount Then Dim newFeature As IFeature = pFeatureClass1.CreateFeature newFeature._Set_Shape.pPointCol(i) Dim rowSubtypes As IRowSubtypes = newFeature rowSubtypes.Set_SubtypeCode(1) rowSubtypes.InitDefaultValues() newFeature.Store() End If i = i + 1 End While 這段代碼是我根據(jù)一段C#代碼改的,我也不知道有什么問題? |

金蟲 (正式寫手)

木蟲 (著名寫手)
龍

木蟲 (著名寫手)
小木蟲GIS家族族長
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 284求調(diào)劑 +5 | Zhao anqi 2026-03-22 | 5/250 |
|
|---|---|---|---|---|
|
[考研] 287求調(diào)劑 +8 | 晨昏線與星海 2026-03-19 | 9/450 |
|
|
[考研] 一志愿 西北大學 ,070300化學學碩,總分287,雙非一本,求調(diào)劑。 +3 | 晨昏線與星海 2026-03-20 | 3/150 |
|
|
[考研] 298求調(diào)劑一志愿211 +3 | 上岸6666@ 2026-03-20 | 3/150 |
|
|
[考研] 291 求調(diào)劑 +3 | 化工2026屆畢業(yè)?/a> 2026-03-21 | 3/150 |
|
|
[考研] 302求調(diào)劑 +12 | 呼呼呼。。。。 2026-03-17 | 12/600 |
|
|
[考研] 一志愿重慶大學085700資源與環(huán)境總分308求調(diào)劑 +7 | 墨墨漠 2026-03-20 | 7/350 |
|
|
[考研] 22 350 本科985求調(diào)劑,求老登收留 +3 | 李軼男003 2026-03-20 | 3/150 |
|
|
[考研] 求調(diào)劑 +3 | 白QF 2026-03-21 | 3/150 |
|
|
[考研] 一志愿武理材料305分求調(diào)劑 +6 | 想上岸的鯉魚 2026-03-18 | 7/350 |
|
|
[考研] 一志愿西南交大,求調(diào)劑 +5 | 材化逐夢人 2026-03-18 | 5/250 |
|
|
[考研] 材料專業(yè)求調(diào)劑 +6 | hanamiko 2026-03-18 | 6/300 |
|
|
[考研] 一志愿中海洋材料工程專碩330分求調(diào)劑 +8 | 小材化本科 2026-03-18 | 8/400 |
|
|
[考研] 288求調(diào)劑 +16 | 于海海海海 2026-03-19 | 16/800 |
|
|
[考研] 0817 化學工程 299分求調(diào)劑 有科研經(jīng)歷 有二區(qū)文章 +22 | rare12345 2026-03-18 | 22/1100 |
|
|
[考研] 261求B區(qū)調(diào)劑,科研經(jīng)歷豐富 +3 | 牛奶很忙 2026-03-20 | 4/200 |
|
|
[考研] 材料與化工專碩調(diào)劑 +7 | heming3743 2026-03-16 | 7/350 |
|
|
[考研] 0854可跨調(diào)劑,一作一項核心論文五項專利,省、國級證書40+數(shù)一英一287 +8 | 小李0854 2026-03-16 | 8/400 |
|
|
[考博] 26申博 +4 | 八6八68 2026-03-16 | 4/200 |
|
|
[考研] 333求調(diào)劑 +3 | 文思客 2026-03-16 | 7/350 |
|