diff --git a/app/DD-Record-Organizer/frmGeodataNavigation.Designer.vb b/app/DD-Record-Organizer/frmGeodataNavigation.Designer.vb index 714b1d9..cc3c8dd 100644 --- a/app/DD-Record-Organizer/frmGeodataNavigation.Designer.vb +++ b/app/DD-Record-Organizer/frmGeodataNavigation.Designer.vb @@ -99,7 +99,6 @@ Partial Class frmGeodataNavigation Me.MapControl1.Layers.Add(VectorItemsLayer1) Me.MapControl1.Location = New System.Drawing.Point(0, 0) Me.MapControl1.Name = "MapControl1" - Me.MapControl1.NavigationPanelOptions.Visible = False Me.MapControl1.Size = New System.Drawing.Size(996, 572) Me.MapControl1.TabIndex = 2 ' diff --git a/app/DD-Record-Organizer/frmGeodataNavigation.vb b/app/DD-Record-Organizer/frmGeodataNavigation.vb index bb77d8b..8c0a974 100644 --- a/app/DD-Record-Organizer/frmGeodataNavigation.vb +++ b/app/DD-Record-Organizer/frmGeodataNavigation.vb @@ -1,6 +1,7 @@ Imports DevExpress.XtraMap Imports DevExpress.XtraEditors Imports DevExpress.XtraGrid +Imports DevExpress.Map Imports DevExpress.Utils Imports DevExpress.XtraGrid.Columns Imports DevExpress.XtraEditors.Repository @@ -67,7 +68,7 @@ Public Class frmGeodataNavigation tsLabelRecordCount.Text = String.Format("{0} Elemente mit Koordinaten gefunden", items.Count) - MapControl1.ZoomToFitLayerItems() + 'MapControl1.ZoomToFitLayerItems() End Sub #End Region @@ -88,6 +89,28 @@ Public Class frmGeodataNavigation dataProvider.BingKey = BING_KEY ImageLayer.DataProvider = dataProvider + Dim XMLPath = Get_Settings_Filename() + Dim layout As New ClassLayout(XMLPath) + Dim settings As New System.Collections.Generic.List(Of ClassSetting) + settings = layout.Load() + + Dim centerX, centerY As Double + + For Each setting In settings + Select Case setting._name + Case "MapControl_ZoomLevel" + MapControl1.ZoomLevel = Double.Parse(setting._value) + Case "MapControl_CenterX" + centerX = Double.Parse(setting._value) + Case "MapControl_CenterY" + centerY = Double.Parse(setting._value) + End Select + Next + + Dim center As New GeoPoint(centerY, centerX) + MapControl1.SetCenterPoint(center, False) + + EntitySql = Get_Grid_Sql(CURRENT_CONSTRUCTOR_ID, CURRENT_ENTITY_ID, CURRENT_CONSTRUCTOR_DETAIL_ID, frmConstructor_Main.GridType.Grid, USER_GUID, String.Empty, False, 1, 0, GridControlGeo, grvwMain, True) LoadData() @@ -100,11 +123,31 @@ Public Class frmGeodataNavigation Try Dim gridView As Views.Grid.GridView = Me.ConstructorMain_Grid.FocusedView gridView.ActiveFilterString = Nothing + + Dim zoomLevel = MapControl1.ZoomLevel + Dim xCoord = MapControl1.CenterPoint.GetX + Dim yCoord = MapControl1.CenterPoint.GetY + + Dim XMLPath = Get_Settings_Filename() + Dim layout As New ClassLayout(XMLPath) + Dim settings As New System.Collections.Generic.List(Of ClassSetting) + + settings.Add(New ClassSetting("MapControl_ZoomLevel", zoomLevel)) + settings.Add(New ClassSetting("MapControl_CenterX", xCoord)) + settings.Add(New ClassSetting("MapControl_CenterY", yCoord)) + + layout.Save(settings) + Catch ex As Exception MsgBox("Error in frmGeodataNavigation_FormClosing: " & vbNewLine & ex.Message) End Try End Sub + Private Function Get_Settings_Filename() + Dim Filename As String = String.Format("{0}-Geodata-Layout.xml", CURRENT_CONSTRUCTOR_ID) + Return System.IO.Path.Combine(Application.UserAppDataPath(), Filename) + End Function + Private Sub LoadData() Dim rowhandle As Integer = grvwMain.FocusedRowHandle diff --git a/app/DD-Record-Organizer/frmGeodataSelect.Designer.vb b/app/DD-Record-Organizer/frmGeodataSelect.Designer.vb index 4068c80..61ede3b 100644 --- a/app/DD-Record-Organizer/frmGeodataSelect.Designer.vb +++ b/app/DD-Record-Organizer/frmGeodataSelect.Designer.vb @@ -26,12 +26,12 @@ Partial Class frmGeodataSelect Dim VectorItemsLayer1 As DevExpress.XtraMap.VectorItemsLayer = New DevExpress.XtraMap.VectorItemsLayer() Me.ToolStrip1 = New System.Windows.Forms.ToolStrip() Me.btnSave = New System.Windows.Forms.ToolStripButton() - Me.ToolStripLabel1 = New System.Windows.Forms.ToolStripLabel() + Me.tsbtnactivate = New System.Windows.Forms.ToolStripButton() Me.ToolStripLabel2 = New System.Windows.Forms.ToolStripLabel() Me.txtLat = New System.Windows.Forms.ToolStripLabel() Me.ToolStripLabel4 = New System.Windows.Forms.ToolStripLabel() Me.txtLon = New System.Windows.Forms.ToolStripLabel() - Me.tsbtnactivate = New System.Windows.Forms.ToolStripButton() + Me.ToolStripLabel1 = New System.Windows.Forms.ToolStripLabel() Me.MapControl1 = New DevExpress.XtraMap.MapControl() Me.ToolStrip1.SuspendLayout() CType(Me.MapControl1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -55,13 +55,13 @@ Partial Class frmGeodataSelect Me.btnSave.Size = New System.Drawing.Size(79, 22) Me.btnSave.Text = "Speichern" ' - 'ToolStripLabel1 + 'tsbtnactivate ' - Me.ToolStripLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right - Me.ToolStripLabel1.Font = New System.Drawing.Font("Segoe UI Semibold", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.ToolStripLabel1.Name = "ToolStripLabel1" - Me.ToolStripLabel1.Size = New System.Drawing.Size(146, 22) - Me.ToolStripLabel1.Text = "Ausgewählte Koordinaten:" + Me.tsbtnactivate.Image = Global.DD_Record_Organizer.My.Resources.Resources.base_globe_32 + Me.tsbtnactivate.ImageTransparentColor = System.Drawing.Color.Magenta + Me.tsbtnactivate.Name = "tsbtnactivate" + Me.tsbtnactivate.Size = New System.Drawing.Size(148, 22) + Me.tsbtnactivate.Text = "Aktiviere Mausauswahl" ' 'ToolStripLabel2 ' @@ -91,13 +91,13 @@ Partial Class frmGeodataSelect Me.txtLon.Size = New System.Drawing.Size(40, 22) Me.txtLon.Text = "txtLon" ' - 'tsbtnactivate + 'ToolStripLabel1 ' - Me.tsbtnactivate.Image = Global.DD_Record_Organizer.My.Resources.Resources.base_globe_32 - Me.tsbtnactivate.ImageTransparentColor = System.Drawing.Color.Magenta - Me.tsbtnactivate.Name = "tsbtnactivate" - Me.tsbtnactivate.Size = New System.Drawing.Size(148, 22) - Me.tsbtnactivate.Text = "Aktiviere Mausauswahl" + Me.ToolStripLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right + Me.ToolStripLabel1.Font = New System.Drawing.Font("Segoe UI Semibold", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.ToolStripLabel1.Name = "ToolStripLabel1" + Me.ToolStripLabel1.Size = New System.Drawing.Size(146, 22) + Me.ToolStripLabel1.Text = "Ausgewählte Koordinaten:" ' 'MapControl1 ' diff --git a/app/DD-Record-Organizer/frmGeodataSelect.vb b/app/DD-Record-Organizer/frmGeodataSelect.vb index 2be8693..667b572 100644 --- a/app/DD-Record-Organizer/frmGeodataSelect.vb +++ b/app/DD-Record-Organizer/frmGeodataSelect.vb @@ -44,7 +44,12 @@ Public Class frmGeodataSelect txtLat.Text = SelectedPoint.Latitude.ToString() txtLon.Text = SelectedPoint.Longitude.ToString() + + MapControl1.ZoomLevel = 7 + MapControl1.ZoomToFit(New List(Of MapPushpin) From {pin}) End If + + End Sub Private Sub MapControl1_Click(sender As Object, e As MouseEventArgs) Handles MapControl1.Click