jj 30.11.2016

This commit is contained in:
JenneJ
2016-11-30 15:56:44 +01:00
parent 0f374eecb2
commit 57517ffed8
12 changed files with 3350 additions and 4779 deletions

View File

@@ -30,14 +30,10 @@ Public Class frmGeodataNavigation
Me.EntitySql = String.Format("SELECT T.*, T1.LATITUDE, T1.LONGITUDE from VWTEMP_PMO_FORM{0} T,TBPMO_RECORD_GEODATA T1 WHERE T.[Record-ID] = T1.RECORD_ID", Me.EntityId)
End Sub
Private Sub frmGeodataNavigation_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Private Function CreateItemList()
' Liste für PushPins anlegen
Dim items As New List(Of MapPushpin)
' Kartendaten laden
Dim dataProvider As New BingMapDataProvider()
dataProvider.BingKey = BING_KEY
ImageLayer.DataProvider = dataProvider
'Dim items As New List(Of MapPushpin)
Dim items As New List(Of MapCustomElementEx)
' Datensätze mit Lat,Lon Werten laden
Dim dt As DataTable = ClassDatabase.Return_Datatable(Me.EntitySql)
@@ -46,18 +42,36 @@ Public Class frmGeodataNavigation
For Each row As DataRow In dt.Rows
Dim lat As Double = row.Item("LATITUDE")
Dim lon As Double = row.Item("LONGITUDE")
Dim pushpin As New MapPushpin()
pushpin.Location = New GeoPoint(lat, lon)
pushpin.Text = row.Item("Record-ID").ToString()
pushpin.Information = row.Item("Record-ID")
items.Add(pushpin)
Dim customElement = New MapCustomElementEx() With {
.Location = New GeoPoint(lat, lon),
.Text = row.Item("Record-ID").ToString(),
.Information = row.Item("Record-ID")
}
customElement.Image = New Bitmap(My.Resources.pushpin, New Size(30, 30))
customElement.Padding = New Padding(10, 5, 10, 5)
customElement.SelectedFill = Color.White
items.Add(customElement)
'Dim pushpin As New MapPushpin()
'pushpin.Location = New GeoPoint(lat, lon)
'pushpin.Text = row.Item("Record-ID").ToString()
'pushpin.Information = row.Item("Record-ID")
'items.Add(pushpin)
Next
Dim storage As New MapItemStorage()
Dim itemArray() As MapPushpin = items.ToArray()
Return items
End Function
storage.Items.AddRange(itemArray)
Private Sub LoadItemList()
'Dim items As List(Of MapPushpin) = CreateItemList()
Dim items As List(Of MapCustomElementEx) = CreateItemList()
Dim storage As New MapItemStorage()
storage.Items.Clear()
storage.Items.AddRange(items.ToArray())
VectorLayer.Data = storage
tsLabelRecordCount.Text = String.Format("{0} Elemente gefunden", items.Count)
@@ -65,27 +79,47 @@ Public Class frmGeodataNavigation
MapControl1.ZoomToFitLayerItems()
End Sub
Private Sub SetGridFilter(records As List(Of Integer))
Dim filter As New List(Of String)
For Each id As Integer In records
filter.Add(String.Format("[Record-Id] = {0}", id))
Next
Dim gridView As Views.Grid.GridView = Me.Grid.FocusedView
gridView.ActiveFilterString = String.Join(" OR ", filter.ToArray())
Private Sub frmGeodataNavigation_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Try
Dim gridView As Views.Grid.GridView = Me.Grid.FocusedView
gridView.ActiveFilterString = Nothing
Catch ex As Exception
MsgBox("Error in frmGeodataNavigation_FormClosing: " & vbNewLine & ex.Message)
End Try
End Sub
'Private Sub MapControl1_MapItemClick(sender As Object, e As MapItemClickEventArgs) Handles MapControl1.MapItemClick
Private Sub frmGeodataNavigation_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
Dim dataProvider As New BingMapDataProvider()
dataProvider.BingKey = BING_KEY
ImageLayer.DataProvider = dataProvider
'End Sub
LoadItemList()
'Private Sub MapControl1_MapItemDoubleClick(sender As Object, e As MapItemClickEventArgs) Handles MapControl1.MapItemDoubleClick
' Dim item As MapPushpin = e.Item
' Dim recordId As Integer = item.Information
Dim sql = Get_Grid_Sql(CURRENT_CONSTRUCTOR_ID, CURRENT_FORM_ID, CURRENT_CONSTRUCTOR_DETAIL_ID, frmConstructor_Main.GridType.Grid, USER_GUID, String.Empty, False, 1, 0, GridControlGeo, grvwMain, True)
If Not IsNothing(sql) Then
Dim DT_GEO As DataTable = ClassDatabase.Return_Datatable(sql)
GridControlGeo.DataSource = DT_GEO
End If
Catch ex As Exception
MsgBox("Error while loading GeoData: " & vbNewLine & ex.Message)
End Try
End Sub
' SetGridFilter(New List(Of Integer) From {recordId})
'End Sub
Private Sub SetGridFilter(records As List(Of Integer))
Try
Dim filter As New List(Of String)
For Each id As Integer In records
filter.Add(String.Format("[Record-Id] = {0}", id))
Next
Dim gridView As Views.Grid.GridView = Me.Grid.FocusedView
gridView.ActiveFilterString = String.Join(" OR ", filter.ToArray())
Catch ex As Exception
MsgBox("Error in SetGridFilter: " & vbNewLine & ex.Message)
End Try
End Sub
Private Sub MapControl1_SelectionChanged(sender As Object, e As MapSelectionChangedEventArgs) Handles MapControl1.SelectionChanged
Dim items As List(Of Object) = e.Selection
@@ -93,14 +127,41 @@ Public Class frmGeodataNavigation
For Each item As Object In items
Try
Dim pin As MapPushpin = CType(item, MapPushpin)
Dim recordId As Integer = pin.Information
'Dim pin As MapPushpin = CType(item, MapPushpin)
'Dim recordId As Integer = pin.Information
Dim el As MapCustomElementEx = CType(item, MapCustomElementEx)
Dim recordId As Integer = el.Information
records.Add(recordId)
Catch ex As Exception
MsgBox("Cannot convert selection to MapPushPin")
MsgBox("Cannot convert selection to MapCustomElementEx")
End Try
Next
SetGridFilter(records)
End Sub
Class MapCustomElementEx
Inherits MapCustomElement
Public Property Information As Object
End Class
Private Sub XtraTabControl1_TabIndexChanged(sender As Object, e As EventArgs) Handles XtraTabControl1.TabIndexChanged
End Sub
Private Sub grvwMain_RowStyle(sender As Object, e As Views.Grid.RowStyleEventArgs) Handles grvwMain.RowStyle
'TODO: Make Rows without geodata RED
End Sub
Private Sub grvwMain_FocusedRowChanged(sender As Object, e As Views.Base.FocusedRowChangedEventArgs) Handles grvwMain.FocusedRowChanged
'TODO: Load LatLon in Splitter2
Dim currentRow As DataRowView = grvwMain.GetFocusedRow()
Dim lat As Decimal = currentRow.Item("LATITUDE")
Dim lon As Decimal = currentRow.Item("LONGITUDE")
txtLat.Text = lat
txtLon.Text = lon
End Sub
End Class