This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
/
Form1.vb
49 lines (43 loc) · 1.72 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
Imports DevExpress.XtraMap
Imports System
Imports System.Collections.Generic
Imports System.Globalization
Imports System.Windows.Forms
Imports System.Xml.Linq
Namespace CustomClustererSample
Partial Public Class Form1
Inherits Form
Private ReadOnly Property VectorLayer() As VectorItemsLayer
Get
Return CType(map.Layers("VectorLayer"), VectorItemsLayer)
End Get
End Property
Private ReadOnly Property DataAdapter() As ListSourceDataAdapter
Get
Return CType(VectorLayer.Data, ListSourceDataAdapter)
End Get
End Property
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
AddHandler VectorLayer.DataLoaded, Sub(obj, args)
map.ZoomToFitLayerItems()
End Sub
DataAdapter.DataSource = LoadData()
DataAdapter.Clusterer = New CureClusterer()
End Sub
Private Function LoadData() As List(Of Tree)
Dim trees As New List(Of Tree)()
Dim doc As XDocument = XDocument.Load("Data\treesCl.xml")
For Each xTree As XElement In doc.Element("RowSet").Elements("Row")
trees.Add(New Tree With { _
.Latitude = Convert.ToDouble(xTree.Element("lat").Value, CultureInfo.InvariantCulture), _
.Longitude = Convert.ToDouble(xTree.Element("lon").Value, CultureInfo.InvariantCulture), _
.LocationName = xTree.Element("location").Value _
})
Next xTree
Return trees
End Function
End Class
End Namespace