| 查看: 1114 | 回復(fù): 10 | ||
zzahkj木蟲 (著名寫手)
龍
|
[求助]
Vb.net+ArcEngine生成的點(diǎn)狀圖層不顯示?
|
|
我剛剛接觸這個(gè),望高手給個(gè)詳細(xì)解答,謝謝!我的代碼如下,為什么我生成的點(diǎn)狀圖層不顯示呢? 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("點(diǎn)", 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, "點(diǎn)" ) [ Last edited by zzahkj on 2011-4-19 at 23:29 ] |

木蟲 (著名寫手)
龍

金蟲 (正式寫手)

木蟲 (著名寫手)
小木蟲GIS家族族長
木蟲 (著名寫手)
小木蟲GIS家族族長
木蟲 (著名寫手)
龍
|
我后面加了些代碼,你看為什么出現(xiàn)未將對(duì)象引用設(shè)置到對(duì)象的實(shí)例的錯(cuò)誤! 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ā)表 | |
|---|---|---|---|---|
|
[考研] 317求調(diào)劑 +12 | 申子申申 2026-03-19 | 18/900 |
|
|---|---|---|---|---|
|
[考研] 一志愿西安交通大學(xué)材料工程專業(yè) 282分求調(diào)劑 +11 | 楓橋ZL 2026-03-18 | 13/650 |
|
|
[考研] 招08考數(shù)學(xué) +4 | laoshidan 2026-03-20 | 8/400 |
|
|
[考研] 287求調(diào)劑 +8 | 晨昏線與星海 2026-03-19 | 9/450 |
|
|
[考研] 能源材料化學(xué)課題組招收碩士研究生8-10名 +5 | 脫穎而出 2026-03-16 | 17/850 |
|
|
[考研] 求調(diào)劑 +7 | Auroracx 2026-03-22 | 7/350 |
|
|
[考研] 一志愿華中科技大學(xué)071000,求調(diào)劑 +4 | 沿岸有貝殼6 2026-03-21 | 4/200 |
|
|
[考研] 286分人工智能專業(yè)請(qǐng)求調(diào)劑愿意跨考! +4 | lemonzzn 2026-03-17 | 8/400 |
|
|
[考研] 初試 317 +7 | 半拉月丙 2026-03-20 | 7/350 |
|
|
[考研]
|
Grand777 2026-03-21 | 3/150 |
|
|
[考研] 求調(diào)劑 +3 | 13341 2026-03-20 | 3/150 |
|
|
[基金申請(qǐng)]
學(xué)校已經(jīng)提交到NSFC,還能修改嗎?
40+4
|
babangida 2026-03-19 | 9/450 |
|
|
[考研] 316求調(diào)劑 +6 | 梁茜雯 2026-03-19 | 6/300 |
|
|
[考研] 321求調(diào)劑 +9 | 何潤采123 2026-03-18 | 11/550 |
|
|
[考研] A區(qū)線材料學(xué)調(diào)劑 +5 | 周周無極 2026-03-20 | 5/250 |
|
|
[考研] 一志愿 南京航空航天大學(xué)大學(xué) ,080500材料科學(xué)與工程學(xué)碩 +5 | @taotao 2026-03-20 | 5/250 |
|
|
[考研] 085601材料工程專碩求調(diào)劑 +10 | 慕寒mio 2026-03-16 | 10/500 |
|
|
[考研] 本科鄭州大學(xué)物理學(xué)院,一志愿華科070200學(xué)碩,346求調(diào)劑 +4 | 我不是一根蔥 2026-03-18 | 4/200 |
|
|
[考研] 312求調(diào)劑 +8 | 陌宸希 2026-03-16 | 9/450 |
|
|
[考研] 材料,紡織,生物(0856、0710),化學(xué)招生啦 +3 | Eember. 2026-03-17 | 9/450 |
|