diff --git a/instat/dlgClimaticMaps.Designer.vb b/instat/dlgClimaticMaps.Designer.vb index 101b9d1005d..44ad1d6194f 100644 --- a/instat/dlgClimaticMaps.Designer.vb +++ b/instat/dlgClimaticMaps.Designer.vb @@ -63,7 +63,6 @@ Partial Class dlgClimaticMaps ' 'cmdMapOptions ' - Me.cmdMapOptions.Enabled = False Me.cmdMapOptions.Location = New System.Drawing.Point(14, 430) Me.cmdMapOptions.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.cmdMapOptions.Name = "cmdMapOptions" diff --git a/instat/dlgClimaticMaps.vb b/instat/dlgClimaticMaps.vb index 20e939b6f4c..568d99acab0 100644 --- a/instat/dlgClimaticMaps.vb +++ b/instat/dlgClimaticMaps.vb @@ -26,6 +26,7 @@ Public Class dlgClimaticMaps Private clsYlabFunction As New RFunction Private clsXScaleContinuousFunction As New RFunction Private clsYScaleContinuousFunction As New RFunction + Private clsXlimFunction, clsYlimFunction As New RFunction Private clsRFacetFunction As New RFunction Private clsThemeFunction As New RFunction Private dctThemeFunctions As Dictionary(Of String, RFunction) @@ -34,6 +35,8 @@ Public Class dlgClimaticMaps Private bResetSFLayerSubdialog As Boolean = True + + Private Sub dlgClimaticMaps_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then InitialiseDialog() @@ -59,29 +62,34 @@ Public Class dlgClimaticMaps ucrSelectorStation.SetParameter(New RParameter("data", 0)) ucrSelectorStation.SetParameterIsrfunction() - ucrReceiverFill.SetParameter(New RParameter("fill", 0)) - ucrReceiverFill.Selector = ucrSelectorOutline - ucrReceiverFill.SetParameterIsRFunction() - - ucrReceiverLongitude.SetParameter(New RParameter("x", 0)) - ucrReceiverLongitude.Selector = ucrSelectorStation - ucrReceiverLongitude.SetIncludedDataTypes({"numeric"}) - ucrReceiverLongitude.strSelectorHeading = "Numerics" - ucrReceiverLongitude.SetParameterIsRFunction() - - ucrReceiverLatitude.SetParameter(New RParameter("y", 1)) - ucrReceiverLatitude.Selector = ucrSelectorStation - ucrReceiverLatitude.SetIncludedDataTypes({"numeric"}) - ucrReceiverLatitude.strSelectorHeading = "Numerics" - ucrReceiverLatitude.SetParameterIsRFunction() - - ucrReceiverShape.SetParameter(New RParameter("shape", 2)) - ucrReceiverShape.Selector = ucrSelectorStation - ucrReceiverShape.SetParameterIsRFunction() - - ucrReceiverColor.SetParameter(New RParameter("color", 3)) - ucrReceiverColor.Selector = ucrSelectorStation - ucrReceiverColor.SetParameterIsRFunction() + ucrReceiverFill.SetParameter(New RParameter("fill", 0)) + ucrReceiverFill.Selector = ucrSelectorOutline + ucrReceiverFill.SetParameterIsString() + ucrReceiverFill.bWithQuotes = False + + ucrReceiverLongitude.SetParameter(New RParameter("x", 0)) + ucrReceiverLongitude.Selector = ucrSelectorStation + ucrReceiverLongitude.SetIncludedDataTypes({"numeric"}) + ucrReceiverLongitude.strSelectorHeading = "Numerics" + ucrReceiverLongitude.SetParameterIsString() + ucrReceiverLongitude.bWithQuotes = False + + ucrReceiverLatitude.SetParameter(New RParameter("y", 1)) + ucrReceiverLatitude.Selector = ucrSelectorStation + ucrReceiverLatitude.SetIncludedDataTypes({"numeric"}) + ucrReceiverLatitude.strSelectorHeading = "Numerics" + ucrReceiverLatitude.SetParameterIsString() + ucrReceiverLatitude.bWithQuotes = False + + ucrReceiverShape.SetParameter(New RParameter("shape", 2)) + ucrReceiverShape.Selector = ucrSelectorStation + ucrReceiverShape.SetParameterIsString() + ucrReceiverShape.bWithQuotes = False + + ucrReceiverColor.SetParameter(New RParameter("color", 3)) + ucrReceiverColor.Selector = ucrSelectorStation + ucrReceiverColor.SetParameterIsString() + ucrReceiverColor.bWithQuotes = False ucrSaveMap.SetPrefix("Map") ucrSaveMap.SetSaveTypeAsGraph() @@ -100,6 +108,8 @@ Public Class dlgClimaticMaps clsGeomPointAesFunction = New RFunction clsGGplotOperator = New ROperator + clsXlimFunction = New RFunction + clsYlimFunction = New RFunction ucrSelectorOutline.Reset() ucrReceiverFill.SetMeAsReceiver() @@ -141,12 +151,15 @@ Public Class dlgClimaticMaps dctThemeFunctions = New Dictionary(Of String, RFunction)(GgplotDefaults.dctThemeFunctions) clsLocalRaesFunction = GgplotDefaults.clsAesFunction.Clone() + clsXlimFunction.SetRCommand("xlim") + clsYlimFunction.SetRCommand("ylim") + clsGGplotOperator.SetAssignTo("last_map", strTempDataframe:=ucrSelectorOutline.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_map") ucrBase.clsRsyntax.SetBaseROperator(clsGGplotOperator) End Sub Private Sub cmdPlotOptions_Click(sender As Object, e As EventArgs) Handles cmdPlotOptions.Click - sdgPlots.SetRCode(clsGGplotOperator, clsNewThemeFunction:=clsThemeFunction, dctNewThemeFunctions:=dctThemeFunctions, clsNewGlobalAesFunction:=clsSfAesFunction, clsNewXScalecontinuousFunction:=clsXScaleContinuousFunction, clsNewYScalecontinuousFunction:=clsYScaleContinuousFunction, clsNewXLabsTitleFunction:=clsXlabsFunction, clsNewYLabTitleFunction:=clsYlabFunction, clsNewLabsFunction:=clsLabsFunction, clsNewFacetFunction:=clsRFacetFunction, ucrNewBaseSelector:=ucrSelectorOutline, bReset:=bResetSubdialog) + sdgPlots.SetRCode(clsGGplotOperator, clsNewThemeFunction:=clsThemeFunction, dctNewThemeFunctions:=dctThemeFunctions, clsNewGlobalAesFunction:=clsSfAesFunction, clsNewXScalecontinuousFunction:=clsXScaleContinuousFunction, clsNewYScalecontinuousFunction:=clsYScaleContinuousFunction, clsNewXLabsTitleFunction:=clsXlabsFunction, clsNewYLabTitleFunction:=clsYlabFunction, clsNewLabsFunction:=clsLabsFunction, clsNewFacetFunction:=clsRFacetFunction, ucrNewBaseSelector:=ucrSelectorStation, bReset:=bResetSubdialog) sdgPlots.ShowDialog() bResetSubdialog = False End Sub @@ -173,6 +186,12 @@ Public Class dlgClimaticMaps 'Next End Sub + Private Sub cmdMapOptions_Click_1(sender As Object, e As EventArgs) Handles cmdMapOptions.Click + sdgMapOption.SetRCode(clsBaseOperator:=clsGGplotOperator, clsXlim:=clsXlimFunction, clsylim:=clsYlimFunction, bReset:=bResetSubdialog) + sdgMapOption.ShowDialog() + bResetSubdialog = False + End Sub + Private Sub TestOkEnabled() Dim bOkEnabled As Boolean If Not ucrReceiverFill.IsEmpty AndAlso ucrSaveMap.IsComplete Then diff --git a/instat/sdgMapOption.Designer.vb b/instat/sdgMapOption.Designer.vb index db058684f2b..be08ead1c16 100644 --- a/instat/sdgMapOption.Designer.vb +++ b/instat/sdgMapOption.Designer.vb @@ -23,26 +23,118 @@ Partial Class sdgMapOption _ Private Sub InitializeComponent() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(sdgMapOption)) + Me.lblLat = New System.Windows.Forms.Label() + Me.lblLongMin = New System.Windows.Forms.Label() + Me.lblLatMax = New System.Windows.Forms.Label() + Me.lblLongMax = New System.Windows.Forms.Label() + Me.lblLatMin = New System.Windows.Forms.Label() + Me.lblLong = New System.Windows.Forms.Label() Me.ucrBase = New instat.ucrButtonsSubdialogue() + Me.ucrInputLatMax = New instat.ucrInputTextBox() + Me.ucrInputLongMax = New instat.ucrInputTextBox() + Me.ucrInputLatMin = New instat.ucrInputTextBox() + Me.ucrInputLongMin = New instat.ucrInputTextBox() Me.SuspendLayout() ' + 'lblLat + ' + resources.ApplyResources(Me.lblLat, "lblLat") + Me.lblLat.Name = "lblLat" + ' + 'lblLongMin + ' + resources.ApplyResources(Me.lblLongMin, "lblLongMin") + Me.lblLongMin.Name = "lblLongMin" + ' + 'lblLatMax + ' + resources.ApplyResources(Me.lblLatMax, "lblLatMax") + Me.lblLatMax.Name = "lblLatMax" + ' + 'lblLongMax + ' + resources.ApplyResources(Me.lblLongMax, "lblLongMax") + Me.lblLongMax.Name = "lblLongMax" + ' + 'lblLatMin + ' + resources.ApplyResources(Me.lblLatMin, "lblLatMin") + Me.lblLatMin.Name = "lblLatMin" + ' + 'lblLong + ' + resources.ApplyResources(Me.lblLong, "lblLong") + Me.lblLong.Name = "lblLong" + ' 'ucrBase ' resources.ApplyResources(Me.ucrBase, "ucrBase") Me.ucrBase.Name = "ucrBase" ' + 'ucrInputLatMax + ' + Me.ucrInputLatMax.AddQuotesIfUnrecognised = False + Me.ucrInputLatMax.IsMultiline = False + Me.ucrInputLatMax.IsReadOnly = False + resources.ApplyResources(Me.ucrInputLatMax, "ucrInputLatMax") + Me.ucrInputLatMax.Name = "ucrInputLatMax" + ' + 'ucrInputLongMax + ' + Me.ucrInputLongMax.AddQuotesIfUnrecognised = False + Me.ucrInputLongMax.IsMultiline = False + Me.ucrInputLongMax.IsReadOnly = False + resources.ApplyResources(Me.ucrInputLongMax, "ucrInputLongMax") + Me.ucrInputLongMax.Name = "ucrInputLongMax" + ' + 'ucrInputLatMin + ' + Me.ucrInputLatMin.AddQuotesIfUnrecognised = False + Me.ucrInputLatMin.IsMultiline = False + Me.ucrInputLatMin.IsReadOnly = False + resources.ApplyResources(Me.ucrInputLatMin, "ucrInputLatMin") + Me.ucrInputLatMin.Name = "ucrInputLatMin" + ' + 'ucrInputLongMin + ' + Me.ucrInputLongMin.AddQuotesIfUnrecognised = False + Me.ucrInputLongMin.IsMultiline = False + Me.ucrInputLongMin.IsReadOnly = False + resources.ApplyResources(Me.ucrInputLongMin, "ucrInputLongMin") + Me.ucrInputLongMin.Name = "ucrInputLongMin" + ' 'sdgMapOption ' resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.Controls.Add(Me.ucrBase) + Me.Controls.Add(Me.lblLat) + Me.Controls.Add(Me.lblLongMin) + Me.Controls.Add(Me.lblLatMax) + Me.Controls.Add(Me.ucrInputLatMax) + Me.Controls.Add(Me.lblLongMax) + Me.Controls.Add(Me.ucrInputLongMax) + Me.Controls.Add(Me.lblLatMin) + Me.Controls.Add(Me.ucrInputLatMin) + Me.Controls.Add(Me.lblLong) + Me.Controls.Add(Me.ucrInputLongMin) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "sdgMapOption" Me.ResumeLayout(False) + Me.PerformLayout() End Sub - + Friend WithEvents lblLat As Label + Friend WithEvents lblLongMin As Label + Friend WithEvents lblLatMax As Label + Friend WithEvents ucrInputLatMax As ucrInputTextBox + Friend WithEvents lblLongMax As Label + Friend WithEvents ucrInputLongMax As ucrInputTextBox + Friend WithEvents lblLatMin As Label + Friend WithEvents ucrInputLatMin As ucrInputTextBox + Friend WithEvents lblLong As Label + Friend WithEvents ucrInputLongMin As ucrInputTextBox Friend WithEvents ucrBase As ucrButtonsSubdialogue End Class diff --git a/instat/sdgMapOption.resx b/instat/sdgMapOption.resx index c15e082f56f..b7e743a4902 100644 --- a/instat/sdgMapOption.resx +++ b/instat/sdgMapOption.resx @@ -117,20 +117,197 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 185, 208 + + + True - - 4, 5, 4, 5 + + NoControl + + + + 10, 83 + + + 48, 13 + + + 21 + + + Latitude: + + + lblLat + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + True + + + NoControl + + + 72, 51 + + + 27, 13 + + + 17 + + + Min: + + + lblLongMin + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + True + + + NoControl + + + 208, 83 + + + 30, 13 + + + 24 + + + Max: + + + lblLatMax + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + + + True + + + NoControl + + + 208, 51 + + + 30, 13 + + + 19 + + + Max: + + + lblLongMax + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 5 + + + True + + + NoControl + + + 72, 83 + + + 27, 13 + + + 22 + + + Min: + + + lblLatMin + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 7 + + + True + + + NoControl + + + 10, 51 + + + 57, 13 + + + 16 + + + Longitude: + + + lblLong + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 9 + + + 112, 132 - 213, 46 + 142, 30 - - 2 + 25 ucrBase @@ -144,14 +321,113 @@ 0 + + 240, 78 + + + 9, 12, 9, 12 + + + 99, 21 + + + 15 + + + ucrInputLatMax + + + instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 4 + + + 238, 47 + + + 9, 12, 9, 12 + + + 99, 21 + + + 20 + + + ucrInputLongMax + + + instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 6 + + + 102, 78 + + + 9, 12, 9, 12 + + + 99, 21 + + + 23 + + + ucrInputLatMin + + + instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 8 + + + 102, 47 + + + 9, 12, 9, 12 + + + 99, 21 + + + 18 + + + ucrInputLongMin + + + instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 10 + True - 9, 20 + 6, 13 - 684, 279 + 383, 181 + + + 2, 2, 2, 2 CenterScreen diff --git a/instat/sdgMapOption.vb b/instat/sdgMapOption.vb index d28cc2549ba..905eb582def 100644 --- a/instat/sdgMapOption.vb +++ b/instat/sdgMapOption.vb @@ -1,3 +1,96 @@ -Public Class sdgMapOption +' R-Instat +' Copyright (C) 2015-2017 +' +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License +' along with this program. If not, see . + +Imports instat.Translations + + +Public Class sdgMapOption + Private bFirstLoad As Boolean = True + Private bReset As Boolean = True + Private clsXlimFunction, clsYlimFunction As New RFunction + Private clsGgplotOperator As New ROperator + Private bControlsInitalised As Boolean = False + + Private Sub sdgMapOption_Load(sender As Object, e As EventArgs) Handles MyBase.Load + autoTranslate(Me) + End Sub + + Private Sub InitialiseDialog() + ucrInputLongMin.SetParameter(New RParameter("longmin", bNewIncludeArgumentName:=False)) + ucrInputLongMin.SetValidationTypeAsNumeric(dcmMin:=-180, dcmMax:=180) + ucrInputLongMin.AddQuotesIfUnrecognised = False + + ucrInputLongMax.SetParameter(New RParameter("longmax", bNewIncludeArgumentName:=False)) + ucrInputLongMax.SetValidationTypeAsNumeric(dcmMin:=-180, dcmMax:=180) + ucrInputLongMax.AddQuotesIfUnrecognised = False + + ucrInputLatMin.SetParameter(New RParameter("latmin", bNewIncludeArgumentName:=False)) + ucrInputLatMin.SetValidationTypeAsNumeric(dcmMin:=-90, dcmMax:=90) + ucrInputLatMin.AddQuotesIfUnrecognised = False + + ucrInputLatMax.SetParameter(New RParameter("latmax", bNewIncludeArgumentName:=False)) + ucrInputLatMax.SetValidationTypeAsNumeric(dcmMin:=-90, dcmMax:=90) + ucrInputLatMax.AddQuotesIfUnrecognised = False + + + bControlsInitalised = True + End Sub + + Public Sub SetRCode(clsBaseOperator As ROperator, clsXlim As RFunction, clsylim As RFunction, Optional bReset As Boolean = False) + + If Not bControlsInitalised Then + InitialiseDialog() + End If + + clsGgplotOperator = clsBaseOperator + clsXlimFunction = clsXlim + clsYlimFunction = clsylim + + ucrInputLongMin.SetRCode(clsXlimFunction, bReset, bCloneIfNeeded:=True) + ucrInputLongMax.SetRCode(clsXlimFunction, bReset, bCloneIfNeeded:=True) + ucrInputLatMin.SetRCode(clsYlimFunction, bReset, bCloneIfNeeded:=True) + ucrInputLatMax.SetRCode(clsYlimFunction, bReset, bCloneIfNeeded:=True) + End Sub + + Private Sub CheckMinMaxValues() + 'If ucrInputLongMin.GetValue() > ucrInputLongMax.GetValue() OrElse ucrInputLongMin.GetValue() > ucrInputLongMax.GetValue() Then + ' MsgBox("You can not have minimum longitude value greater or equal to maximum longitude", vbOKOnly, "Warning") + ' 'TODO sould we disable return button?? + 'ElseIf ucrInputLatMin.GetValue() > ucrInputLatMax.GetValue() OrElse ucrInputLatMin.GetValue() > ucrInputLatMax.GetValue() Then + ' MsgBox("You can not have minimum latitude value greater or equal to maximum latitude", vbOKOnly, "Warning") + + 'End If + End Sub + Private Sub ucrInputLatMax_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputLatMax.ControlValueChanged, ucrInputLongMax.ControlValueChanged, ucrInputLatMin.ControlValueChanged, ucrInputLongMin.ControlValueChanged + 'CheckMinMaxValues() + AddRemoveLimits() + End Sub + + Private Sub AddRemoveLimits() + + If Not ucrInputLongMin.IsEmpty AndAlso Not ucrInputLongMax.IsEmpty Then + clsGgplotOperator.AddParameter("xlim", clsRFunctionParameter:=clsXlimFunction) + Else + clsGgplotOperator.RemoveParameterByName("xlim") + End If + If Not ucrInputLatMin.IsEmpty AndAlso Not ucrInputLatMax.IsEmpty Then + clsGgplotOperator.AddParameter("ylim", clsRFunctionParameter:=clsYlimFunction) + Else + clsGgplotOperator.RemoveParameterByName("ylim") + End If + End Sub End Class \ No newline at end of file