-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.vb
67 lines (57 loc) · 1.68 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraMap
Namespace AddItemsManually
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
' Create a map control with initial settings and add it to the form.
Dim map As New MapControl() With {
.Dock = DockStyle.Fill,
.ZoomLevel = 4,
.CenterPoint = New GeoPoint(43, 15)
}
Me.Controls.Add(map)
' Create a layer to load image tiles from OpenStreetMap.
Dim tileLayer As New ImageLayer()
tileLayer.DataProvider = New BingMapDataProvider()
map.Layers.Add(tileLayer)
' Create a layer to display vector items.
Dim itemsLayer As New VectorItemsLayer()
map.Layers.Add(itemsLayer)
' Create a storage for map items and generate them.
Dim storage As New MapItemStorage()
Dim capitals() As MapItem = GetCapitals()
storage.Items.AddRange(capitals)
itemsLayer.Data = storage
End Sub
' Create an array of callouts for 5 capital cities.
Private Function GetCapitals() As MapItem()
Return New MapItem() {
New MapCallout() With {
.Text = "London",
.Location = New GeoPoint(51.507222, -0.1275)
},
New MapCallout() With {
.Text = "Rome",
.Location = New GeoPoint(41.9, 12.5)
},
New MapCallout() With {
.Text = "Paris",
.Location = New GeoPoint(48.8567, 2.3508)
},
New MapCallout() With {
.Text = "Berlin",
.Location = New GeoPoint(52.52, 13.38)
},
New MapCallout() With {
.Text = "Madrid",
.Location = New GeoPoint(40.4, -3.68)
}
}
End Function
End Class
End Namespace