This repository has been archived by the owner on Jun 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Form1.vb
46 lines (44 loc) · 1.95 KB
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Imports DevExpress.XtraMap
Imports System
Imports System.Collections.Generic
Imports System.Windows.Forms
Namespace BingElevationData
Partial Public Class Form1
Inherits Form
Private ReadOnly Property layer() As InformationLayer
Get
Return CType(mapControl.Layers(1), InformationLayer)
End Get
End Property
Private ReadOnly Property vectorLayer() As VectorItemsLayer
Get
Return CType(mapControl.Layers(2), VectorItemsLayer)
End Get
End Property
Private ReadOnly Property provider() As BingElevationDataProvider
Get
Return CType(layer.DataProvider, BingElevationDataProvider)
End Get
End Property
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
AddHandler provider.ElevationsCalculated, AddressOf OnElevationCalculated
provider.GenerateLayerItems = False
Dim locations As New List(Of GeoPoint)() From { _
New GeoPoint(41.145556, -73.995), _
New GeoPoint(36.131389, -95.937222), _
New GeoPoint(36.175, -115.136389) _
}
provider.RequestPointsElevations(locations)
End Sub
Private Sub OnElevationCalculated(ByVal sender As Object, ByVal e As ElevationsCalculatedEventArgs)
Dim storage As New MapItemStorage()
For Each elevationInformation As ElevationInformation In e.Result.Locations
storage.Items.Add(New MapCallout() With {.Text = String.Format("{0}" & ControlChars.Lf & "Elevation = {1} m", elevationInformation.Location, elevationInformation.Elevation), .Location = elevationInformation.Location})
Next elevationInformation
vectorLayer.Data = storage
End Sub
End Class
End Namespace