From c632edc0cb7b345342532e8083d46794bc240954 Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Mon, 11 Dec 2023 15:46:39 +0300 Subject: [PATCH 1/8] changes to the code --- instat/dlgIDFCurves.Designer.vb | 140 +++++++++++++++++++++++++++++++- instat/dlgIDFCurves.vb | 20 ++++- 2 files changed, 158 insertions(+), 2 deletions(-) diff --git a/instat/dlgIDFCurves.Designer.vb b/instat/dlgIDFCurves.Designer.vb index f9af1238740..03092567cbe 100644 --- a/instat/dlgIDFCurves.Designer.vb +++ b/instat/dlgIDFCurves.Designer.vb @@ -22,13 +22,139 @@ Partial Class dlgIDFCurves 'Do not modify it using the code editor. _ Private Sub InitializeComponent() + Me.ucrBase = New instat.ucrButtons() + Me.ucrIDFCurvesSelector = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrReceiverDateTime = New instat.ucrReceiverSingle() + Me.ucrReceiverPrec = New instat.ucrReceiverSingle() + Me.lblDateTime = New System.Windows.Forms.Label() + Me.lblRain = New System.Windows.Forms.Label() + Me.ucrStationName = New instat.ucrInputTextBox() + Me.lblStationName = New System.Windows.Forms.Label() + Me.UcrNud1 = New instat.ucrNud() + Me.lblMinimumProp = New System.Windows.Forms.Label() Me.SuspendLayout() ' + 'ucrBase + ' + Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrBase.Location = New System.Drawing.Point(6, 298) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(410, 52) + Me.ucrBase.TabIndex = 0 + ' + 'ucrIDFCurvesSelector + ' + Me.ucrIDFCurvesSelector.AutoSize = True + Me.ucrIDFCurvesSelector.bDropUnusedFilterLevels = False + Me.ucrIDFCurvesSelector.bShowHiddenColumns = False + Me.ucrIDFCurvesSelector.bUseCurrentFilter = True + Me.ucrIDFCurvesSelector.Location = New System.Drawing.Point(6, 16) + Me.ucrIDFCurvesSelector.Margin = New System.Windows.Forms.Padding(0) + Me.ucrIDFCurvesSelector.Name = "ucrIDFCurvesSelector" + Me.ucrIDFCurvesSelector.Size = New System.Drawing.Size(213, 183) + Me.ucrIDFCurvesSelector.TabIndex = 1 + ' + 'ucrReceiverDateTime + ' + Me.ucrReceiverDateTime.AutoSize = True + Me.ucrReceiverDateTime.frmParent = Me + Me.ucrReceiverDateTime.Location = New System.Drawing.Point(279, 72) + Me.ucrReceiverDateTime.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverDateTime.Name = "ucrReceiverDateTime" + Me.ucrReceiverDateTime.Selector = Nothing + Me.ucrReceiverDateTime.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverDateTime.strNcFilePath = "" + Me.ucrReceiverDateTime.TabIndex = 2 + Me.ucrReceiverDateTime.ucrSelector = Nothing + ' + 'ucrReceiverPrec + ' + Me.ucrReceiverPrec.AutoSize = True + Me.ucrReceiverPrec.frmParent = Me + Me.ucrReceiverPrec.Location = New System.Drawing.Point(279, 105) + Me.ucrReceiverPrec.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverPrec.Name = "ucrReceiverPrec" + Me.ucrReceiverPrec.Selector = Nothing + Me.ucrReceiverPrec.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverPrec.strNcFilePath = "" + Me.ucrReceiverPrec.TabIndex = 3 + Me.ucrReceiverPrec.ucrSelector = Nothing + ' + 'lblDateTime + ' + Me.lblDateTime.AutoSize = True + Me.lblDateTime.Location = New System.Drawing.Point(276, 52) + Me.lblDateTime.Name = "lblDateTime" + Me.lblDateTime.Size = New System.Drawing.Size(56, 13) + Me.lblDateTime.TabIndex = 4 + Me.lblDateTime.Text = "Date-Time" + ' + 'lblRain + ' + Me.lblRain.AutoSize = True + Me.lblRain.Location = New System.Drawing.Point(285, 92) + Me.lblRain.Name = "lblRain" + Me.lblRain.Size = New System.Drawing.Size(29, 13) + Me.lblRain.TabIndex = 5 + Me.lblRain.Text = "Rain" + ' + 'ucrStationName + ' + Me.ucrStationName.AddQuotesIfUnrecognised = True + Me.ucrStationName.AutoSize = True + Me.ucrStationName.IsMultiline = False + Me.ucrStationName.IsReadOnly = False + Me.ucrStationName.Location = New System.Drawing.Point(279, 152) + Me.ucrStationName.Name = "ucrStationName" + Me.ucrStationName.Size = New System.Drawing.Size(137, 21) + Me.ucrStationName.TabIndex = 6 + ' + 'lblStationName + ' + Me.lblStationName.AutoSize = True + Me.lblStationName.Location = New System.Drawing.Point(281, 135) + Me.lblStationName.Name = "lblStationName" + Me.lblStationName.Size = New System.Drawing.Size(71, 13) + Me.lblStationName.TabIndex = 7 + Me.lblStationName.Text = "Station Name" + ' + 'UcrNud1 + ' + Me.UcrNud1.AutoSize = True + Me.UcrNud1.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.UcrNud1.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.UcrNud1.Location = New System.Drawing.Point(365, 191) + Me.UcrNud1.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.UcrNud1.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.UcrNud1.Name = "UcrNud1" + Me.UcrNud1.Size = New System.Drawing.Size(50, 20) + Me.UcrNud1.TabIndex = 8 + Me.UcrNud1.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'lblMinimumProp + ' + Me.lblMinimumProp.AutoSize = True + Me.lblMinimumProp.Location = New System.Drawing.Point(261, 194) + Me.lblMinimumProp.Name = "lblMinimumProp" + Me.lblMinimumProp.Size = New System.Drawing.Size(99, 13) + Me.lblMinimumProp.TabIndex = 9 + Me.lblMinimumProp.Text = "Minimum Proportion" + ' 'dlgIDFCurves ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(487, 450) + Me.ClientSize = New System.Drawing.Size(425, 355) + Me.Controls.Add(Me.lblMinimumProp) + Me.Controls.Add(Me.UcrNud1) + Me.Controls.Add(Me.lblStationName) + Me.Controls.Add(Me.ucrStationName) + Me.Controls.Add(Me.lblRain) + Me.Controls.Add(Me.lblDateTime) + Me.Controls.Add(Me.ucrReceiverPrec) + Me.Controls.Add(Me.ucrReceiverDateTime) + Me.Controls.Add(Me.ucrIDFCurvesSelector) + Me.Controls.Add(Me.ucrBase) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -36,6 +162,18 @@ Partial Class dlgIDFCurves Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "IDF Curves" Me.ResumeLayout(False) + Me.PerformLayout() End Sub + + Friend WithEvents ucrBase As ucrButtons + Friend WithEvents ucrIDFCurvesSelector As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrReceiverDateTime As ucrReceiverSingle + Friend WithEvents lblStationName As Label + Friend WithEvents ucrStationName As ucrInputTextBox + Friend WithEvents lblRain As Label + Friend WithEvents lblDateTime As Label + Friend WithEvents ucrReceiverPrec As ucrReceiverSingle + Friend WithEvents lblMinimumProp As Label + Friend WithEvents UcrNud1 As ucrNud End Class diff --git a/instat/dlgIDFCurves.vb b/instat/dlgIDFCurves.vb index e146ccf6d86..a640110facd 100644 --- a/instat/dlgIDFCurves.vb +++ b/instat/dlgIDFCurves.vb @@ -1,3 +1,21 @@ -Public Class dlgIDFCurves +' 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 dlgIDFCurves + End Class \ No newline at end of file From 1fa7e5697901e1cecd214890b8533af661fd2aeb Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Tue, 12 Dec 2023 12:43:12 +0300 Subject: [PATCH 2/8] changes to the code --- instat/dlgIDFCurves.vb | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/instat/dlgIDFCurves.vb b/instat/dlgIDFCurves.vb index a640110facd..ef0c4adfc7a 100644 --- a/instat/dlgIDFCurves.vb +++ b/instat/dlgIDFCurves.vb @@ -16,6 +16,44 @@ Imports instat.Translations Public Class dlgIDFCurves + Private bFirstLoad As Boolean = True + Private bReset As Boolean = True + Private bResetRCode As Boolean = True + Private Sub dlgIDFCurves_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstLoad Then + InitialiseDialog() + bFirstLoad = False + End If + If bReset Then + SetDefaults() + End If + SetRCodeForControls(bReset) + bReset = False + TestOKEnabled() + autoTranslate(Me) + End Sub + + Private Sub InitialiseDialog() + + End Sub + + Private Sub SetDefaults() + + End Sub + + Private Sub SetRCodeForControls(bReset As Boolean) + + End Sub + + Private Sub TestOkEnabled() + + End Sub + + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + SetDefaults() + SetRCodeForControls(True) + TestOkEnabled() + End Sub End Class \ No newline at end of file From 893502c74d881d8edac84a795cc579b710cf892a Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Tue, 12 Dec 2023 13:14:53 +0300 Subject: [PATCH 3/8] changes to the code --- instat/dlgIDFCurves.Designer.vb | 28 ++++++++++++++-------------- instat/dlgIDFCurves.vb | 24 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/instat/dlgIDFCurves.Designer.vb b/instat/dlgIDFCurves.Designer.vb index 03092567cbe..b100d53baa4 100644 --- a/instat/dlgIDFCurves.Designer.vb +++ b/instat/dlgIDFCurves.Designer.vb @@ -30,7 +30,7 @@ Partial Class dlgIDFCurves Me.lblRain = New System.Windows.Forms.Label() Me.ucrStationName = New instat.ucrInputTextBox() Me.lblStationName = New System.Windows.Forms.Label() - Me.UcrNud1 = New instat.ucrNud() + Me.ucrNudMaxPrec = New instat.ucrNud() Me.lblMinimumProp = New System.Windows.Forms.Label() Me.SuspendLayout() ' @@ -118,18 +118,18 @@ Partial Class dlgIDFCurves Me.lblStationName.TabIndex = 7 Me.lblStationName.Text = "Station Name" ' - 'UcrNud1 + 'ucrNudMaxPrec ' - Me.UcrNud1.AutoSize = True - Me.UcrNud1.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.UcrNud1.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.UcrNud1.Location = New System.Drawing.Point(365, 191) - Me.UcrNud1.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.UcrNud1.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.UcrNud1.Name = "UcrNud1" - Me.UcrNud1.Size = New System.Drawing.Size(50, 20) - Me.UcrNud1.TabIndex = 8 - Me.UcrNud1.Value = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudMaxPrec.AutoSize = True + Me.ucrNudMaxPrec.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudMaxPrec.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudMaxPrec.Location = New System.Drawing.Point(365, 191) + Me.ucrNudMaxPrec.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudMaxPrec.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudMaxPrec.Name = "ucrNudMaxPrec" + Me.ucrNudMaxPrec.Size = New System.Drawing.Size(50, 20) + Me.ucrNudMaxPrec.TabIndex = 8 + Me.ucrNudMaxPrec.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' 'lblMinimumProp ' @@ -146,7 +146,7 @@ Partial Class dlgIDFCurves Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(425, 355) Me.Controls.Add(Me.lblMinimumProp) - Me.Controls.Add(Me.UcrNud1) + Me.Controls.Add(Me.ucrNudMaxPrec) Me.Controls.Add(Me.lblStationName) Me.Controls.Add(Me.ucrStationName) Me.Controls.Add(Me.lblRain) @@ -175,5 +175,5 @@ Partial Class dlgIDFCurves Friend WithEvents lblDateTime As Label Friend WithEvents ucrReceiverPrec As ucrReceiverSingle Friend WithEvents lblMinimumProp As Label - Friend WithEvents UcrNud1 As ucrNud + Friend WithEvents ucrNudMaxPrec As ucrNud End Class diff --git a/instat/dlgIDFCurves.vb b/instat/dlgIDFCurves.vb index ef0c4adfc7a..30090f2441f 100644 --- a/instat/dlgIDFCurves.vb +++ b/instat/dlgIDFCurves.vb @@ -19,6 +19,7 @@ Public Class dlgIDFCurves Private bFirstLoad As Boolean = True Private bReset As Boolean = True Private bResetRCode As Boolean = True + Private clsIDFCurvesFunction As New RFunction Private Sub dlgIDFCurves_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -35,11 +36,34 @@ Public Class dlgIDFCurves End Sub Private Sub InitialiseDialog() + ucrIDFCurvesSelector.SetParameter(New RParameter("prdat", 0)) + ucrIDFCurvesSelector.SetParameterIsrfunction() + + ucrReceiverDateTime.SetParameter(New RParameter("clmn", 1)) + ucrReceiverDateTime.Selector = ucrIDFCurvesSelector + + ucrReceiverPrec.SetParameter(New RParameter("clmn", 1)) + ucrReceiverPrec.Selector = ucrIDFCurvesSelector + + ucrStationName.SetParameter(New RParameter("stname", 2)) + + ucrNudMaxPrec.SetParameter(New RParameter("mindpy", 3)) + ucrNudMaxPrec.SetMinMax(0, 1) + ucrNudMaxPrec.Increment = 0.1 End Sub Private Sub SetDefaults() + clsIDFCurvesFunction = New RFunction + + ucrIDFCurvesSelector.Reset() + ucrReceiverDateTime.SetMeAsReceiver() + + clsIDFCurvesFunction.SetPackageName("climatol") + clsIDFCurvesFunction.SetRCommand("IDFcurves") + clsIDFCurvesFunction.AddParameter("na.code", "NA", iPosition:=0) + ucrBase.clsRsyntax.SetBaseRFunction(clsIDFCurvesFunction) End Sub Private Sub SetRCodeForControls(bReset As Boolean) From ad0feb1fec07aed8e6568016f598a6ea55b4e67c Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Wed, 13 Dec 2023 09:30:09 +0300 Subject: [PATCH 4/8] changes --- instat/dlgIDFCurves.vb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/instat/dlgIDFCurves.vb b/instat/dlgIDFCurves.vb index 30090f2441f..26087dbb953 100644 --- a/instat/dlgIDFCurves.vb +++ b/instat/dlgIDFCurves.vb @@ -20,6 +20,7 @@ Public Class dlgIDFCurves Private bReset As Boolean = True Private bResetRCode As Boolean = True Private clsIDFCurvesFunction As New RFunction + Private clsVarsColumnsOperator As ROperator Private Sub dlgIDFCurves_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -55,6 +56,7 @@ Public Class dlgIDFCurves Private Sub SetDefaults() clsIDFCurvesFunction = New RFunction + clsVarsColumnsOperator = New ROperator ucrIDFCurvesSelector.Reset() ucrReceiverDateTime.SetMeAsReceiver() @@ -63,10 +65,15 @@ Public Class dlgIDFCurves clsIDFCurvesFunction.SetRCommand("IDFcurves") clsIDFCurvesFunction.AddParameter("na.code", "NA", iPosition:=0) + clsVarsColumnsOperator.SetOperation("", bBracketsTemp:=False) + clsVarsColumnsOperator.SetAssignTo("var_2") + ucrBase.clsRsyntax.SetBaseRFunction(clsIDFCurvesFunction) End Sub Private Sub SetRCodeForControls(bReset As Boolean) + ucrIDFCurvesSelector.SetRCode(clsIDFCurvesFunction, bReset) + ucrReceiverDateTime.SetRCode(clsIDFCurvesFunction, bReset) End Sub @@ -80,4 +87,19 @@ Public Class dlgIDFCurves TestOkEnabled() End Sub + Private Sub ucrReceiverDateTime_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverDateTime.ControlValueChanged + + End Sub + + Private Sub ucrReceiverPrec_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverPrec.ControlValueChanged + + End Sub + + Private Sub ucrNudMaxPrec_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrNudMaxPrec.ControlValueChanged + + End Sub + + Private Sub ucrStationName_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrStationName.ControlValueChanged + + End Sub End Class \ No newline at end of file From dd0296532edda1407714ccc5bf77da99f287ecf9 Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Wed, 13 Dec 2023 10:30:06 +0300 Subject: [PATCH 5/8] changes to the code --- instat/dlgIDFCurves.vb | 51 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/instat/dlgIDFCurves.vb b/instat/dlgIDFCurves.vb index 26087dbb953..4b5174f02be 100644 --- a/instat/dlgIDFCurves.vb +++ b/instat/dlgIDFCurves.vb @@ -19,7 +19,7 @@ Public Class dlgIDFCurves Private bFirstLoad As Boolean = True Private bReset As Boolean = True Private bResetRCode As Boolean = True - Private clsIDFCurvesFunction As New RFunction + Private clsIDFCurvesFunction, clsPmatchFunction, clsGetColumnsFunction, clsColumnsFunction As New RFunction Private clsVarsColumnsOperator As ROperator Private Sub dlgIDFCurves_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -56,24 +56,44 @@ Public Class dlgIDFCurves Private Sub SetDefaults() clsIDFCurvesFunction = New RFunction + clsPmatchFunction = New RFunction + clsGetColumnsFunction = New RFunction + + clsColumnsFunction = New RFunction + clsVarsColumnsOperator = New ROperator ucrIDFCurvesSelector.Reset() ucrReceiverDateTime.SetMeAsReceiver() + clsGetColumnsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data") + clsGetColumnsFunction.SetAssignTo("col_data") + clsIDFCurvesFunction.SetPackageName("climatol") clsIDFCurvesFunction.SetRCommand("IDFcurves") - clsIDFCurvesFunction.AddParameter("na.code", "NA", iPosition:=0) + clsIDFCurvesFunction.AddParameter("clmn", clsRFunctionParameter:=clsPmatchFunction, iPosition:=2) + clsIDFCurvesFunction.AddParameter("na.code", "NA", iPosition:=3) clsVarsColumnsOperator.SetOperation("", bBracketsTemp:=False) clsVarsColumnsOperator.SetAssignTo("var_2") + clsColumnsFunction.SetRCommand("colnames") + + + clsPmatchFunction.SetRCommand("pmatch") + clsPmatchFunction.AddParameter("elements", clsRFunctionParameter:=clsColumnsFunction, bIncludeArgumentName:=False, iPosition:=0) + clsPmatchFunction.AddParameter("duplicates.ok", "TRUE", iPosition:=1) + clsPmatchFunction.AddParameter("cols", clsROperatorParameter:=clsVarsColumnsOperator, bIncludeArgumentName:=False, iPosition:=0) + clsPmatchFunction.SetAssignTo("data_file") + ucrBase.clsRsyntax.SetBaseRFunction(clsIDFCurvesFunction) End Sub Private Sub SetRCodeForControls(bReset As Boolean) - ucrIDFCurvesSelector.SetRCode(clsIDFCurvesFunction, bReset) - ucrReceiverDateTime.SetRCode(clsIDFCurvesFunction, bReset) + ucrIDFCurvesSelector.SetRCode(clsGetColumnsFunction, bReset) + ucrReceiverDateTime.SetRCode(clsGetColumnsFunction, bReset) + ucrNudMaxPrec.SetRCode(clsIDFCurvesFunction, bReset) + ucrStationName.SetRCode(clsIDFCurvesFunction, bReset) End Sub @@ -88,18 +108,35 @@ Public Class dlgIDFCurves End Sub Private Sub ucrReceiverDateTime_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverDateTime.ControlValueChanged - + If Not ucrReceiverDateTime.IsEmpty Then + clsVarsColumnsOperator.AddParameter("cols", ucrReceiverDateTime.GetVariableNames(True), iPosition:=0, bIncludeArgumentName:=False) + Else + clsVarsColumnsOperator.RemoveParameterByName("cols") + End If End Sub Private Sub ucrReceiverPrec_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverPrec.ControlValueChanged - + If Not ucrReceiverPrec.IsEmpty Then + clsVarsColumnsOperator.AddParameter("cols", ucrReceiverPrec.GetVariableNames(True), iPosition:=0, bIncludeArgumentName:=False) + Else + clsVarsColumnsOperator.RemoveParameterByName("cols") + End If End Sub Private Sub ucrNudMaxPrec_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrNudMaxPrec.ControlValueChanged - + clsIDFCurvesFunction.AddParameter("mindpy", ucrNudMaxPrec.GetText, iPosition:=5) End Sub Private Sub ucrStationName_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrStationName.ControlValueChanged + If Not ucrStationName.IsEmpty Then + clsIDFCurvesFunction.AddParameter("stname", Chr(34) & ucrStationName.GetText & Chr(34), iPosition:=4) + Else + clsIDFCurvesFunction.RemoveParameterByName("stname") + End If + End Sub + Private Sub ucrIDFCurvesSelector_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrIDFCurvesSelector.ControlValueChanged + clsColumnsFunction.AddParameter("data", clsRCodeStructureParameter:=ucrIDFCurvesSelector.ucrAvailableDataFrames.clsCurrDataFrame, bIncludeArgumentName:=False, iPosition:=0) + clsIDFCurvesFunction.AddParameter("data", Chr(34) & ucrIDFCurvesSelector.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34), bIncludeArgumentName:=False, iPosition:=0) End Sub End Class \ No newline at end of file From 50c44c32c9bb89c16630bb866cec198a1e9ae1cb Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Fri, 15 Dec 2023 10:40:40 +0300 Subject: [PATCH 6/8] changes --- instat/dlgIDFCurves.Designer.vb | 12 +++++++ instat/dlgIDFCurves.vb | 57 ++++++++++++++++++++++----------- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/instat/dlgIDFCurves.Designer.vb b/instat/dlgIDFCurves.Designer.vb index b100d53baa4..29831b3d60d 100644 --- a/instat/dlgIDFCurves.Designer.vb +++ b/instat/dlgIDFCurves.Designer.vb @@ -32,6 +32,7 @@ Partial Class dlgIDFCurves Me.lblStationName = New System.Windows.Forms.Label() Me.ucrNudMaxPrec = New instat.ucrNud() Me.lblMinimumProp = New System.Windows.Forms.Label() + Me.ucrSave = New instat.ucrSave() Me.SuspendLayout() ' 'ucrBase @@ -140,11 +141,21 @@ Partial Class dlgIDFCurves Me.lblMinimumProp.TabIndex = 9 Me.lblMinimumProp.Text = "Minimum Proportion" ' + 'ucrSave + ' + Me.ucrSave.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrSave.Location = New System.Drawing.Point(7, 264) + Me.ucrSave.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrSave.Name = "ucrSave" + Me.ucrSave.Size = New System.Drawing.Size(401, 24) + Me.ucrSave.TabIndex = 70 + ' 'dlgIDFCurves ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(425, 355) + Me.Controls.Add(Me.ucrSave) Me.Controls.Add(Me.lblMinimumProp) Me.Controls.Add(Me.ucrNudMaxPrec) Me.Controls.Add(Me.lblStationName) @@ -176,4 +187,5 @@ Partial Class dlgIDFCurves Friend WithEvents ucrReceiverPrec As ucrReceiverSingle Friend WithEvents lblMinimumProp As Label Friend WithEvents ucrNudMaxPrec As ucrNud + Friend WithEvents ucrSave As ucrSave End Class diff --git a/instat/dlgIDFCurves.vb b/instat/dlgIDFCurves.vb index 4b5174f02be..08c661f2456 100644 --- a/instat/dlgIDFCurves.vb +++ b/instat/dlgIDFCurves.vb @@ -20,7 +20,7 @@ Public Class dlgIDFCurves Private bReset As Boolean = True Private bResetRCode As Boolean = True Private clsIDFCurvesFunction, clsPmatchFunction, clsGetColumnsFunction, clsColumnsFunction As New RFunction - Private clsVarsColumnsOperator As ROperator + Private clsVarsColumnsOperator, clsVars1ColumnsOperator As ROperator Private Sub dlgIDFCurves_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -37,6 +37,8 @@ Public Class dlgIDFCurves End Sub Private Sub InitialiseDialog() + ucrBase.clsRsyntax.iCallType = 3 + ucrIDFCurvesSelector.SetParameter(New RParameter("prdat", 0)) ucrIDFCurvesSelector.SetParameterIsrfunction() @@ -49,8 +51,19 @@ Public Class dlgIDFCurves ucrStationName.SetParameter(New RParameter("stname", 2)) ucrNudMaxPrec.SetParameter(New RParameter("mindpy", 3)) - ucrNudMaxPrec.SetMinMax(0, 1) + ucrNudMaxPrec.SetMinMax(0.0, 1.0) ucrNudMaxPrec.Increment = 0.1 + ucrNudMaxPrec.DecimalPlaces = 1 + ucrNudMaxPrec.SetRDefault(0.8) + + + 'ucrSave.SetPrefix("IDF_Curve") + 'ucrSave.SetIsComboBox() + 'ucrSave.SetCheckBoxText("Save Graph") + 'ucrSave.SetSaveTypeAsGraph() + ''ucrSave.SetSaveType(RObjectTypeLabel.Summary, strRObjectFormat:=RObjectFormat.Text) + 'ucrSave.SetDataFrameSelector(ucrIDFCurvesSelector.ucrAvailableDataFrames) + 'ucrSave.SetAssignToIfUncheckedValue("last_summary") End Sub @@ -62,6 +75,7 @@ Public Class dlgIDFCurves clsColumnsFunction = New RFunction clsVarsColumnsOperator = New ROperator + clsVars1ColumnsOperator = New ROperator ucrIDFCurvesSelector.Reset() ucrReceiverDateTime.SetMeAsReceiver() @@ -73,17 +87,26 @@ Public Class dlgIDFCurves clsIDFCurvesFunction.SetRCommand("IDFcurves") clsIDFCurvesFunction.AddParameter("clmn", clsRFunctionParameter:=clsPmatchFunction, iPosition:=2) clsIDFCurvesFunction.AddParameter("na.code", "NA", iPosition:=3) + 'clsIDFCurvesFunction.iCallType = 1 + 'clsIDFCurvesFunction.SetAssignToOutputObject(strRObjectToAssignTo:="last_summary", + ' strRObjectTypeLabelToAssignTo:=RObjectTypeLabel.Summary, + ' strRObjectFormatToAssignTo:=RObjectFormat.Text, + ' strRDataFrameNameToAddObjectTo:=ucrIDFCurvesSelector.strCurrentDataFrame, + ' strObjectName:="last_summary") + clsVarsColumnsOperator.SetOperation("", bBracketsTemp:=False) - clsVarsColumnsOperator.SetAssignTo("var_2") + clsVarsColumnsOperator.SetAssignTo("var_1") - clsColumnsFunction.SetRCommand("colnames") + clsVars1ColumnsOperator.SetOperation("", bBracketsTemp:=False) + clsVars1ColumnsOperator.SetAssignTo("var_2") + clsColumnsFunction.SetRCommand("colnames") clsPmatchFunction.SetRCommand("pmatch") clsPmatchFunction.AddParameter("elements", clsRFunctionParameter:=clsColumnsFunction, bIncludeArgumentName:=False, iPosition:=0) clsPmatchFunction.AddParameter("duplicates.ok", "TRUE", iPosition:=1) - clsPmatchFunction.AddParameter("cols", clsROperatorParameter:=clsVarsColumnsOperator, bIncludeArgumentName:=False, iPosition:=0) + clsPmatchFunction.AddParameter("cols", clsROperatorParameter:=clsVars1ColumnsOperator, bIncludeArgumentName:=False, iPosition:=0) clsPmatchFunction.SetAssignTo("data_file") ucrBase.clsRsyntax.SetBaseRFunction(clsIDFCurvesFunction) @@ -91,10 +114,15 @@ Public Class dlgIDFCurves Private Sub SetRCodeForControls(bReset As Boolean) ucrIDFCurvesSelector.SetRCode(clsGetColumnsFunction, bReset) - ucrReceiverDateTime.SetRCode(clsGetColumnsFunction, bReset) + ucrNudMaxPrec.SetRCode(clsIDFCurvesFunction, bReset) ucrStationName.SetRCode(clsIDFCurvesFunction, bReset) + 'ucrSave.SetRCode(clsIDFCurvesFunction, bReset) + If bReset Then + ucrReceiverDateTime.SetRCode(clsGetColumnsFunction, bReset) + ucrReceiverPrec.SetRCode(clsGetColumnsFunction, bReset) + End If End Sub Private Sub TestOkEnabled() @@ -107,19 +135,12 @@ Public Class dlgIDFCurves TestOkEnabled() End Sub - Private Sub ucrReceiverDateTime_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverDateTime.ControlValueChanged - If Not ucrReceiverDateTime.IsEmpty Then - clsVarsColumnsOperator.AddParameter("cols", ucrReceiverDateTime.GetVariableNames(True), iPosition:=0, bIncludeArgumentName:=False) - Else - clsVarsColumnsOperator.RemoveParameterByName("cols") - End If - End Sub - Private Sub ucrReceiverPrec_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverPrec.ControlValueChanged - If Not ucrReceiverPrec.IsEmpty Then - clsVarsColumnsOperator.AddParameter("cols", ucrReceiverPrec.GetVariableNames(True), iPosition:=0, bIncludeArgumentName:=False) + Private Sub ucrReceiverPrec_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverPrec.ControlValueChanged, ucrReceiverDateTime.ControlValueChanged + If Not ucrReceiverPrec.IsEmpty AndAlso Not ucrReceiverDateTime.IsEmpty Then + clsVars1ColumnsOperator.AddParameter("cols", "c(" & ucrReceiverDateTime.GetVariableNames() & ", " & ucrReceiverPrec.GetVariableNames() & ")", iPosition:=0, bIncludeArgumentName:=False) Else - clsVarsColumnsOperator.RemoveParameterByName("cols") + clsVars1ColumnsOperator.RemoveParameterByName("cols") End If End Sub @@ -137,6 +158,6 @@ Public Class dlgIDFCurves Private Sub ucrIDFCurvesSelector_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrIDFCurvesSelector.ControlValueChanged clsColumnsFunction.AddParameter("data", clsRCodeStructureParameter:=ucrIDFCurvesSelector.ucrAvailableDataFrames.clsCurrDataFrame, bIncludeArgumentName:=False, iPosition:=0) - clsIDFCurvesFunction.AddParameter("data", Chr(34) & ucrIDFCurvesSelector.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34), bIncludeArgumentName:=False, iPosition:=0) + clsIDFCurvesFunction.AddParameter("data", ucrIDFCurvesSelector.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, bIncludeArgumentName:=False, iPosition:=0) End Sub End Class \ No newline at end of file From 4f48d77f1031aec9b06510b65d6b20b60861ef71 Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Wed, 20 Dec 2023 16:46:40 +0300 Subject: [PATCH 7/8] changes to the dialog --- instat/dlgIDFCurves.Designer.vb | 164 ++++++++++++++++---------------- instat/dlgIDFCurves.vb | 45 ++++----- instat/frmMain.Designer.vb | 5 +- 3 files changed, 103 insertions(+), 111 deletions(-) diff --git a/instat/dlgIDFCurves.Designer.vb b/instat/dlgIDFCurves.Designer.vb index 29831b3d60d..d5264b4eda9 100644 --- a/instat/dlgIDFCurves.Designer.vb +++ b/instat/dlgIDFCurves.Designer.vb @@ -22,69 +22,23 @@ Partial Class dlgIDFCurves 'Do not modify it using the code editor. _ Private Sub InitializeComponent() - Me.ucrBase = New instat.ucrButtons() - Me.ucrIDFCurvesSelector = New instat.ucrSelectorByDataFrameAddRemove() - Me.ucrReceiverDateTime = New instat.ucrReceiverSingle() - Me.ucrReceiverPrec = New instat.ucrReceiverSingle() Me.lblDateTime = New System.Windows.Forms.Label() Me.lblRain = New System.Windows.Forms.Label() - Me.ucrStationName = New instat.ucrInputTextBox() Me.lblStationName = New System.Windows.Forms.Label() - Me.ucrNudMaxPrec = New instat.ucrNud() Me.lblMinimumProp = New System.Windows.Forms.Label() Me.ucrSave = New instat.ucrSave() + Me.ucrNudMaxPrec = New instat.ucrNud() + Me.ucrStationName = New instat.ucrInputTextBox() + Me.ucrReceiverPrec = New instat.ucrReceiverSingle() + Me.ucrReceiverDateTime = New instat.ucrReceiverSingle() + Me.ucrIDFCurvesSelector = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrBase = New instat.ucrButtons() Me.SuspendLayout() ' - 'ucrBase - ' - Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(6, 298) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(410, 52) - Me.ucrBase.TabIndex = 0 - ' - 'ucrIDFCurvesSelector - ' - Me.ucrIDFCurvesSelector.AutoSize = True - Me.ucrIDFCurvesSelector.bDropUnusedFilterLevels = False - Me.ucrIDFCurvesSelector.bShowHiddenColumns = False - Me.ucrIDFCurvesSelector.bUseCurrentFilter = True - Me.ucrIDFCurvesSelector.Location = New System.Drawing.Point(6, 16) - Me.ucrIDFCurvesSelector.Margin = New System.Windows.Forms.Padding(0) - Me.ucrIDFCurvesSelector.Name = "ucrIDFCurvesSelector" - Me.ucrIDFCurvesSelector.Size = New System.Drawing.Size(213, 183) - Me.ucrIDFCurvesSelector.TabIndex = 1 - ' - 'ucrReceiverDateTime - ' - Me.ucrReceiverDateTime.AutoSize = True - Me.ucrReceiverDateTime.frmParent = Me - Me.ucrReceiverDateTime.Location = New System.Drawing.Point(279, 72) - Me.ucrReceiverDateTime.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverDateTime.Name = "ucrReceiverDateTime" - Me.ucrReceiverDateTime.Selector = Nothing - Me.ucrReceiverDateTime.Size = New System.Drawing.Size(120, 20) - Me.ucrReceiverDateTime.strNcFilePath = "" - Me.ucrReceiverDateTime.TabIndex = 2 - Me.ucrReceiverDateTime.ucrSelector = Nothing - ' - 'ucrReceiverPrec - ' - Me.ucrReceiverPrec.AutoSize = True - Me.ucrReceiverPrec.frmParent = Me - Me.ucrReceiverPrec.Location = New System.Drawing.Point(279, 105) - Me.ucrReceiverPrec.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverPrec.Name = "ucrReceiverPrec" - Me.ucrReceiverPrec.Selector = Nothing - Me.ucrReceiverPrec.Size = New System.Drawing.Size(120, 20) - Me.ucrReceiverPrec.strNcFilePath = "" - Me.ucrReceiverPrec.TabIndex = 3 - Me.ucrReceiverPrec.ucrSelector = Nothing - ' 'lblDateTime ' Me.lblDateTime.AutoSize = True - Me.lblDateTime.Location = New System.Drawing.Point(276, 52) + Me.lblDateTime.Location = New System.Drawing.Point(290, 38) Me.lblDateTime.Name = "lblDateTime" Me.lblDateTime.Size = New System.Drawing.Size(56, 13) Me.lblDateTime.TabIndex = 4 @@ -93,49 +47,25 @@ Partial Class dlgIDFCurves 'lblRain ' Me.lblRain.AutoSize = True - Me.lblRain.Location = New System.Drawing.Point(285, 92) + Me.lblRain.Location = New System.Drawing.Point(289, 81) Me.lblRain.Name = "lblRain" Me.lblRain.Size = New System.Drawing.Size(29, 13) Me.lblRain.TabIndex = 5 Me.lblRain.Text = "Rain" ' - 'ucrStationName - ' - Me.ucrStationName.AddQuotesIfUnrecognised = True - Me.ucrStationName.AutoSize = True - Me.ucrStationName.IsMultiline = False - Me.ucrStationName.IsReadOnly = False - Me.ucrStationName.Location = New System.Drawing.Point(279, 152) - Me.ucrStationName.Name = "ucrStationName" - Me.ucrStationName.Size = New System.Drawing.Size(137, 21) - Me.ucrStationName.TabIndex = 6 - ' 'lblStationName ' Me.lblStationName.AutoSize = True - Me.lblStationName.Location = New System.Drawing.Point(281, 135) + Me.lblStationName.Location = New System.Drawing.Point(289, 128) Me.lblStationName.Name = "lblStationName" Me.lblStationName.Size = New System.Drawing.Size(71, 13) Me.lblStationName.TabIndex = 7 Me.lblStationName.Text = "Station Name" ' - 'ucrNudMaxPrec - ' - Me.ucrNudMaxPrec.AutoSize = True - Me.ucrNudMaxPrec.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudMaxPrec.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudMaxPrec.Location = New System.Drawing.Point(365, 191) - Me.ucrNudMaxPrec.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudMaxPrec.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudMaxPrec.Name = "ucrNudMaxPrec" - Me.ucrNudMaxPrec.Size = New System.Drawing.Size(50, 20) - Me.ucrNudMaxPrec.TabIndex = 8 - Me.ucrNudMaxPrec.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' 'lblMinimumProp ' Me.lblMinimumProp.AutoSize = True - Me.lblMinimumProp.Location = New System.Drawing.Point(261, 194) + Me.lblMinimumProp.Location = New System.Drawing.Point(263, 186) Me.lblMinimumProp.Name = "lblMinimumProp" Me.lblMinimumProp.Size = New System.Drawing.Size(99, 13) Me.lblMinimumProp.TabIndex = 9 @@ -144,17 +74,87 @@ Partial Class dlgIDFCurves 'ucrSave ' Me.ucrSave.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSave.Location = New System.Drawing.Point(7, 264) + Me.ucrSave.Location = New System.Drawing.Point(7, 224) Me.ucrSave.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrSave.Name = "ucrSave" Me.ucrSave.Size = New System.Drawing.Size(401, 24) Me.ucrSave.TabIndex = 70 ' + 'ucrNudMaxPrec + ' + Me.ucrNudMaxPrec.AutoSize = True + Me.ucrNudMaxPrec.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudMaxPrec.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudMaxPrec.Location = New System.Drawing.Point(365, 183) + Me.ucrNudMaxPrec.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudMaxPrec.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudMaxPrec.Name = "ucrNudMaxPrec" + Me.ucrNudMaxPrec.Size = New System.Drawing.Size(50, 20) + Me.ucrNudMaxPrec.TabIndex = 8 + Me.ucrNudMaxPrec.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrStationName + ' + Me.ucrStationName.AddQuotesIfUnrecognised = True + Me.ucrStationName.AutoSize = True + Me.ucrStationName.IsMultiline = False + Me.ucrStationName.IsReadOnly = False + Me.ucrStationName.Location = New System.Drawing.Point(286, 144) + Me.ucrStationName.Name = "ucrStationName" + Me.ucrStationName.Size = New System.Drawing.Size(130, 21) + Me.ucrStationName.TabIndex = 6 + ' + 'ucrReceiverPrec + ' + Me.ucrReceiverPrec.AutoSize = True + Me.ucrReceiverPrec.frmParent = Me + Me.ucrReceiverPrec.Location = New System.Drawing.Point(286, 98) + Me.ucrReceiverPrec.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverPrec.Name = "ucrReceiverPrec" + Me.ucrReceiverPrec.Selector = Nothing + Me.ucrReceiverPrec.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverPrec.strNcFilePath = "" + Me.ucrReceiverPrec.TabIndex = 3 + Me.ucrReceiverPrec.ucrSelector = Nothing + ' + 'ucrReceiverDateTime + ' + Me.ucrReceiverDateTime.AutoSize = True + Me.ucrReceiverDateTime.frmParent = Me + Me.ucrReceiverDateTime.Location = New System.Drawing.Point(286, 55) + Me.ucrReceiverDateTime.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverDateTime.Name = "ucrReceiverDateTime" + Me.ucrReceiverDateTime.Selector = Nothing + Me.ucrReceiverDateTime.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverDateTime.strNcFilePath = "" + Me.ucrReceiverDateTime.TabIndex = 2 + Me.ucrReceiverDateTime.ucrSelector = Nothing + ' + 'ucrIDFCurvesSelector + ' + Me.ucrIDFCurvesSelector.AutoSize = True + Me.ucrIDFCurvesSelector.bDropUnusedFilterLevels = False + Me.ucrIDFCurvesSelector.bShowHiddenColumns = False + Me.ucrIDFCurvesSelector.bUseCurrentFilter = True + Me.ucrIDFCurvesSelector.Location = New System.Drawing.Point(6, 8) + Me.ucrIDFCurvesSelector.Margin = New System.Windows.Forms.Padding(0) + Me.ucrIDFCurvesSelector.Name = "ucrIDFCurvesSelector" + Me.ucrIDFCurvesSelector.Size = New System.Drawing.Size(213, 183) + Me.ucrIDFCurvesSelector.TabIndex = 1 + ' + 'ucrBase + ' + Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrBase.Location = New System.Drawing.Point(6, 258) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(410, 52) + Me.ucrBase.TabIndex = 0 + ' 'dlgIDFCurves ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(425, 355) + Me.ClientSize = New System.Drawing.Size(417, 329) Me.Controls.Add(Me.ucrSave) Me.Controls.Add(Me.lblMinimumProp) Me.Controls.Add(Me.ucrNudMaxPrec) diff --git a/instat/dlgIDFCurves.vb b/instat/dlgIDFCurves.vb index 08c661f2456..e046763b097 100644 --- a/instat/dlgIDFCurves.vb +++ b/instat/dlgIDFCurves.vb @@ -37,7 +37,7 @@ Public Class dlgIDFCurves End Sub Private Sub InitialiseDialog() - ucrBase.clsRsyntax.iCallType = 3 + ucrBase.clsRsyntax.bSeparateThread = False ucrIDFCurvesSelector.SetParameter(New RParameter("prdat", 0)) ucrIDFCurvesSelector.SetParameterIsrfunction() @@ -56,14 +56,12 @@ Public Class dlgIDFCurves ucrNudMaxPrec.DecimalPlaces = 1 ucrNudMaxPrec.SetRDefault(0.8) - - 'ucrSave.SetPrefix("IDF_Curve") - 'ucrSave.SetIsComboBox() - 'ucrSave.SetCheckBoxText("Save Graph") - 'ucrSave.SetSaveTypeAsGraph() - ''ucrSave.SetSaveType(RObjectTypeLabel.Summary, strRObjectFormat:=RObjectFormat.Text) - 'ucrSave.SetDataFrameSelector(ucrIDFCurvesSelector.ucrAvailableDataFrames) - 'ucrSave.SetAssignToIfUncheckedValue("last_summary") + ucrSave.SetPrefix("Prec_accum") + ucrSave.SetIsComboBox() + ucrSave.SetCheckBoxText("Save DataFrame") + ucrSave.SetSaveTypeAsDataFrame() + ucrSave.SetDataFrameSelector(ucrIDFCurvesSelector.ucrAvailableDataFrames) + ucrSave.SetAssignToIfUncheckedValue("last_accum") End Sub @@ -83,18 +81,6 @@ Public Class dlgIDFCurves clsGetColumnsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data") clsGetColumnsFunction.SetAssignTo("col_data") - clsIDFCurvesFunction.SetPackageName("climatol") - clsIDFCurvesFunction.SetRCommand("IDFcurves") - clsIDFCurvesFunction.AddParameter("clmn", clsRFunctionParameter:=clsPmatchFunction, iPosition:=2) - clsIDFCurvesFunction.AddParameter("na.code", "NA", iPosition:=3) - 'clsIDFCurvesFunction.iCallType = 1 - 'clsIDFCurvesFunction.SetAssignToOutputObject(strRObjectToAssignTo:="last_summary", - ' strRObjectTypeLabelToAssignTo:=RObjectTypeLabel.Summary, - ' strRObjectFormatToAssignTo:=RObjectFormat.Text, - ' strRDataFrameNameToAddObjectTo:=ucrIDFCurvesSelector.strCurrentDataFrame, - ' strObjectName:="last_summary") - - clsVarsColumnsOperator.SetOperation("", bBracketsTemp:=False) clsVarsColumnsOperator.SetAssignTo("var_1") @@ -109,15 +95,20 @@ Public Class dlgIDFCurves clsPmatchFunction.AddParameter("cols", clsROperatorParameter:=clsVars1ColumnsOperator, bIncludeArgumentName:=False, iPosition:=0) clsPmatchFunction.SetAssignTo("data_file") + clsIDFCurvesFunction.SetPackageName("climatol") + clsIDFCurvesFunction.SetRCommand("IDFcurves") + clsIDFCurvesFunction.AddParameter("clmn", clsRFunctionParameter:=clsPmatchFunction, iPosition:=2) + clsIDFCurvesFunction.AddParameter("na.code", "NA", iPosition:=3) + ucrBase.clsRsyntax.SetBaseRFunction(clsIDFCurvesFunction) + ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = True End Sub Private Sub SetRCodeForControls(bReset As Boolean) ucrIDFCurvesSelector.SetRCode(clsGetColumnsFunction, bReset) - ucrNudMaxPrec.SetRCode(clsIDFCurvesFunction, bReset) ucrStationName.SetRCode(clsIDFCurvesFunction, bReset) - 'ucrSave.SetRCode(clsIDFCurvesFunction, bReset) + ucrSave.SetRCode(clsIDFCurvesFunction, bReset) If bReset Then ucrReceiverDateTime.SetRCode(clsGetColumnsFunction, bReset) @@ -126,7 +117,7 @@ Public Class dlgIDFCurves End Sub Private Sub TestOkEnabled() - + ucrBase.OKEnabled(Not ucrReceiverDateTime.IsEmpty AndAlso Not ucrReceiverPrec.IsEmpty AndAlso Not ucrStationName.IsEmpty) End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset @@ -135,7 +126,6 @@ Public Class dlgIDFCurves TestOkEnabled() End Sub - Private Sub ucrReceiverPrec_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverPrec.ControlValueChanged, ucrReceiverDateTime.ControlValueChanged If Not ucrReceiverPrec.IsEmpty AndAlso Not ucrReceiverDateTime.IsEmpty Then clsVars1ColumnsOperator.AddParameter("cols", "c(" & ucrReceiverDateTime.GetVariableNames() & ", " & ucrReceiverPrec.GetVariableNames() & ")", iPosition:=0, bIncludeArgumentName:=False) @@ -160,4 +150,9 @@ Public Class dlgIDFCurves clsColumnsFunction.AddParameter("data", clsRCodeStructureParameter:=ucrIDFCurvesSelector.ucrAvailableDataFrames.clsCurrDataFrame, bIncludeArgumentName:=False, iPosition:=0) clsIDFCurvesFunction.AddParameter("data", ucrIDFCurvesSelector.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, bIncludeArgumentName:=False, iPosition:=0) End Sub + + Private Sub ucrReceiverDateTime_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverDateTime.ControlContentsChanged, +ucrReceiverPrec.ControlContentsChanged, ucrStationName.ControlContentsChanged + TestOkEnabled() + End Sub End Class \ No newline at end of file diff --git a/instat/frmMain.Designer.vb b/instat/frmMain.Designer.vb index 8b97727f1a8..83ed55fd58a 100644 --- a/instat/frmMain.Designer.vb +++ b/instat/frmMain.Designer.vb @@ -2190,7 +2190,6 @@ Partial Class frmMain ' 'mnuClimaticDescribeIDF ' - Me.mnuClimaticDescribeIDF.Enabled = False Me.mnuClimaticDescribeIDF.Name = "mnuClimaticDescribeIDF" Me.mnuClimaticDescribeIDF.Size = New System.Drawing.Size(211, 22) Me.mnuClimaticDescribeIDF.Text = "IDF..." @@ -5092,9 +5091,7 @@ Partial Class frmMain Me.IsMdiContainer = True Me.MainMenuStrip = Me.mnuBar Me.Name = "frmMain" - Me.Text = "R-Instat " + My.Application.Info.Version.Major.ToString + "." + - My.Application.Info.Version.Minor.ToString + "." + - My.Application.Info.Version.Build.ToString + Me.Text = "R-Instat .." Me.WindowState = System.Windows.Forms.FormWindowState.Maximized Me.stsStrip.ResumeLayout(False) Me.stsStrip.PerformLayout() From 92262b51db78e6c66ba44f5c3b47ff713b00fd6b Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Fri, 19 Jan 2024 10:17:56 +0300 Subject: [PATCH 8/8] changes to the code --- instat/dlgIDFCurves.vb | 15 ++++++++++++--- instat/frmMain.Designer.vb | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/instat/dlgIDFCurves.vb b/instat/dlgIDFCurves.vb index e046763b097..d0e3ce284eb 100644 --- a/instat/dlgIDFCurves.vb +++ b/instat/dlgIDFCurves.vb @@ -135,7 +135,11 @@ Public Class dlgIDFCurves End Sub Private Sub ucrNudMaxPrec_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrNudMaxPrec.ControlValueChanged - clsIDFCurvesFunction.AddParameter("mindpy", ucrNudMaxPrec.GetText, iPosition:=5) + If Not ucrNudMaxPrec.IsEmpty Then + clsIDFCurvesFunction.AddParameter("mindpy", ucrNudMaxPrec.GetText, iPosition:=5) + Else + clsIDFCurvesFunction.RemoveParameterByName("mindpy") + End If End Sub Private Sub ucrStationName_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrStationName.ControlValueChanged @@ -147,8 +151,13 @@ Public Class dlgIDFCurves End Sub Private Sub ucrIDFCurvesSelector_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrIDFCurvesSelector.ControlValueChanged - clsColumnsFunction.AddParameter("data", clsRCodeStructureParameter:=ucrIDFCurvesSelector.ucrAvailableDataFrames.clsCurrDataFrame, bIncludeArgumentName:=False, iPosition:=0) - clsIDFCurvesFunction.AddParameter("data", ucrIDFCurvesSelector.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, bIncludeArgumentName:=False, iPosition:=0) + If Not ucrIDFCurvesSelector.IsEmpty Then + clsColumnsFunction.AddParameter("data", clsRCodeStructureParameter:=ucrIDFCurvesSelector.ucrAvailableDataFrames.clsCurrDataFrame, bIncludeArgumentName:=False, iPosition:=0) + clsIDFCurvesFunction.AddParameter("data", ucrIDFCurvesSelector.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem, bIncludeArgumentName:=False, iPosition:=0) + Else + clsColumnsFunction.RemoveParameterByName("data") + clsIDFCurvesFunction.RemoveParameterByName("data") + End If End Sub Private Sub ucrReceiverDateTime_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverDateTime.ControlContentsChanged, diff --git a/instat/frmMain.Designer.vb b/instat/frmMain.Designer.vb index aed32956f7f..feea27fc959 100644 --- a/instat/frmMain.Designer.vb +++ b/instat/frmMain.Designer.vb @@ -5103,6 +5103,9 @@ Partial Class frmMain Me.MainMenuStrip = Me.mnuBar Me.Margin = New System.Windows.Forms.Padding(4) Me.Name = "frmMain" + Me.Text = "R-Instat " + My.Application.Info.Version.Major.ToString + "." + + My.Application.Info.Version.Minor.ToString + "." + + My.Application.Info.Version.Build.ToString Me.Text = "R-Instat .." Me.WindowState = System.Windows.Forms.FormWindowState.Maximized Me.stsStrip.ResumeLayout(False)