jj 02.12.16 frmGeodataSelect

This commit is contained in:
JenneJ
2016-12-02 14:33:55 +01:00
parent 57517ffed8
commit 29abb10c1b
6 changed files with 495 additions and 33 deletions

View File

@@ -0,0 +1,76 @@
Imports DevExpress.XtraMap
Public Class frmGeodataSelect
Public SelectedPoint As GeoPoint = Nothing
Private BING_KEY As String = "hQUTlqLLK70bETnonpfi~0jx1pIAq1yQ7gXqbIyzKrg~Au-Tewbty8afAxdbNilSv4JlU7qwU-fQKu0ouH9e1uJmpIyVdA3jugVEWMdy1Rbt"
Private ReadOnly Property ImageLayer() As ImageTilesLayer
Get
Return CType(MapControl1.Layers("ImageLayer"), ImageTilesLayer)
End Get
End Property
Private ReadOnly Property VectorLayer() As VectorItemsLayer
Get
Return CType(MapControl1.Layers("VectorLayer"), VectorItemsLayer)
End Get
End Property
Private ReadOnly Property ItemStorage() As MapItemStorage
Get
Return CType(VectorLayer.Data, MapItemStorage)
End Get
End Property
Public Sub New(currentPoint As GeoPoint)
SelectedPoint = currentPoint
Me.InitializeComponent()
End Sub
Private Sub MapControl1_Click(sender As Object, e As MouseEventArgs) Handles MapControl1.Click
If e.Button <> Windows.Forms.MouseButtons.Left Then
Exit Sub
End If
Dim point As GeoPoint = MapControl1.ScreenPointToCoordPoint(e.Location)
Dim items As New List(Of MapPushpin)
Dim storage As New MapItemStorage()
Dim pin = New MapPushpin()
pin.Location = point
ItemStorage.Items.Clear()
ItemStorage.Items.Add(pin)
txtLat.Text = point.Latitude.ToString()
txtLon.Text = point.Longitude.ToString()
SelectedPoint = point
End Sub
Private Sub frmGeodataSelect_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim dataProvider As New BingMapDataProvider()
dataProvider.BingKey = BING_KEY
ImageLayer.DataProvider = dataProvider
Dim storage As New MapItemStorage()
VectorLayer.Data = storage
If SelectedPoint IsNot Nothing Then
Dim pin = New MapPushpin()
pin.Location = SelectedPoint
ItemStorage.Items.Add(pin)
txtLat.Text = SelectedPoint.Latitude.ToString()
txtLon.Text = SelectedPoint.Longitude.ToString()
End If
End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
Me.DialogResult = Windows.Forms.DialogResult.OK
Me.Close()
End Sub
End Class