From 86fd2bbb33b40b0c3bd08b849f9431d06581f9a7 Mon Sep 17 00:00:00 2001 From: Lunalo Date: Tue, 6 Dec 2016 11:57:52 +0300 Subject: [PATCH 01/72] Redesigning start of rains dialog --- instat/dlgStartofRains.Designer.vb | 541 +++++++++++++++++------------ instat/dlgStartofRains.vb | 72 ++-- 2 files changed, 353 insertions(+), 260 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index 41fe5b59f7d..7dc59108ff4 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -1,9 +1,9 @@ - _ + Partial Class dlgStartofRains Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. - _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then @@ -20,224 +20,320 @@ Partial Class dlgStartofRains 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. - _ + Private Sub InitializeComponent() - Me.lblEarliest = New System.Windows.Forms.Label() - Me.nudNumberofRainDays = New System.Windows.Forms.NumericUpDown() - Me.lblThreshold = New System.Windows.Forms.Label() - Me.lblNumberRainDays = New System.Windows.Forms.Label() - Me.lblTotalRain = New System.Windows.Forms.Label() - Me.nudTotalRain = New System.Windows.Forms.NumericUpDown() - Me.chkDrySpell = New System.Windows.Forms.CheckBox() - Me.nudWithin = New System.Windows.Forms.NumericUpDown() - Me.lblWithin = New System.Windows.Forms.Label() - Me.lblDryLength = New System.Windows.Forms.Label() - Me.nudDryLength = New System.Windows.Forms.NumericUpDown() - Me.lblDays = New System.Windows.Forms.Label() - Me.lblColumnName = New System.Windows.Forms.Label() - Me.nudEarliest = New System.Windows.Forms.NumericUpDown() - Me.nudThreashold = New System.Windows.Forms.NumericUpDown() + Me.nudValue = New System.Windows.Forms.NumericUpDown() + Me.nudMinimum = New System.Windows.Forms.NumericUpDown() Me.ucrBase = New instat.ucrButtons() - Me.ucrInputColumnName = New instat.ucrInputTextBox() - Me.UcrDialogDisabled1 = New instat.ucrDialogDisabled() - CType(Me.nudNumberofRainDays, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.nudTotalRain, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.nudWithin, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.nudDryLength, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.nudEarliest, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.nudThreashold, System.ComponentModel.ISupportInitialize).BeginInit() + Me.ucrSelectorForStartofRains = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrReceiverRainfall = New instat.ucrReceiverSingle() + Me.ucrReceiverDate = New instat.ucrReceiverSingle() + Me.lblRainfall = New System.Windows.Forms.Label() + Me.lblDate = New System.Windows.Forms.Label() + Me.grpConditionsForSatrtofRains = New System.Windows.Forms.GroupBox() + Me.nudLengthofTime = New System.Windows.Forms.NumericUpDown() + Me.nudMaximumDays = New System.Windows.Forms.NumericUpDown() + Me.lblLengthofTime = New System.Windows.Forms.Label() + Me.lblMaximumDays = New System.Windows.Forms.Label() + Me.lblVal = New System.Windows.Forms.Label() + Me.lblMinimum = New System.Windows.Forms.Label() + Me.chkDrySpell = New System.Windows.Forms.CheckBox() + Me.chkTotalRainfall = New System.Windows.Forms.CheckBox() + Me.chkConsecutiveRainyDays = New System.Windows.Forms.CheckBox() + Me.grpRainParameters = New System.Windows.Forms.GroupBox() + Me.nudFrom = New System.Windows.Forms.NumericUpDown() + Me.lblFrom = New System.Windows.Forms.Label() + Me.nudThreshold = New System.Windows.Forms.NumericUpDown() + Me.nudOverDays = New System.Windows.Forms.NumericUpDown() + Me.nudTo = New System.Windows.Forms.NumericUpDown() + Me.lblTo = New System.Windows.Forms.Label() + Me.lblThreshold = New System.Windows.Forms.Label() + Me.lblOverDays = New System.Windows.Forms.Label() + CType(Me.nudValue, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudMinimum, System.ComponentModel.ISupportInitialize).BeginInit() + Me.grpConditionsForSatrtofRains.SuspendLayout() + CType(Me.nudLengthofTime, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudMaximumDays, System.ComponentModel.ISupportInitialize).BeginInit() + Me.grpRainParameters.SuspendLayout() + CType(Me.nudFrom, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudThreshold, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudOverDays, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudTo, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' - 'lblEarliest - ' - Me.lblEarliest.AutoSize = True - Me.lblEarliest.Location = New System.Drawing.Point(9, 15) - Me.lblEarliest.Name = "lblEarliest" - Me.lblEarliest.Size = New System.Drawing.Size(66, 13) - Me.lblEarliest.TabIndex = 2 - Me.lblEarliest.Tag = "Earliest_day" - Me.lblEarliest.Text = "Earliest Day:" - ' - 'nudNumberofRainDays - ' - Me.nudNumberofRainDays.Location = New System.Drawing.Point(133, 60) - Me.nudNumberofRainDays.Name = "nudNumberofRainDays" - Me.nudNumberofRainDays.Size = New System.Drawing.Size(53, 20) - Me.nudNumberofRainDays.TabIndex = 4 - Me.nudNumberofRainDays.Value = New Decimal(New Integer() {2, 0, 0, 0}) - ' - 'lblThreshold - ' - Me.lblThreshold.AutoSize = True - Me.lblThreshold.Location = New System.Drawing.Point(9, 40) - Me.lblThreshold.Name = "lblThreshold" - Me.lblThreshold.Size = New System.Drawing.Size(57, 13) - Me.lblThreshold.TabIndex = 5 - Me.lblThreshold.Tag = "Threshold" - Me.lblThreshold.Text = "Threshold:" + 'nudValue ' - 'lblNumberRainDays + Me.nudValue.Location = New System.Drawing.Point(173, 77) + Me.nudValue.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) + Me.nudValue.Name = "nudValue" + Me.nudValue.Size = New System.Drawing.Size(48, 20) + Me.nudValue.TabIndex = 4 + Me.nudValue.Value = New Decimal(New Integer() {30, 0, 0, 0}) ' - Me.lblNumberRainDays.AutoSize = True - Me.lblNumberRainDays.Location = New System.Drawing.Point(9, 65) - Me.lblNumberRainDays.Name = "lblNumberRainDays" - Me.lblNumberRainDays.Size = New System.Drawing.Size(111, 13) - Me.lblNumberRainDays.TabIndex = 7 - Me.lblNumberRainDays.Tag = "Number_of_Rain_Days" - Me.lblNumberRainDays.Text = "Number of Rain Days:" + 'nudMinimum ' - 'lblTotalRain + Me.nudMinimum.Location = New System.Drawing.Point(173, 37) + Me.nudMinimum.Name = "nudMinimum" + Me.nudMinimum.Size = New System.Drawing.Size(45, 20) + Me.nudMinimum.TabIndex = 2 + Me.nudMinimum.Value = New Decimal(New Integer() {10, 0, 0, 0}) ' - Me.lblTotalRain.AutoSize = True - Me.lblTotalRain.Location = New System.Drawing.Point(10, 90) - Me.lblTotalRain.Name = "lblTotalRain" - Me.lblTotalRain.Size = New System.Drawing.Size(59, 13) - Me.lblTotalRain.TabIndex = 8 - Me.lblTotalRain.Tag = "Total_Rain" - Me.lblTotalRain.Text = "Total Rain:" + 'ucrBase ' - 'nudTotalRain + Me.ucrBase.Location = New System.Drawing.Point(9, 375) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.TabIndex = 0 ' - Me.nudTotalRain.Location = New System.Drawing.Point(133, 85) - Me.nudTotalRain.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) - Me.nudTotalRain.Name = "nudTotalRain" - Me.nudTotalRain.Size = New System.Drawing.Size(53, 20) - Me.nudTotalRain.TabIndex = 9 - Me.nudTotalRain.Value = New Decimal(New Integer() {20, 0, 0, 0}) + 'ucrSelectorForStartofRains + ' + Me.ucrSelectorForStartofRains.bShowHiddenColumns = False + Me.ucrSelectorForStartofRains.bUseCurrentFilter = True + Me.ucrSelectorForStartofRains.Location = New System.Drawing.Point(9, 9) + Me.ucrSelectorForStartofRains.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorForStartofRains.Name = "ucrSelectorForStartofRains" + Me.ucrSelectorForStartofRains.Size = New System.Drawing.Size(210, 180) + Me.ucrSelectorForStartofRains.TabIndex = 0 + ' + 'ucrReceiverRainfall + ' + Me.ucrReceiverRainfall.Location = New System.Drawing.Point(234, 26) + Me.ucrReceiverRainfall.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverRainfall.Name = "ucrReceiverRainfall" + Me.ucrReceiverRainfall.Selector = Nothing + Me.ucrReceiverRainfall.Size = New System.Drawing.Size(144, 20) + Me.ucrReceiverRainfall.TabIndex = 2 + ' + 'ucrReceiverDate + ' + Me.ucrReceiverDate.Location = New System.Drawing.Point(234, 65) + Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverDate.Name = "ucrReceiverDate" + Me.ucrReceiverDate.Selector = Nothing + Me.ucrReceiverDate.Size = New System.Drawing.Size(144, 20) + Me.ucrReceiverDate.TabIndex = 4 + ' + 'lblRainfall + ' + Me.lblRainfall.AutoSize = True + Me.lblRainfall.Location = New System.Drawing.Point(231, 9) + Me.lblRainfall.Name = "lblRainfall" + Me.lblRainfall.Size = New System.Drawing.Size(45, 13) + Me.lblRainfall.TabIndex = 1 + Me.lblRainfall.Text = "Rainfall:" + ' + 'lblDate + ' + Me.lblDate.AutoSize = True + Me.lblDate.Location = New System.Drawing.Point(234, 49) + Me.lblDate.Name = "lblDate" + Me.lblDate.Size = New System.Drawing.Size(33, 13) + Me.lblDate.TabIndex = 3 + Me.lblDate.Text = "Date:" + ' + 'grpConditionsForSatrtofRains + ' + Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudLengthofTime) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudMaximumDays) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblLengthofTime) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblMaximumDays) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblVal) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblMinimum) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.chkDrySpell) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.chkTotalRainfall) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.chkConsecutiveRainyDays) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudMinimum) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudValue) + Me.grpConditionsForSatrtofRains.Location = New System.Drawing.Point(9, 201) + Me.grpConditionsForSatrtofRains.Name = "grpConditionsForSatrtofRains" + Me.grpConditionsForSatrtofRains.Size = New System.Drawing.Size(369, 168) + Me.grpConditionsForSatrtofRains.TabIndex = 7 + Me.grpConditionsForSatrtofRains.TabStop = False + Me.grpConditionsForSatrtofRains.Text = "Conditions for Start of Rains" + ' + 'nudLengthofTime + ' + Me.nudLengthofTime.Location = New System.Drawing.Point(173, 144) + Me.nudLengthofTime.Name = "nudLengthofTime" + Me.nudLengthofTime.Size = New System.Drawing.Size(48, 20) + Me.nudLengthofTime.TabIndex = 9 + ' + 'nudMaximumDays + ' + Me.nudMaximumDays.Location = New System.Drawing.Point(173, 118) + Me.nudMaximumDays.Name = "nudMaximumDays" + Me.nudMaximumDays.Size = New System.Drawing.Size(48, 20) + Me.nudMaximumDays.TabIndex = 7 + ' + 'lblLengthofTime + ' + Me.lblLengthofTime.AutoSize = True + Me.lblLengthofTime.Location = New System.Drawing.Point(86, 144) + Me.lblLengthofTime.Name = "lblLengthofTime" + Me.lblLengthofTime.Size = New System.Drawing.Size(81, 13) + Me.lblLengthofTime.TabIndex = 8 + Me.lblLengthofTime.Text = "Length of Time:" + ' + 'lblMaximumDays + ' + Me.lblMaximumDays.AutoSize = True + Me.lblMaximumDays.Location = New System.Drawing.Point(86, 121) + Me.lblMaximumDays.Name = "lblMaximumDays" + Me.lblMaximumDays.Size = New System.Drawing.Size(81, 13) + Me.lblMaximumDays.TabIndex = 6 + Me.lblMaximumDays.Text = "Maximum Days:" + ' + 'lblVal + ' + Me.lblVal.AutoSize = True + Me.lblVal.Location = New System.Drawing.Point(130, 84) + Me.lblVal.Name = "lblVal" + Me.lblVal.Size = New System.Drawing.Size(37, 13) + Me.lblVal.TabIndex = 3 + Me.lblVal.Text = "Value:" + ' + 'lblMinimum + ' + Me.lblMinimum.AutoSize = True + Me.lblMinimum.Location = New System.Drawing.Point(116, 44) + Me.lblMinimum.Name = "lblMinimum" + Me.lblMinimum.Size = New System.Drawing.Size(51, 13) + Me.lblMinimum.TabIndex = 1 + Me.lblMinimum.Text = "Minimum:" ' 'chkDrySpell ' Me.chkDrySpell.AutoSize = True - Me.chkDrySpell.Location = New System.Drawing.Point(14, 135) + Me.chkDrySpell.Location = New System.Drawing.Point(6, 100) Me.chkDrySpell.Name = "chkDrySpell" Me.chkDrySpell.Size = New System.Drawing.Size(68, 17) - Me.chkDrySpell.TabIndex = 10 - Me.chkDrySpell.Tag = "Dry_Spell" + Me.chkDrySpell.TabIndex = 5 Me.chkDrySpell.Text = "Dry Spell" Me.chkDrySpell.UseVisualStyleBackColor = True ' - 'nudWithin - ' - Me.nudWithin.Location = New System.Drawing.Point(151, 174) - Me.nudWithin.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) - Me.nudWithin.Name = "nudWithin" - Me.nudWithin.Size = New System.Drawing.Size(35, 20) - Me.nudWithin.TabIndex = 14 - Me.nudWithin.Value = New Decimal(New Integer() {30, 0, 0, 0}) - ' - 'lblWithin - ' - Me.lblWithin.AutoSize = True - Me.lblWithin.Location = New System.Drawing.Point(106, 178) - Me.lblWithin.Name = "lblWithin" - Me.lblWithin.Size = New System.Drawing.Size(37, 13) - Me.lblWithin.TabIndex = 13 - Me.lblWithin.Tag = "Within" - Me.lblWithin.Text = "Within" - ' - 'lblDryLength - ' - Me.lblDryLength.AutoSize = True - Me.lblDryLength.Location = New System.Drawing.Point(23, 158) - Me.lblDryLength.Name = "lblDryLength" - Me.lblDryLength.Size = New System.Drawing.Size(100, 13) - Me.lblDryLength.TabIndex = 12 - Me.lblDryLength.Tag = "Length_of_Dry_Spell" - Me.lblDryLength.Text = "Length of Dry Spell:" - ' - 'nudDryLength - ' - Me.nudDryLength.Location = New System.Drawing.Point(65, 174) - Me.nudDryLength.Name = "nudDryLength" - Me.nudDryLength.Size = New System.Drawing.Size(35, 20) - Me.nudDryLength.TabIndex = 11 - Me.nudDryLength.Value = New Decimal(New Integer() {10, 0, 0, 0}) - ' - 'lblDays - ' - Me.lblDays.AutoSize = True - Me.lblDays.Location = New System.Drawing.Point(192, 176) - Me.lblDays.Name = "lblDays" - Me.lblDays.Size = New System.Drawing.Size(31, 13) - Me.lblDays.TabIndex = 15 - Me.lblDays.Tag = "Days" - Me.lblDays.Text = "Days" - ' - 'lblColumnName - ' - Me.lblColumnName.AutoSize = True - Me.lblColumnName.Location = New System.Drawing.Point(11, 221) - Me.lblColumnName.Name = "lblColumnName" - Me.lblColumnName.Size = New System.Drawing.Size(76, 13) - Me.lblColumnName.TabIndex = 16 - Me.lblColumnName.Tag = "Column_Name" - Me.lblColumnName.Text = "Column Name:" - ' - 'nudEarliest - ' - Me.nudEarliest.Location = New System.Drawing.Point(133, 12) - Me.nudEarliest.Maximum = New Decimal(New Integer() {366, 0, 0, 0}) - Me.nudEarliest.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.nudEarliest.Name = "nudEarliest" - Me.nudEarliest.Size = New System.Drawing.Size(53, 20) - Me.nudEarliest.TabIndex = 18 - Me.nudEarliest.Value = New Decimal(New Integer() {92, 0, 0, 0}) - ' - 'nudThreashold - ' - Me.nudThreashold.DecimalPlaces = 2 - Me.nudThreashold.Increment = New Decimal(New Integer() {1, 0, 0, 65536}) - Me.nudThreashold.Location = New System.Drawing.Point(133, 36) - Me.nudThreashold.Name = "nudThreashold" - Me.nudThreashold.Size = New System.Drawing.Size(53, 20) - Me.nudThreashold.TabIndex = 19 - Me.nudThreashold.Value = New Decimal(New Integer() {85, 0, 0, 131072}) - ' - 'ucrBase - ' - Me.ucrBase.Location = New System.Drawing.Point(12, 245) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(409, 52) - Me.ucrBase.TabIndex = 0 + 'chkTotalRainfall + ' + Me.chkTotalRainfall.AutoSize = True + Me.chkTotalRainfall.Location = New System.Drawing.Point(6, 60) + Me.chkTotalRainfall.Name = "chkTotalRainfall" + Me.chkTotalRainfall.Size = New System.Drawing.Size(88, 17) + Me.chkTotalRainfall.TabIndex = 1 + Me.chkTotalRainfall.Text = "Total Rainfall" + Me.chkTotalRainfall.UseVisualStyleBackColor = True + ' + 'chkConsecutiveRainyDays + ' + Me.chkConsecutiveRainyDays.AutoSize = True + Me.chkConsecutiveRainyDays.Location = New System.Drawing.Point(7, 20) + Me.chkConsecutiveRainyDays.Name = "chkConsecutiveRainyDays" + Me.chkConsecutiveRainyDays.Size = New System.Drawing.Size(142, 17) + Me.chkConsecutiveRainyDays.TabIndex = 0 + Me.chkConsecutiveRainyDays.Text = "Consecutive Rainy Days" + Me.chkConsecutiveRainyDays.UseVisualStyleBackColor = True + ' + 'grpRainParameters + ' + Me.grpRainParameters.Controls.Add(Me.nudFrom) + Me.grpRainParameters.Controls.Add(Me.lblFrom) + Me.grpRainParameters.Controls.Add(Me.nudThreshold) + Me.grpRainParameters.Controls.Add(Me.nudOverDays) + Me.grpRainParameters.Controls.Add(Me.nudTo) + Me.grpRainParameters.Controls.Add(Me.lblTo) + Me.grpRainParameters.Controls.Add(Me.lblThreshold) + Me.grpRainParameters.Controls.Add(Me.lblOverDays) + Me.grpRainParameters.Location = New System.Drawing.Point(234, 88) + Me.grpRainParameters.Name = "grpRainParameters" + Me.grpRainParameters.Size = New System.Drawing.Size(144, 113) + Me.grpRainParameters.TabIndex = 5 + Me.grpRainParameters.TabStop = False + ' + 'nudFrom + ' + Me.nudFrom.Location = New System.Drawing.Point(81, 9) + Me.nudFrom.Name = "nudFrom" + Me.nudFrom.Size = New System.Drawing.Size(55, 20) + Me.nudFrom.TabIndex = 1 + ' + 'lblFrom + ' + Me.lblFrom.AutoSize = True + Me.lblFrom.Location = New System.Drawing.Point(31, 11) + Me.lblFrom.Name = "lblFrom" + Me.lblFrom.Size = New System.Drawing.Size(33, 13) + Me.lblFrom.TabIndex = 0 + Me.lblFrom.Text = "From:" + ' + 'nudThreshold + ' + Me.nudThreshold.DecimalPlaces = 2 + Me.nudThreshold.Increment = New Decimal(New Integer() {1, 0, 0, 65536}) + Me.nudThreshold.Location = New System.Drawing.Point(81, 61) + Me.nudThreshold.Name = "nudThreshold" + Me.nudThreshold.Size = New System.Drawing.Size(53, 20) + Me.nudThreshold.TabIndex = 5 + Me.nudThreshold.Value = New Decimal(New Integer() {85, 0, 0, 131072}) + ' + 'nudOverDays + ' + Me.nudOverDays.Location = New System.Drawing.Point(81, 87) + Me.nudOverDays.Maximum = New Decimal(New Integer() {366, 0, 0, 0}) + Me.nudOverDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudOverDays.Name = "nudOverDays" + Me.nudOverDays.Size = New System.Drawing.Size(53, 20) + Me.nudOverDays.TabIndex = 7 + Me.nudOverDays.Value = New Decimal(New Integer() {92, 0, 0, 0}) + ' + 'nudTo + ' + Me.nudTo.Location = New System.Drawing.Point(81, 35) + Me.nudTo.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) + Me.nudTo.Name = "nudTo" + Me.nudTo.Size = New System.Drawing.Size(53, 20) + Me.nudTo.TabIndex = 3 + Me.nudTo.Value = New Decimal(New Integer() {20, 0, 0, 0}) + ' + 'lblTo + ' + Me.lblTo.AutoSize = True + Me.lblTo.Location = New System.Drawing.Point(41, 37) + Me.lblTo.Name = "lblTo" + Me.lblTo.Size = New System.Drawing.Size(23, 13) + Me.lblTo.TabIndex = 2 + Me.lblTo.Tag = "" + Me.lblTo.Text = "To:" ' - 'ucrInputColumnName + 'lblThreshold ' - Me.ucrInputColumnName.IsReadOnly = False - Me.ucrInputColumnName.Location = New System.Drawing.Point(95, 218) - Me.ucrInputColumnName.Name = "ucrInputColumnName" - Me.ucrInputColumnName.Size = New System.Drawing.Size(142, 21) - Me.ucrInputColumnName.TabIndex = 20 + Me.lblThreshold.AutoSize = True + Me.lblThreshold.Location = New System.Drawing.Point(7, 63) + Me.lblThreshold.Name = "lblThreshold" + Me.lblThreshold.Size = New System.Drawing.Size(57, 13) + Me.lblThreshold.TabIndex = 4 + Me.lblThreshold.Tag = "Threshold" + Me.lblThreshold.Text = "Threshold:" ' - 'UcrDialogDisabled1 + 'lblOverDays ' - Me.UcrDialogDisabled1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.UcrDialogDisabled1.Location = New System.Drawing.Point(88, 141) - Me.UcrDialogDisabled1.Name = "UcrDialogDisabled1" - Me.UcrDialogDisabled1.Size = New System.Drawing.Size(240, 50) - Me.UcrDialogDisabled1.TabIndex = 21 + Me.lblOverDays.AutoSize = True + Me.lblOverDays.Location = New System.Drawing.Point(7, 91) + Me.lblOverDays.Name = "lblOverDays" + Me.lblOverDays.Size = New System.Drawing.Size(60, 13) + Me.lblOverDays.TabIndex = 6 + Me.lblOverDays.Tag = "" + Me.lblOverDays.Text = "Over Days:" ' 'dlgStartofRains ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(419, 304) - Me.Controls.Add(Me.UcrDialogDisabled1) - Me.Controls.Add(Me.ucrInputColumnName) - Me.Controls.Add(Me.nudThreashold) - Me.Controls.Add(Me.nudEarliest) - Me.Controls.Add(Me.lblColumnName) - Me.Controls.Add(Me.lblDays) - Me.Controls.Add(Me.nudWithin) - Me.Controls.Add(Me.lblWithin) - Me.Controls.Add(Me.lblDryLength) - Me.Controls.Add(Me.nudDryLength) - Me.Controls.Add(Me.chkDrySpell) - Me.Controls.Add(Me.nudTotalRain) - Me.Controls.Add(Me.lblTotalRain) - Me.Controls.Add(Me.lblNumberRainDays) - Me.Controls.Add(Me.lblThreshold) - Me.Controls.Add(Me.nudNumberofRainDays) - Me.Controls.Add(Me.lblEarliest) + Me.ClientSize = New System.Drawing.Size(414, 431) + Me.Controls.Add(Me.grpRainParameters) + Me.Controls.Add(Me.grpConditionsForSatrtofRains) + Me.Controls.Add(Me.lblDate) + Me.Controls.Add(Me.lblRainfall) + Me.Controls.Add(Me.ucrReceiverDate) + Me.Controls.Add(Me.ucrReceiverRainfall) + Me.Controls.Add(Me.ucrSelectorForStartofRains) Me.Controls.Add(Me.ucrBase) Me.MaximizeBox = False Me.MinimizeBox = False @@ -245,33 +341,48 @@ Partial Class dlgStartofRains Me.ShowIcon = False Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Start of Rains" - CType(Me.nudNumberofRainDays, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.nudTotalRain, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.nudWithin, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.nudDryLength, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.nudEarliest, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.nudThreashold, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudValue, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudMinimum, System.ComponentModel.ISupportInitialize).EndInit() + Me.grpConditionsForSatrtofRains.ResumeLayout(False) + Me.grpConditionsForSatrtofRains.PerformLayout() + CType(Me.nudLengthofTime, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudMaximumDays, System.ComponentModel.ISupportInitialize).EndInit() + Me.grpRainParameters.ResumeLayout(False) + Me.grpRainParameters.PerformLayout() + CType(Me.nudFrom, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudThreshold, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudOverDays, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudTo, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents ucrBase As ucrButtons - Friend WithEvents lblEarliest As Label - Friend WithEvents nudNumberofRainDays As NumericUpDown - Friend WithEvents lblThreshold As Label - Friend WithEvents lblNumberRainDays As Label - Friend WithEvents lblTotalRain As Label - Friend WithEvents nudTotalRain As NumericUpDown - Friend WithEvents chkDrySpell As CheckBox - Friend WithEvents nudWithin As NumericUpDown - Friend WithEvents lblWithin As Label - Friend WithEvents lblDryLength As Label - Friend WithEvents nudDryLength As NumericUpDown - Friend WithEvents lblDays As Label - Friend WithEvents lblColumnName As Label - Friend WithEvents nudEarliest As NumericUpDown - Friend WithEvents nudThreashold As NumericUpDown - Friend WithEvents ucrInputColumnName As ucrInputTextBox - Friend WithEvents UcrDialogDisabled1 As ucrDialogDisabled + Friend WithEvents nudValue As NumericUpDown + Friend WithEvents nudMinimum As NumericUpDown + Friend WithEvents ucrSelectorForStartofRains As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrReceiverRainfall As ucrReceiverSingle + Friend WithEvents ucrReceiverDate As ucrReceiverSingle + Friend WithEvents lblRainfall As Label + Friend WithEvents lblDate As Label + Friend WithEvents grpConditionsForSatrtofRains As GroupBox + Friend WithEvents nudLengthofTime As NumericUpDown + Friend WithEvents nudMaximumDays As NumericUpDown + Friend WithEvents lblLengthofTime As Label + Friend WithEvents lblMaximumDays As Label + Friend WithEvents lblVal As Label + Friend WithEvents lblMinimum As Label + Friend WithEvents chkDrySpell As CheckBox + Friend WithEvents chkTotalRainfall As CheckBox + Friend WithEvents chkConsecutiveRainyDays As CheckBox + Friend WithEvents grpRainParameters As GroupBox + Friend WithEvents nudFrom As NumericUpDown + Friend WithEvents lblFrom As Label + Friend WithEvents nudThreshold As NumericUpDown + Friend WithEvents nudOverDays As NumericUpDown + Friend WithEvents nudTo As NumericUpDown + Friend WithEvents lblTo As Label + Friend WithEvents lblThreshold As Label + Friend WithEvents lblOverDays As Label End Class diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 14c1cedd7d3..e047745236f 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -13,10 +13,10 @@ ' You should have received a copy of the GNU General Public License k ' along with this program. If not, see . Imports instat.Translations -Public Class dlgStartofRains - Public bFirstLoad As Boolean = True - Private Sub ucrBase_clickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk - +Public Class dlgStartofRains + Public clsAddKey, clsAfterFifty, clsRainfallOverThreshold, clsRollingSum, clsMinimumRainfall, clsRollingofThreshold, clsXdaysRain, clsFirstDOYPerYear, clsFirstInstance, clsNoRain, clsCumulativeRain, clsDryPeriodTen, clsWithinThirtyDays As New RFunction + Public bFirstLoad As Boolean = True + Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) If bFirstLoad Then InitialiseDialog() @@ -25,35 +25,15 @@ Public Class dlgStartofRains Else ReopenDialog() End If - TestOKEnabled() End Sub Private Sub InitialiseDialog() - Dim strScript As String - - strScript = "climate_obj$add_start_rain(data_list=list()" - strScript = strScript & ", earliest_day=" & nudEarliest.Value.ToString() - strScript = strScript & ", total_days=" & nudNumberofRainDays.Value.ToString() - strScript = strScript & ", rain_total=" & nudTotalRain.Value.ToString() - strScript = strScript & ", threshold=" & nudThreashold.Value.ToString() - strScript = strScript & ", dry_spell_condition=" & chkDrySpell.Checked.ToString().ToUpper() - If chkDrySpell.Checked Then - strScript = strScript & ", dry_days=" & nudDryLength.Value.ToString() - strScript = strScript & ", dry_length=" & nudWithin.Value.ToString() - End If - strScript = strScript & ", col_name=" & Chr(34) & ucrInputColumnName.Name & Chr(34) - strScript = strScript & ",replace=TRUE)" - - frmMain.clsRLink.RunScript(strScript, False) - 'TODO fix this to update grids instead of calling FillData which no longer exists - ' frmMain.FillData("climate_obj$climate_data_objects[[1]]$data") - ' frmMain.FillData("climate_obj$used_data_objects[[1]]$data") - Me.Hide() + End Sub Private Sub SetDefaults() - ucrBase.OKEnabled(False) + End Sub Private Sub ReopenDialog() @@ -61,29 +41,31 @@ Public Class dlgStartofRains End Sub Private Sub TestOKEnabled() - + If Not ucrReceiverRainfall.IsEmpty AndAlso Not ucrReceiverDate.IsEmpty Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() TestOKEnabled() - End Sub - - Private Sub chkDrySpell_CheckedChanged(sender As Object, e As EventArgs) Handles chkDrySpell.CheckedChanged - UpdateVisible() - End Sub - - Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles Me.Load - UpdateVisible() - autoTranslate(Me) - - End Sub - - Private Sub UpdateVisible() - lblDryLength.Visible = chkDrySpell.Checked - lblWithin.Visible = chkDrySpell.Checked - lblDays.Visible = chkDrySpell.Checked - nudDryLength.Visible = chkDrySpell.Checked - nudWithin.Visible = chkDrySpell.Checked + End Sub + + Private Sub grpRainParameters_Enter(sender As Object, e As EventArgs) Handles nudFrom.TextChanged, nudTo.TextChanged, nudThreshold.TextChanged, nudOverDays.TextChanged + TestOKEnabled() + End Sub + + Private Sub grpConditionsForSatrtofRains_Enter(sender As Object, e As EventArgs) Handles chkConsecutiveRainyDays.CheckedChanged, chkTotalRainfall.CheckedChanged, chkTotalRainfall.CheckedChanged, nudValue.TextChanged, nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged + TestOKEnabled() + End Sub + + Private Sub ucrReceiverRainfall_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverRainfall.SelectionChanged + + End Sub + + Private Sub ucrReceiverDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDate.SelectionChanged + End Sub End Class \ No newline at end of file From 9eef944c486bd931385e50f030789e71a4d4a638 Mon Sep 17 00:00:00 2001 From: Lunalo Date: Tue, 6 Dec 2016 18:27:56 +0300 Subject: [PATCH 02/72] Adding r code still in progress --- instat/dlgStartofRains.Designer.vb | 128 ++++++++++++++++++---------- instat/dlgStartofRains.vb | 132 +++++++++++++++++++++++++++-- 2 files changed, 207 insertions(+), 53 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index 7dc59108ff4..62c21db2cc5 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -33,9 +33,11 @@ Partial Class dlgStartofRains Me.grpConditionsForSatrtofRains = New System.Windows.Forms.GroupBox() Me.nudLengthofTime = New System.Windows.Forms.NumericUpDown() Me.nudMaximumDays = New System.Windows.Forms.NumericUpDown() + Me.nudOverDays = New System.Windows.Forms.NumericUpDown() Me.lblLengthofTime = New System.Windows.Forms.Label() Me.lblMaximumDays = New System.Windows.Forms.Label() Me.lblVal = New System.Windows.Forms.Label() + Me.lblOverDays = New System.Windows.Forms.Label() Me.lblMinimum = New System.Windows.Forms.Label() Me.chkDrySpell = New System.Windows.Forms.CheckBox() Me.chkTotalRainfall = New System.Windows.Forms.CheckBox() @@ -44,43 +46,44 @@ Partial Class dlgStartofRains Me.nudFrom = New System.Windows.Forms.NumericUpDown() Me.lblFrom = New System.Windows.Forms.Label() Me.nudThreshold = New System.Windows.Forms.NumericUpDown() - Me.nudOverDays = New System.Windows.Forms.NumericUpDown() Me.nudTo = New System.Windows.Forms.NumericUpDown() Me.lblTo = New System.Windows.Forms.Label() Me.lblThreshold = New System.Windows.Forms.Label() - Me.lblOverDays = New System.Windows.Forms.Label() + Me.lblDOY = New System.Windows.Forms.Label() + Me.ucrReceiverDOY = New instat.ucrReceiverSingle() + Me.lblWidth = New System.Windows.Forms.Label() CType(Me.nudValue, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudMinimum, System.ComponentModel.ISupportInitialize).BeginInit() Me.grpConditionsForSatrtofRains.SuspendLayout() CType(Me.nudLengthofTime, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudMaximumDays, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudOverDays, System.ComponentModel.ISupportInitialize).BeginInit() Me.grpRainParameters.SuspendLayout() CType(Me.nudFrom, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudThreshold, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.nudOverDays, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudTo, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'nudValue ' - Me.nudValue.Location = New System.Drawing.Point(173, 77) + Me.nudValue.Location = New System.Drawing.Point(201, 42) Me.nudValue.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) Me.nudValue.Name = "nudValue" - Me.nudValue.Size = New System.Drawing.Size(48, 20) + Me.nudValue.Size = New System.Drawing.Size(41, 20) Me.nudValue.TabIndex = 4 Me.nudValue.Value = New Decimal(New Integer() {30, 0, 0, 0}) ' 'nudMinimum ' - Me.nudMinimum.Location = New System.Drawing.Point(173, 37) + Me.nudMinimum.Location = New System.Drawing.Point(201, 18) Me.nudMinimum.Name = "nudMinimum" - Me.nudMinimum.Size = New System.Drawing.Size(45, 20) + Me.nudMinimum.Size = New System.Drawing.Size(41, 20) Me.nudMinimum.TabIndex = 2 - Me.nudMinimum.Value = New Decimal(New Integer() {10, 0, 0, 0}) + Me.nudMinimum.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(9, 375) + Me.ucrBase.Location = New System.Drawing.Point(12, 331) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 0 @@ -89,7 +92,7 @@ Partial Class dlgStartofRains ' Me.ucrSelectorForStartofRains.bShowHiddenColumns = False Me.ucrSelectorForStartofRains.bUseCurrentFilter = True - Me.ucrSelectorForStartofRains.Location = New System.Drawing.Point(9, 9) + Me.ucrSelectorForStartofRains.Location = New System.Drawing.Point(18, 9) Me.ucrSelectorForStartofRains.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorForStartofRains.Name = "ucrSelectorForStartofRains" Me.ucrSelectorForStartofRains.Size = New System.Drawing.Size(210, 180) @@ -133,42 +136,55 @@ Partial Class dlgStartofRains ' 'grpConditionsForSatrtofRains ' + Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblWidth) Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudLengthofTime) Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudMaximumDays) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudOverDays) Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblLengthofTime) Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblMaximumDays) Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblVal) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblOverDays) Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblMinimum) Me.grpConditionsForSatrtofRains.Controls.Add(Me.chkDrySpell) Me.grpConditionsForSatrtofRains.Controls.Add(Me.chkTotalRainfall) Me.grpConditionsForSatrtofRains.Controls.Add(Me.chkConsecutiveRainyDays) Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudMinimum) Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudValue) - Me.grpConditionsForSatrtofRains.Location = New System.Drawing.Point(9, 201) + Me.grpConditionsForSatrtofRains.Location = New System.Drawing.Point(12, 220) Me.grpConditionsForSatrtofRains.Name = "grpConditionsForSatrtofRains" - Me.grpConditionsForSatrtofRains.Size = New System.Drawing.Size(369, 168) + Me.grpConditionsForSatrtofRains.Size = New System.Drawing.Size(395, 105) Me.grpConditionsForSatrtofRains.TabIndex = 7 Me.grpConditionsForSatrtofRains.TabStop = False Me.grpConditionsForSatrtofRains.Text = "Conditions for Start of Rains" ' 'nudLengthofTime ' - Me.nudLengthofTime.Location = New System.Drawing.Point(173, 144) + Me.nudLengthofTime.Location = New System.Drawing.Point(332, 72) Me.nudLengthofTime.Name = "nudLengthofTime" - Me.nudLengthofTime.Size = New System.Drawing.Size(48, 20) + Me.nudLengthofTime.Size = New System.Drawing.Size(53, 20) Me.nudLengthofTime.TabIndex = 9 ' 'nudMaximumDays ' - Me.nudMaximumDays.Location = New System.Drawing.Point(173, 118) + Me.nudMaximumDays.Location = New System.Drawing.Point(201, 68) Me.nudMaximumDays.Name = "nudMaximumDays" - Me.nudMaximumDays.Size = New System.Drawing.Size(48, 20) + Me.nudMaximumDays.Size = New System.Drawing.Size(41, 20) Me.nudMaximumDays.TabIndex = 7 ' + 'nudOverDays + ' + Me.nudOverDays.Location = New System.Drawing.Point(332, 46) + Me.nudOverDays.Maximum = New Decimal(New Integer() {366, 0, 0, 0}) + Me.nudOverDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudOverDays.Name = "nudOverDays" + Me.nudOverDays.Size = New System.Drawing.Size(53, 20) + Me.nudOverDays.TabIndex = 7 + Me.nudOverDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) + ' 'lblLengthofTime ' Me.lblLengthofTime.AutoSize = True - Me.lblLengthofTime.Location = New System.Drawing.Point(86, 144) + Me.lblLengthofTime.Location = New System.Drawing.Point(246, 74) Me.lblLengthofTime.Name = "lblLengthofTime" Me.lblLengthofTime.Size = New System.Drawing.Size(81, 13) Me.lblLengthofTime.TabIndex = 8 @@ -177,7 +193,7 @@ Partial Class dlgStartofRains 'lblMaximumDays ' Me.lblMaximumDays.AutoSize = True - Me.lblMaximumDays.Location = New System.Drawing.Point(86, 121) + Me.lblMaximumDays.Location = New System.Drawing.Point(114, 72) Me.lblMaximumDays.Name = "lblMaximumDays" Me.lblMaximumDays.Size = New System.Drawing.Size(81, 13) Me.lblMaximumDays.TabIndex = 6 @@ -186,16 +202,26 @@ Partial Class dlgStartofRains 'lblVal ' Me.lblVal.AutoSize = True - Me.lblVal.Location = New System.Drawing.Point(130, 84) + Me.lblVal.Location = New System.Drawing.Point(163, 44) Me.lblVal.Name = "lblVal" Me.lblVal.Size = New System.Drawing.Size(37, 13) Me.lblVal.TabIndex = 3 Me.lblVal.Text = "Value:" ' + 'lblOverDays + ' + Me.lblOverDays.AutoSize = True + Me.lblOverDays.Location = New System.Drawing.Point(268, 49) + Me.lblOverDays.Name = "lblOverDays" + Me.lblOverDays.Size = New System.Drawing.Size(60, 13) + Me.lblOverDays.TabIndex = 6 + Me.lblOverDays.Tag = "" + Me.lblOverDays.Text = "Over Days:" + ' 'lblMinimum ' Me.lblMinimum.AutoSize = True - Me.lblMinimum.Location = New System.Drawing.Point(116, 44) + Me.lblMinimum.Location = New System.Drawing.Point(149, 21) Me.lblMinimum.Name = "lblMinimum" Me.lblMinimum.Size = New System.Drawing.Size(51, 13) Me.lblMinimum.TabIndex = 1 @@ -204,7 +230,7 @@ Partial Class dlgStartofRains 'chkDrySpell ' Me.chkDrySpell.AutoSize = True - Me.chkDrySpell.Location = New System.Drawing.Point(6, 100) + Me.chkDrySpell.Location = New System.Drawing.Point(7, 71) Me.chkDrySpell.Name = "chkDrySpell" Me.chkDrySpell.Size = New System.Drawing.Size(68, 17) Me.chkDrySpell.TabIndex = 5 @@ -214,7 +240,7 @@ Partial Class dlgStartofRains 'chkTotalRainfall ' Me.chkTotalRainfall.AutoSize = True - Me.chkTotalRainfall.Location = New System.Drawing.Point(6, 60) + Me.chkTotalRainfall.Location = New System.Drawing.Point(7, 46) Me.chkTotalRainfall.Name = "chkTotalRainfall" Me.chkTotalRainfall.Size = New System.Drawing.Size(88, 17) Me.chkTotalRainfall.TabIndex = 1 @@ -236,14 +262,12 @@ Partial Class dlgStartofRains Me.grpRainParameters.Controls.Add(Me.nudFrom) Me.grpRainParameters.Controls.Add(Me.lblFrom) Me.grpRainParameters.Controls.Add(Me.nudThreshold) - Me.grpRainParameters.Controls.Add(Me.nudOverDays) Me.grpRainParameters.Controls.Add(Me.nudTo) Me.grpRainParameters.Controls.Add(Me.lblTo) Me.grpRainParameters.Controls.Add(Me.lblThreshold) - Me.grpRainParameters.Controls.Add(Me.lblOverDays) - Me.grpRainParameters.Location = New System.Drawing.Point(234, 88) + Me.grpRainParameters.Location = New System.Drawing.Point(234, 129) Me.grpRainParameters.Name = "grpRainParameters" - Me.grpRainParameters.Size = New System.Drawing.Size(144, 113) + Me.grpRainParameters.Size = New System.Drawing.Size(144, 85) Me.grpRainParameters.TabIndex = 5 Me.grpRainParameters.TabStop = False ' @@ -273,16 +297,6 @@ Partial Class dlgStartofRains Me.nudThreshold.TabIndex = 5 Me.nudThreshold.Value = New Decimal(New Integer() {85, 0, 0, 131072}) ' - 'nudOverDays - ' - Me.nudOverDays.Location = New System.Drawing.Point(81, 87) - Me.nudOverDays.Maximum = New Decimal(New Integer() {366, 0, 0, 0}) - Me.nudOverDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.nudOverDays.Name = "nudOverDays" - Me.nudOverDays.Size = New System.Drawing.Size(53, 20) - Me.nudOverDays.TabIndex = 7 - Me.nudOverDays.Value = New Decimal(New Integer() {92, 0, 0, 0}) - ' 'nudTo ' Me.nudTo.Location = New System.Drawing.Point(81, 35) @@ -312,21 +326,40 @@ Partial Class dlgStartofRains Me.lblThreshold.Tag = "Threshold" Me.lblThreshold.Text = "Threshold:" ' - 'lblOverDays + 'lblDOY ' - Me.lblOverDays.AutoSize = True - Me.lblOverDays.Location = New System.Drawing.Point(7, 91) - Me.lblOverDays.Name = "lblOverDays" - Me.lblOverDays.Size = New System.Drawing.Size(60, 13) - Me.lblOverDays.TabIndex = 6 - Me.lblOverDays.Tag = "" - Me.lblOverDays.Text = "Over Days:" + Me.lblDOY.AutoSize = True + Me.lblDOY.Location = New System.Drawing.Point(234, 89) + Me.lblDOY.Name = "lblDOY" + Me.lblDOY.Size = New System.Drawing.Size(63, 13) + Me.lblDOY.TabIndex = 8 + Me.lblDOY.Text = "Day of Year" + ' + 'ucrReceiverDOY + ' + Me.ucrReceiverDOY.Location = New System.Drawing.Point(234, 106) + Me.ucrReceiverDOY.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverDOY.Name = "ucrReceiverDOY" + Me.ucrReceiverDOY.Selector = Nothing + Me.ucrReceiverDOY.Size = New System.Drawing.Size(144, 20) + Me.ucrReceiverDOY.TabIndex = 9 + ' + 'lblWidth + ' + Me.lblWidth.AutoSize = True + Me.lblWidth.Location = New System.Drawing.Point(256, 20) + Me.lblWidth.Name = "lblWidth" + Me.lblWidth.Size = New System.Drawing.Size(72, 13) + Me.lblWidth.TabIndex = 10 + Me.lblWidth.Text = "Out of 5 Days" ' 'dlgStartofRains ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(414, 431) + Me.ClientSize = New System.Drawing.Size(415, 385) + Me.Controls.Add(Me.ucrReceiverDOY) + Me.Controls.Add(Me.lblDOY) Me.Controls.Add(Me.grpRainParameters) Me.Controls.Add(Me.grpConditionsForSatrtofRains) Me.Controls.Add(Me.lblDate) @@ -347,11 +380,11 @@ Partial Class dlgStartofRains Me.grpConditionsForSatrtofRains.PerformLayout() CType(Me.nudLengthofTime, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.nudMaximumDays, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudOverDays, System.ComponentModel.ISupportInitialize).EndInit() Me.grpRainParameters.ResumeLayout(False) Me.grpRainParameters.PerformLayout() CType(Me.nudFrom, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.nudThreshold, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.nudOverDays, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.nudTo, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() @@ -385,4 +418,7 @@ Partial Class dlgStartofRains Friend WithEvents lblTo As Label Friend WithEvents lblThreshold As Label Friend WithEvents lblOverDays As Label + Friend WithEvents lblDOY As Label + Friend WithEvents ucrReceiverDOY As ucrReceiverSingle + Friend WithEvents lblWidth As Label End Class diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index e047745236f..aea4791d40f 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -14,7 +14,7 @@ ' along with this program. If not, see . Imports instat.Translations Public Class dlgStartofRains - Public clsAddKey, clsAfterFifty, clsRainfallOverThreshold, clsRollingSum, clsMinimumRainfall, clsRollingofThreshold, clsXdaysRain, clsFirstDOYPerYear, clsFirstInstance, clsNoRain, clsCumulativeRain, clsDryPeriodTen, clsWithinThirtyDays As New RFunction + Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsFirstInstance, clsNoRain, clsCumulativeRain, clsDryPeriodTen, clsWithinThirtyDays As New RFunction Public bFirstLoad As Boolean = True Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) @@ -26,14 +26,39 @@ Public Class dlgStartofRains ReopenDialog() End If TestOKEnabled() - End Sub - - Private Sub InitialiseDialog() + End Sub + Private Sub ucrReceiverDOY_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDOY.SelectionChanged + DayFromAndToMethod() + End Sub + + Private Sub ucrSelectorForStartofRains_DataFrameChanged() Handles ucrSelectorForStartofRains.DataFrameChanged + clsAddKey.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) + End Sub + + Private Sub InitialiseDialog() + clsAddKey.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_key") + clsDayFromAndTo.SetRCommand("instat_calculation$new") + clsRainyDays.SetRCommand("instat_calculation$new") + clsRollingSum.SetRCommand("instat_calculation$new") + clsMinimumRainfall.SetRCommand("instat_calculation$new") + clsRollingRainDays.SetRCommand("instat_calculation$new") + clsXdaysRain.SetRCommand("instat_calculation$new") + clsFirstDOYPerYear.SetRCommand("instat_calculation$new") + clsFirstInstance.SetRCommand("instat_calculation$new") + clsNoRain.SetRCommand("instat_calculation$new") + clsCumulativeRain.SetRCommand("instat_calculation$new") + clsDryPeriodTen.SetRCommand("instat_calculation$new") + clsWithinThirtyDays.SetRCommand("instat_calculation$new") + ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") + ucrReceiverRainfall.Selector = ucrSelectorForStartofRains + ucrReceiverRainfall.SetMeAsReceiver() + ucrReceiverDate.SetMeAsReceiver() + ucrReceiverDOY.SetMeAsReceiver() End Sub Private Sub SetDefaults() - + TestOKEnabled() End Sub Private Sub ReopenDialog() @@ -50,7 +75,6 @@ Public Class dlgStartofRains Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() - TestOKEnabled() End Sub Private Sub grpRainParameters_Enter(sender As Object, e As EventArgs) Handles nudFrom.TextChanged, nudTo.TextChanged, nudThreshold.TextChanged, nudOverDays.TextChanged @@ -58,14 +82,108 @@ Public Class dlgStartofRains End Sub Private Sub grpConditionsForSatrtofRains_Enter(sender As Object, e As EventArgs) Handles chkConsecutiveRainyDays.CheckedChanged, chkTotalRainfall.CheckedChanged, chkTotalRainfall.CheckedChanged, nudValue.TextChanged, nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged + DayFromAndToMethod() + RainyDaysMethod() + MinimumRainfallMethod() + XDaysRainMethod() TestOKEnabled() End Sub Private Sub ucrReceiverRainfall_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverRainfall.SelectionChanged - + RainyDaysMethod() + RollingSumMethod() End Sub Private Sub ucrReceiverDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDate.SelectionChanged + AddKeyMethod() + End Sub + Private Sub AddKeyMethod() + If Not ucrReceiverDate.IsEmpty Then + clsAddKey.AddParameter("col_name", ucrReceiverDate.GetVariableNames) + Else + clsAddKey.RemoveParameterByName("col_name") + End If + frmMain.clsRLink.RunInternalScript(clsAddKey.ToScript) + End Sub + + Private Sub DayFromAndToMethod() + If nudFrom.Text <> "" AndAlso nudTo.TextAlign <> "" AndAlso Not ucrReceiverDOY.IsEmpty Then + clsDayFromAndTo.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & ">" & nudFrom.Value & ucrReceiverDOY.GetVariableNames(False) & "<" & nudTo.Value & Chr(34)) + clsDayFromAndTo.AddParameter("calculated_from", Chr(34) & "list(Daily =" & ucrReceiverDOY.GetVariableNames(False) & ")" & Chr(34)) + Else + clsDayFromAndTo.RemoveParameterByName("function_exp") + clsDayFromAndTo.RemoveParameterByName("calculated_from") + End If + End Sub + + Private Sub RainyDaysMethod() + If Not ucrReceiverRainfall.IsEmpty AndAlso nudThreshold.Text <> "" Then + clsRainyDays.AddParameter("type", Chr(34) & "calculation" & Chr(34)) + clsRainyDays.AddParameter("function_exp", Chr(34) & "match(" & ucrReceiverRainfall.GetVariableNames(False) & ">=" & nudThreshold.Value & "," & "1, nomatch = 0" & Chr(34)) + clsRainyDays.AddParameter("result_name", Chr(34) & "rain_day" & Chr(34)) + clsRainyDays.AddParameter("calculated_from", "list(Daily = " & ucrReceiverRainfall.GetVariableNames & ")") + clsRainyDays.AddParameter("save", 2) + Else + clsRainyDays.RemoveParameterByName("type") + clsRainyDays.RemoveParameterByName("function_exp") + clsRainyDays.RemoveParameterByName("result_name") + clsRainyDays.RemoveParameterByName("calculated_from") + clsRainyDays.RemoveParameterByName("save") + End If + End Sub + + Private Sub RollingSumMethod() + If Not ucrReceiverRainfall.IsEmpty Then + clsRollingSum.AddParameter("function_exp", Chr(34) & " rollapply(" & ucrReceiverRainfall.GetVariableNames(False) & " ,2,sum,align='right',fill=NA)" & Chr(34)) + clsRollingSum.AddParameter("type", Chr(34) & "calculation" & Chr(34)) + clsRollingSum.AddParameter("result_name", Chr(34) & "roll_sum_Rain" & Chr(34)) + clsRollingSum.AddParameter("calculated_from", "list(Daily = " & ucrReceiverRainfall.GetVariableNames & ")") + clsRollingSum.AddParameter("save", 1) + Else + clsRollingSum.RemoveParameterByName("function_exp") + clsRollingSum.RemoveParameterByName("type") + clsRollingSum.RemoveParameterByName("result_name") + clsRollingSum.RemoveParameterByName("calculated_from") + clsRollingSum.RemoveParameterByName("save") + End If + End Sub + Private Sub MinimumRainfallMethod() + If chkConsecutiveRainyDays.Checked Then + lblMinimum.Enabled = True + nudMinimum.Enabled = True + If nudMinimum.Text <> "" Then + clsMinimumRainfall.AddParameter("function_exp", Chr(34) & "roll_sum_Rain >" & nudMinimum.Value) + clsMinimumRainfall.AddParameter("type", Chr(34) & "filter" & Chr(34)) + clsMinimumRainfall.AddParameter("sub_calculations", "list(" & clsRollingSum.ToScript & ")") + Else + clsMinimumRainfall.RemoveParameterByName("function_exp") + clsMinimumRainfall.RemoveParameterByName("type") + clsMinimumRainfall.RemoveParameterByName("sub_calculations") + End If + Else + lblMinimum.Enabled = False + nudMinimum.Enabled = False + End If + RollingOfRainDays() + End Sub + + Private Sub RollingOfRainDays() + clsRollingRainDays.AddParameter("type", Chr(34) & "calculation" & Chr(34)) + clsRollingRainDays.AddParameter("function_exp", Chr(34) & "rollapply(data=rain_day, width=5, FUN=sum, align = 'right', fill=NA)" & Chr(34)) + clsRollingRainDays.AddParameter("result_name", Chr(34) & "Rolling_Rain_Days" & Chr(34)) + clsRollingRainDays.AddParameter("calculated_from", "list(Daily =" & Chr(34) & " rain_day" & Chr(34) & ")") + clsRollingRainDays.AddParameter("save", 1) + End Sub + Private Sub XDaysRainMethod() + If nudMinimum.Text <> "" Then + clsXdaysRain.AddParameter("type", Chr(34) & "filter" & Chr(34)) + clsXdaysRain.AddParameter("function_exp", "Rolling_Rain_Days >=" & nudMinimum.Value) + clsXdaysRain.AddParameter("sub_calculations", "list(Rolling_Of_rain_days)") + Else + clsXdaysRain.RemoveParameterByName("type") + clsXdaysRain.RemoveParameterByName("function_exp") + clsXdaysRain.RemoveParameterByName("sub_calculations") + End If End Sub End Class \ No newline at end of file From 8f74acfa53f642b58a9cc2d4f6eb5541541e36f3 Mon Sep 17 00:00:00 2001 From: Lunalo Date: Wed, 7 Dec 2016 10:45:28 +0300 Subject: [PATCH 03/72] Additions on start of rains dialog --- instat/dlgStartofRains.Designer.vb | 174 +++++++++++++++-------------- instat/dlgStartofRains.vb | 64 +++++++++-- 2 files changed, 147 insertions(+), 91 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index 62c21db2cc5..b9dca1811a4 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -21,16 +21,14 @@ Partial Class dlgStartofRains 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. - Private Sub InitializeComponent() + Private Sub InitializeComponent() Me.nudValue = New System.Windows.Forms.NumericUpDown() Me.nudMinimum = New System.Windows.Forms.NumericUpDown() - Me.ucrBase = New instat.ucrButtons() - Me.ucrSelectorForStartofRains = New instat.ucrSelectorByDataFrameAddRemove() - Me.ucrReceiverRainfall = New instat.ucrReceiverSingle() - Me.ucrReceiverDate = New instat.ucrReceiverSingle() Me.lblRainfall = New System.Windows.Forms.Label() Me.lblDate = New System.Windows.Forms.Label() Me.grpConditionsForSatrtofRains = New System.Windows.Forms.GroupBox() + Me.nudOutOfDays = New System.Windows.Forms.NumericUpDown() + Me.lblWidth = New System.Windows.Forms.Label() Me.nudLengthofTime = New System.Windows.Forms.NumericUpDown() Me.nudMaximumDays = New System.Windows.Forms.NumericUpDown() Me.nudOverDays = New System.Windows.Forms.NumericUpDown() @@ -43,24 +41,28 @@ Partial Class dlgStartofRains Me.chkTotalRainfall = New System.Windows.Forms.CheckBox() Me.chkConsecutiveRainyDays = New System.Windows.Forms.CheckBox() Me.grpRainParameters = New System.Windows.Forms.GroupBox() + Me.nudThreshold = New System.Windows.Forms.NumericUpDown() + Me.lblThreshold = New System.Windows.Forms.Label() Me.nudFrom = New System.Windows.Forms.NumericUpDown() Me.lblFrom = New System.Windows.Forms.Label() - Me.nudThreshold = New System.Windows.Forms.NumericUpDown() Me.nudTo = New System.Windows.Forms.NumericUpDown() Me.lblTo = New System.Windows.Forms.Label() - Me.lblThreshold = New System.Windows.Forms.Label() Me.lblDOY = New System.Windows.Forms.Label() Me.ucrReceiverDOY = New instat.ucrReceiverSingle() - Me.lblWidth = New System.Windows.Forms.Label() + Me.ucrReceiverDate = New instat.ucrReceiverSingle() + Me.ucrReceiverRainfall = New instat.ucrReceiverSingle() + Me.ucrSelectorForStartofRains = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrBase = New instat.ucrButtons() CType(Me.nudValue, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudMinimum, System.ComponentModel.ISupportInitialize).BeginInit() Me.grpConditionsForSatrtofRains.SuspendLayout() + CType(Me.nudOutOfDays, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudLengthofTime, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudMaximumDays, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudOverDays, System.ComponentModel.ISupportInitialize).BeginInit() Me.grpRainParameters.SuspendLayout() - CType(Me.nudFrom, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudThreshold, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudFrom, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudTo, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' @@ -81,41 +83,6 @@ Partial Class dlgStartofRains Me.nudMinimum.TabIndex = 2 Me.nudMinimum.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' - 'ucrBase - ' - Me.ucrBase.Location = New System.Drawing.Point(12, 331) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) - Me.ucrBase.TabIndex = 0 - ' - 'ucrSelectorForStartofRains - ' - Me.ucrSelectorForStartofRains.bShowHiddenColumns = False - Me.ucrSelectorForStartofRains.bUseCurrentFilter = True - Me.ucrSelectorForStartofRains.Location = New System.Drawing.Point(18, 9) - Me.ucrSelectorForStartofRains.Margin = New System.Windows.Forms.Padding(0) - Me.ucrSelectorForStartofRains.Name = "ucrSelectorForStartofRains" - Me.ucrSelectorForStartofRains.Size = New System.Drawing.Size(210, 180) - Me.ucrSelectorForStartofRains.TabIndex = 0 - ' - 'ucrReceiverRainfall - ' - Me.ucrReceiverRainfall.Location = New System.Drawing.Point(234, 26) - Me.ucrReceiverRainfall.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverRainfall.Name = "ucrReceiverRainfall" - Me.ucrReceiverRainfall.Selector = Nothing - Me.ucrReceiverRainfall.Size = New System.Drawing.Size(144, 20) - Me.ucrReceiverRainfall.TabIndex = 2 - ' - 'ucrReceiverDate - ' - Me.ucrReceiverDate.Location = New System.Drawing.Point(234, 65) - Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverDate.Name = "ucrReceiverDate" - Me.ucrReceiverDate.Selector = Nothing - Me.ucrReceiverDate.Size = New System.Drawing.Size(144, 20) - Me.ucrReceiverDate.TabIndex = 4 - ' 'lblRainfall ' Me.lblRainfall.AutoSize = True @@ -136,6 +103,7 @@ Partial Class dlgStartofRains ' 'grpConditionsForSatrtofRains ' + Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudOutOfDays) Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblWidth) Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudLengthofTime) Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudMaximumDays) @@ -157,6 +125,22 @@ Partial Class dlgStartofRains Me.grpConditionsForSatrtofRains.TabStop = False Me.grpConditionsForSatrtofRains.Text = "Conditions for Start of Rains" ' + 'nudOutOfDays + ' + Me.nudOutOfDays.Location = New System.Drawing.Point(332, 20) + Me.nudOutOfDays.Name = "nudOutOfDays" + Me.nudOutOfDays.Size = New System.Drawing.Size(53, 20) + Me.nudOutOfDays.TabIndex = 11 + ' + 'lblWidth + ' + Me.lblWidth.AutoSize = True + Me.lblWidth.Location = New System.Drawing.Point(256, 20) + Me.lblWidth.Name = "lblWidth" + Me.lblWidth.Size = New System.Drawing.Size(75, 13) + Me.lblWidth.TabIndex = 10 + Me.lblWidth.Text = "Out of 5 Days:" + ' 'nudLengthofTime ' Me.nudLengthofTime.Location = New System.Drawing.Point(332, 72) @@ -259,21 +243,41 @@ Partial Class dlgStartofRains ' 'grpRainParameters ' + Me.grpRainParameters.Controls.Add(Me.nudThreshold) + Me.grpRainParameters.Controls.Add(Me.lblThreshold) Me.grpRainParameters.Controls.Add(Me.nudFrom) Me.grpRainParameters.Controls.Add(Me.lblFrom) - Me.grpRainParameters.Controls.Add(Me.nudThreshold) Me.grpRainParameters.Controls.Add(Me.nudTo) Me.grpRainParameters.Controls.Add(Me.lblTo) - Me.grpRainParameters.Controls.Add(Me.lblThreshold) Me.grpRainParameters.Location = New System.Drawing.Point(234, 129) Me.grpRainParameters.Name = "grpRainParameters" - Me.grpRainParameters.Size = New System.Drawing.Size(144, 85) + Me.grpRainParameters.Size = New System.Drawing.Size(150, 87) Me.grpRainParameters.TabIndex = 5 Me.grpRainParameters.TabStop = False ' + 'nudThreshold + ' + Me.nudThreshold.DecimalPlaces = 2 + Me.nudThreshold.Increment = New Decimal(New Integer() {1, 0, 0, 65536}) + Me.nudThreshold.Location = New System.Drawing.Point(81, 11) + Me.nudThreshold.Name = "nudThreshold" + Me.nudThreshold.Size = New System.Drawing.Size(53, 20) + Me.nudThreshold.TabIndex = 7 + Me.nudThreshold.Value = New Decimal(New Integer() {85, 0, 0, 131072}) + ' + 'lblThreshold + ' + Me.lblThreshold.AutoSize = True + Me.lblThreshold.Location = New System.Drawing.Point(7, 13) + Me.lblThreshold.Name = "lblThreshold" + Me.lblThreshold.Size = New System.Drawing.Size(57, 13) + Me.lblThreshold.TabIndex = 6 + Me.lblThreshold.Tag = "Threshold" + Me.lblThreshold.Text = "Threshold:" + ' 'nudFrom ' - Me.nudFrom.Location = New System.Drawing.Point(81, 9) + Me.nudFrom.Location = New System.Drawing.Point(81, 35) Me.nudFrom.Name = "nudFrom" Me.nudFrom.Size = New System.Drawing.Size(55, 20) Me.nudFrom.TabIndex = 1 @@ -281,25 +285,15 @@ Partial Class dlgStartofRains 'lblFrom ' Me.lblFrom.AutoSize = True - Me.lblFrom.Location = New System.Drawing.Point(31, 11) + Me.lblFrom.Location = New System.Drawing.Point(31, 37) Me.lblFrom.Name = "lblFrom" Me.lblFrom.Size = New System.Drawing.Size(33, 13) Me.lblFrom.TabIndex = 0 Me.lblFrom.Text = "From:" ' - 'nudThreshold - ' - Me.nudThreshold.DecimalPlaces = 2 - Me.nudThreshold.Increment = New Decimal(New Integer() {1, 0, 0, 65536}) - Me.nudThreshold.Location = New System.Drawing.Point(81, 61) - Me.nudThreshold.Name = "nudThreshold" - Me.nudThreshold.Size = New System.Drawing.Size(53, 20) - Me.nudThreshold.TabIndex = 5 - Me.nudThreshold.Value = New Decimal(New Integer() {85, 0, 0, 131072}) - ' 'nudTo ' - Me.nudTo.Location = New System.Drawing.Point(81, 35) + Me.nudTo.Location = New System.Drawing.Point(81, 61) Me.nudTo.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) Me.nudTo.Name = "nudTo" Me.nudTo.Size = New System.Drawing.Size(53, 20) @@ -309,23 +303,13 @@ Partial Class dlgStartofRains 'lblTo ' Me.lblTo.AutoSize = True - Me.lblTo.Location = New System.Drawing.Point(41, 37) + Me.lblTo.Location = New System.Drawing.Point(41, 63) Me.lblTo.Name = "lblTo" Me.lblTo.Size = New System.Drawing.Size(23, 13) Me.lblTo.TabIndex = 2 Me.lblTo.Tag = "" Me.lblTo.Text = "To:" ' - 'lblThreshold - ' - Me.lblThreshold.AutoSize = True - Me.lblThreshold.Location = New System.Drawing.Point(7, 63) - Me.lblThreshold.Name = "lblThreshold" - Me.lblThreshold.Size = New System.Drawing.Size(57, 13) - Me.lblThreshold.TabIndex = 4 - Me.lblThreshold.Tag = "Threshold" - Me.lblThreshold.Text = "Threshold:" - ' 'lblDOY ' Me.lblDOY.AutoSize = True @@ -344,14 +328,40 @@ Partial Class dlgStartofRains Me.ucrReceiverDOY.Size = New System.Drawing.Size(144, 20) Me.ucrReceiverDOY.TabIndex = 9 ' - 'lblWidth + 'ucrReceiverDate ' - Me.lblWidth.AutoSize = True - Me.lblWidth.Location = New System.Drawing.Point(256, 20) - Me.lblWidth.Name = "lblWidth" - Me.lblWidth.Size = New System.Drawing.Size(72, 13) - Me.lblWidth.TabIndex = 10 - Me.lblWidth.Text = "Out of 5 Days" + Me.ucrReceiverDate.Location = New System.Drawing.Point(234, 65) + Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverDate.Name = "ucrReceiverDate" + Me.ucrReceiverDate.Selector = Nothing + Me.ucrReceiverDate.Size = New System.Drawing.Size(144, 20) + Me.ucrReceiverDate.TabIndex = 4 + ' + 'ucrReceiverRainfall + ' + Me.ucrReceiverRainfall.Location = New System.Drawing.Point(234, 26) + Me.ucrReceiverRainfall.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverRainfall.Name = "ucrReceiverRainfall" + Me.ucrReceiverRainfall.Selector = Nothing + Me.ucrReceiverRainfall.Size = New System.Drawing.Size(144, 20) + Me.ucrReceiverRainfall.TabIndex = 2 + ' + 'ucrSelectorForStartofRains + ' + Me.ucrSelectorForStartofRains.bShowHiddenColumns = False + Me.ucrSelectorForStartofRains.bUseCurrentFilter = True + Me.ucrSelectorForStartofRains.Location = New System.Drawing.Point(18, 9) + Me.ucrSelectorForStartofRains.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorForStartofRains.Name = "ucrSelectorForStartofRains" + Me.ucrSelectorForStartofRains.Size = New System.Drawing.Size(210, 180) + Me.ucrSelectorForStartofRains.TabIndex = 0 + ' + 'ucrBase + ' + Me.ucrBase.Location = New System.Drawing.Point(12, 331) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.TabIndex = 0 ' 'dlgStartofRains ' @@ -378,13 +388,14 @@ Partial Class dlgStartofRains CType(Me.nudMinimum, System.ComponentModel.ISupportInitialize).EndInit() Me.grpConditionsForSatrtofRains.ResumeLayout(False) Me.grpConditionsForSatrtofRains.PerformLayout() + CType(Me.nudOutOfDays, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.nudLengthofTime, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.nudMaximumDays, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.nudOverDays, System.ComponentModel.ISupportInitialize).EndInit() Me.grpRainParameters.ResumeLayout(False) Me.grpRainParameters.PerformLayout() - CType(Me.nudFrom, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.nudThreshold, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudFrom, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.nudTo, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() @@ -412,13 +423,14 @@ Partial Class dlgStartofRains Friend WithEvents grpRainParameters As GroupBox Friend WithEvents nudFrom As NumericUpDown Friend WithEvents lblFrom As Label - Friend WithEvents nudThreshold As NumericUpDown Friend WithEvents nudOverDays As NumericUpDown Friend WithEvents nudTo As NumericUpDown Friend WithEvents lblTo As Label - Friend WithEvents lblThreshold As Label Friend WithEvents lblOverDays As Label Friend WithEvents lblDOY As Label Friend WithEvents ucrReceiverDOY As ucrReceiverSingle Friend WithEvents lblWidth As Label + Friend WithEvents nudOutOfDays As NumericUpDown + Friend WithEvents nudThreshold As NumericUpDown + Friend WithEvents lblThreshold As Label End Class diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index aea4791d40f..963d79adb17 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -14,7 +14,7 @@ ' along with this program. If not, see . Imports instat.Translations Public Class dlgStartofRains - Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsFirstInstance, clsNoRain, clsCumulativeRain, clsDryPeriodTen, clsWithinThirtyDays As New RFunction + Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsFirstInstance, clsNoRain, clsCumulativeRain, clsDryPeriodTen, clsWithinThirtyDays, clsDrySpell, clsYearGroupDaily As New RFunction Public bFirstLoad As Boolean = True Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) @@ -39,6 +39,7 @@ Public Class dlgStartofRains Private Sub InitialiseDialog() clsAddKey.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_key") clsDayFromAndTo.SetRCommand("instat_calculation$new") + clsYearGroupDaily.SetRCommand("instat_calculation$new") clsRainyDays.SetRCommand("instat_calculation$new") clsRollingSum.SetRCommand("instat_calculation$new") clsMinimumRainfall.SetRCommand("instat_calculation$new") @@ -51,13 +52,14 @@ Public Class dlgStartofRains clsDryPeriodTen.SetRCommand("instat_calculation$new") clsWithinThirtyDays.SetRCommand("instat_calculation$new") ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") + + End Sub + + Private Sub SetDefaults() ucrReceiverRainfall.Selector = ucrSelectorForStartofRains ucrReceiverRainfall.SetMeAsReceiver() ucrReceiverDate.SetMeAsReceiver() ucrReceiverDOY.SetMeAsReceiver() - End Sub - - Private Sub SetDefaults() TestOKEnabled() End Sub @@ -66,35 +68,40 @@ Public Class dlgStartofRains End Sub Private Sub TestOKEnabled() - If Not ucrReceiverRainfall.IsEmpty AndAlso Not ucrReceiverDate.IsEmpty Then + If Not (ucrReceiverRainfall.IsEmpty AndAlso ucrReceiverDate.IsEmpty AndAlso ucrReceiverDOY.IsEmpty) Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) End If End Sub + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() End Sub - Private Sub grpRainParameters_Enter(sender As Object, e As EventArgs) Handles nudFrom.TextChanged, nudTo.TextChanged, nudThreshold.TextChanged, nudOverDays.TextChanged + Private Sub grpRainParameters_Enter(sender As Object, e As EventArgs) Handles nudFrom.TextChanged, nudTo.TextChanged, nudThreshold.TextChanged + DayFromAndToMethod() TestOKEnabled() End Sub - Private Sub grpConditionsForSatrtofRains_Enter(sender As Object, e As EventArgs) Handles chkConsecutiveRainyDays.CheckedChanged, chkTotalRainfall.CheckedChanged, chkTotalRainfall.CheckedChanged, nudValue.TextChanged, nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged - DayFromAndToMethod() + Private Sub grpConditionsForSatrtofRains_Enter(sender As Object, e As EventArgs) Handles nudValue.TextChanged, nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged, nudOverDays.TextChanged RainyDaysMethod() MinimumRainfallMethod() XDaysRainMethod() TestOKEnabled() End Sub + Private Sub grpConditionsForSatrtofRains1_Enter(sender As Object, e As EventArgs) Handles chkConsecutiveRainyDays.CheckedChanged, chkTotalRainfall.CheckedChanged, chkTotalRainfall.CheckedChanged + MinimumRainfallMethod + End Sub Private Sub ucrReceiverRainfall_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverRainfall.SelectionChanged RainyDaysMethod() RollingSumMethod() End Sub Private Sub ucrReceiverDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDate.SelectionChanged + YearGroupDaily() AddKeyMethod() End Sub Private Sub AddKeyMethod() @@ -107,7 +114,7 @@ Public Class dlgStartofRains End Sub Private Sub DayFromAndToMethod() - If nudFrom.Text <> "" AndAlso nudTo.TextAlign <> "" AndAlso Not ucrReceiverDOY.IsEmpty Then + If nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso (Not ucrReceiverDOY.IsEmpty) Then clsDayFromAndTo.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & ">" & nudFrom.Value & ucrReceiverDOY.GetVariableNames(False) & "<" & nudTo.Value & Chr(34)) clsDayFromAndTo.AddParameter("calculated_from", Chr(34) & "list(Daily =" & ucrReceiverDOY.GetVariableNames(False) & ")" & Chr(34)) Else @@ -117,7 +124,7 @@ Public Class dlgStartofRains End Sub Private Sub RainyDaysMethod() - If Not ucrReceiverRainfall.IsEmpty AndAlso nudThreshold.Text <> "" Then + If ((Not ucrReceiverRainfall.IsEmpty) AndAlso (nudThreshold.Text <> "")) Then clsRainyDays.AddParameter("type", Chr(34) & "calculation" & Chr(34)) clsRainyDays.AddParameter("function_exp", Chr(34) & "match(" & ucrReceiverRainfall.GetVariableNames(False) & ">=" & nudThreshold.Value & "," & "1, nomatch = 0" & Chr(34)) clsRainyDays.AddParameter("result_name", Chr(34) & "rain_day" & Chr(34)) @@ -186,4 +193,41 @@ Public Class dlgStartofRains clsXdaysRain.RemoveParameterByName("sub_calculations") End If End Sub + + Private Sub DrySpell() + clsDrySpell.AddParameter("type", Chr(34) & "calculation" & Chr(34)) + clsDrySpell.AddParameter("function_exp", Chr(34) & "cumsum(rain_day==0)-cummax((rain_day)*cumsum(rain_day==0))" & Chr(34)) + clsDrySpell.AddParameter("result_name", Chr(34) & "Rolling_Rain_Days" & Chr(34)) + clsDrySpell.AddParameter("calculated_from", "list(Daily =" & " rain_day" & Chr(34) & ")") + clsDrySpell.AddParameter("save", 1) + End Sub + + Private Sub NoTenInThirty() + clsDryPeriodTen.AddParameter("type", Chr(34) & "calculation" & Chr(34)) + clsDryPeriodTen.AddParameter("function_exp", Chr(34) & "rollapply(data = Dry_Spell, width=" & nudMaximumDays.Value & ", FUN=max, align='right', fill=NA)") + clsDryPeriodTen.AddParameter("result_name", Chr(34) & "Dry_Period" & Chr(34)) + clsDryPeriodTen.AddParameter("sub_calculations", "list(Dry_Spell)") + clsDryPeriodTen.AddParameter("save", 2) + End Sub + + Private Sub PeriodWithinThirtyDays() + clsWithinThirtyDays.AddParameter("type", Chr(34) & "filter" & Chr(34)) + clsWithinThirtyDays.AddParameter("function_exp", Chr(34) & "Dry_Period <" & nudLengthofTime.Value & Chr(34)) + clsWithinThirtyDays.AddParameter("calculated_from", "list(Daily = " & Chr(34) & "Dry_Period" & Chr(34) & ")") + End Sub + + Private Sub FirstDOYPerYear() + clsFirstDOYPerYear.AddParameter("type", Chr(34) & "summary" & Chr(34)) + clsFirstDOYPerYear.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & "[" & 1 & "]" & Chr(34)) + clsFirstDOYPerYear.AddParameter("calculated_from", "list(Daily =" & ucrReceiverDOY.GetVariableNames & ")") + clsFirstDOYPerYear.AddParameter("manipulations", "list(" & clsDayFromAndTo.ToScript & "," & clsMinimumRainfall.ToScript & "," & clsXdaysRain.ToScript & "," & clsDryPeriodTen.ToScript & "," & clsYearGroupDaily.ToScript & ")") + firstDayofTheYear() + End Sub + Private Sub YearGroupDaily() + clsYearGroupDaily.AddParameter("type", Chr(34) & "by" & Chr(34)) + clsYearGroupDaily.AddParameter("calculated_from", "list(Daily = " & ucrReceiverDate.GetVariableNames & ")") + End Sub + Private Sub firstDayofTheYear() + ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsFirstDOYPerYear) + End Sub End Class \ No newline at end of file From 1a117c82d035d3b7624d7daf7af173bbbe9ad6b5 Mon Sep 17 00:00:00 2001 From: Lunalo Date: Wed, 7 Dec 2016 14:38:10 +0300 Subject: [PATCH 04/72] Edits on the startofRains Dialog --- instat/dlgStartofRains.vb | 106 ++++++++++++++++++++++++++------------ 1 file changed, 73 insertions(+), 33 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 963d79adb17..3ea63f7cfff 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -14,7 +14,7 @@ ' along with this program. If not, see . Imports instat.Translations Public Class dlgStartofRains - Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsFirstInstance, clsNoRain, clsCumulativeRain, clsDryPeriodTen, clsWithinThirtyDays, clsDrySpell, clsYearGroupDaily As New RFunction + Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsDryPeriodTen, clsWithinThirtyDays, clsDrySpell, clsYearGroupDaily As New RFunction Public bFirstLoad As Boolean = True Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) @@ -29,11 +29,13 @@ Public Class dlgStartofRains End Sub Private Sub ucrReceiverDOY_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDOY.SelectionChanged + firstDayofTheYear() DayFromAndToMethod() End Sub Private Sub ucrSelectorForStartofRains_DataFrameChanged() Handles ucrSelectorForStartofRains.DataFrameChanged clsAddKey.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) + firstDayofTheYear() End Sub Private Sub InitialiseDialog() @@ -46,20 +48,23 @@ Public Class dlgStartofRains clsRollingRainDays.SetRCommand("instat_calculation$new") clsXdaysRain.SetRCommand("instat_calculation$new") clsFirstDOYPerYear.SetRCommand("instat_calculation$new") - clsFirstInstance.SetRCommand("instat_calculation$new") - clsNoRain.SetRCommand("instat_calculation$new") - clsCumulativeRain.SetRCommand("instat_calculation$new") clsDryPeriodTen.SetRCommand("instat_calculation$new") clsWithinThirtyDays.SetRCommand("instat_calculation$new") ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") + ucrReceiverRainfall.Selector = ucrSelectorForStartofRains + ucrReceiverRainfall.Selector = ucrSelectorForStartofRains + ucrReceiverDate.Selector = ucrSelectorForStartofRains + ucrReceiverDOY.Selector = ucrSelectorForStartofRains + ucrReceiverDOY.SetMeAsReceiver() End Sub Private Sub SetDefaults() - ucrReceiverRainfall.Selector = ucrSelectorForStartofRains - ucrReceiverRainfall.SetMeAsReceiver() - ucrReceiverDate.SetMeAsReceiver() - ucrReceiverDOY.SetMeAsReceiver() + ucrSelectorForStartofRains.Reset() + chkConsecutiveRainyDays.Checked = False + chkDrySpell.Checked = False + chkTotalRainfall.Checked = False + CheckBoxesSetting() TestOKEnabled() End Sub @@ -82,6 +87,7 @@ Public Class dlgStartofRains Private Sub grpRainParameters_Enter(sender As Object, e As EventArgs) Handles nudFrom.TextChanged, nudTo.TextChanged, nudThreshold.TextChanged DayFromAndToMethod() + RainyDaysMethod() TestOKEnabled() End Sub @@ -92,8 +98,9 @@ Public Class dlgStartofRains TestOKEnabled() End Sub - Private Sub grpConditionsForSatrtofRains1_Enter(sender As Object, e As EventArgs) Handles chkConsecutiveRainyDays.CheckedChanged, chkTotalRainfall.CheckedChanged, chkTotalRainfall.CheckedChanged - MinimumRainfallMethod + Private Sub grpConditionsForSatrtofRains1_Enter(sender As Object, e As EventArgs) Handles chkConsecutiveRainyDays.CheckedChanged, chkTotalRainfall.CheckedChanged, chkDrySpell.CheckedChanged + CheckBoxesSetting() + MinimumRainfallMethod() End Sub Private Sub ucrReceiverRainfall_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverRainfall.SelectionChanged RainyDaysMethod() @@ -104,11 +111,52 @@ Public Class dlgStartofRains YearGroupDaily() AddKeyMethod() End Sub + + Private Sub CheckBoxesSetting() + If chkTotalRainfall.Checked Then + nudValue.Visible = True + nudOverDays.Visible = True + lblVal.Visible = True + lblOverDays.Visible = True + Else + nudValue.Visible = False + nudOverDays.Visible = False + lblVal.Visible = False + lblOverDays.Visible = False + End If + If chkDrySpell.Checked Then + nudMaximumDays.Visible = True + nudLengthofTime.Visible = True + lblLengthofTime.Visible = True + lblMaximumDays.Visible = True + Else + nudMaximumDays.Visible = False + nudLengthofTime.Visible = False + lblLengthofTime.Visible = False + lblMaximumDays.Visible = False + End If + If chkConsecutiveRainyDays.Checked Then + + nudMinimum.Visible = True + nudOutOfDays.Visible = True + lblMinimum.Visible = True + lblWidth.Visible = True + Else + nudMinimum.Visible = False + nudOutOfDays.Visible = False + lblMinimum.Visible = False + lblWidth.Visible = False + End If + End Sub + + Private Sub AddKeyMethod() If Not ucrReceiverDate.IsEmpty Then + clsAddKey.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) clsAddKey.AddParameter("col_name", ucrReceiverDate.GetVariableNames) Else clsAddKey.RemoveParameterByName("col_name") + clsAddKey.RemoveParameterByName("data_name") End If frmMain.clsRLink.RunInternalScript(clsAddKey.ToScript) End Sub @@ -116,7 +164,7 @@ Public Class dlgStartofRains Private Sub DayFromAndToMethod() If nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso (Not ucrReceiverDOY.IsEmpty) Then clsDayFromAndTo.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & ">" & nudFrom.Value & ucrReceiverDOY.GetVariableNames(False) & "<" & nudTo.Value & Chr(34)) - clsDayFromAndTo.AddParameter("calculated_from", Chr(34) & "list(Daily =" & ucrReceiverDOY.GetVariableNames(False) & ")" & Chr(34)) + clsDayFromAndTo.AddParameter("calculated_from", "list(Daily =" & ucrReceiverDOY.GetVariableNames() & ")") Else clsDayFromAndTo.RemoveParameterByName("function_exp") clsDayFromAndTo.RemoveParameterByName("calculated_from") @@ -126,9 +174,9 @@ Public Class dlgStartofRains Private Sub RainyDaysMethod() If ((Not ucrReceiverRainfall.IsEmpty) AndAlso (nudThreshold.Text <> "")) Then clsRainyDays.AddParameter("type", Chr(34) & "calculation" & Chr(34)) - clsRainyDays.AddParameter("function_exp", Chr(34) & "match(" & ucrReceiverRainfall.GetVariableNames(False) & ">=" & nudThreshold.Value & "," & "1, nomatch = 0" & Chr(34)) + clsRainyDays.AddParameter("function_exp", Chr(34) & "match(" & ucrReceiverRainfall.GetVariableNames(False) & ">=" & nudThreshold.Value & "," & "1, nomatch = 0" & ")" & Chr(34)) clsRainyDays.AddParameter("result_name", Chr(34) & "rain_day" & Chr(34)) - clsRainyDays.AddParameter("calculated_from", "list(Daily = " & ucrReceiverRainfall.GetVariableNames & ")") + clsRainyDays.AddParameter("calculated_from", "list(Daily =" & Chr(34) & "Rain" & Chr(34) & ")") clsRainyDays.AddParameter("save", 2) Else clsRainyDays.RemoveParameterByName("type") @@ -156,21 +204,14 @@ Public Class dlgStartofRains End Sub Private Sub MinimumRainfallMethod() - If chkConsecutiveRainyDays.Checked Then - lblMinimum.Enabled = True - nudMinimum.Enabled = True - If nudMinimum.Text <> "" Then - clsMinimumRainfall.AddParameter("function_exp", Chr(34) & "roll_sum_Rain >" & nudMinimum.Value) - clsMinimumRainfall.AddParameter("type", Chr(34) & "filter" & Chr(34)) - clsMinimumRainfall.AddParameter("sub_calculations", "list(" & clsRollingSum.ToScript & ")") - Else - clsMinimumRainfall.RemoveParameterByName("function_exp") - clsMinimumRainfall.RemoveParameterByName("type") - clsMinimumRainfall.RemoveParameterByName("sub_calculations") - End If + If nudMinimum.Text <> "" Then + clsMinimumRainfall.AddParameter("function_exp", Chr(34) & "roll_sum_Rain >" & nudMinimum.Value) + clsMinimumRainfall.AddParameter("type", Chr(34) & "filter" & Chr(34)) + clsMinimumRainfall.AddParameter("sub_calculations", "list(" & clsRollingSum.ToScript & ")") Else - lblMinimum.Enabled = False - nudMinimum.Enabled = False + clsMinimumRainfall.RemoveParameterByName("function_exp") + clsMinimumRainfall.RemoveParameterByName("type") + clsMinimumRainfall.RemoveParameterByName("sub_calculations") End If RollingOfRainDays() End Sub @@ -179,7 +220,7 @@ Public Class dlgStartofRains clsRollingRainDays.AddParameter("type", Chr(34) & "calculation" & Chr(34)) clsRollingRainDays.AddParameter("function_exp", Chr(34) & "rollapply(data=rain_day, width=5, FUN=sum, align = 'right', fill=NA)" & Chr(34)) clsRollingRainDays.AddParameter("result_name", Chr(34) & "Rolling_Rain_Days" & Chr(34)) - clsRollingRainDays.AddParameter("calculated_from", "list(Daily =" & Chr(34) & " rain_day" & Chr(34) & ")") + clsRollingRainDays.AddParameter("calculated_from", "list(data_name = " & Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34) & "," & "col_name =" & "rainy_day" & ")") clsRollingRainDays.AddParameter("save", 1) End Sub Private Sub XDaysRainMethod() @@ -198,7 +239,7 @@ Public Class dlgStartofRains clsDrySpell.AddParameter("type", Chr(34) & "calculation" & Chr(34)) clsDrySpell.AddParameter("function_exp", Chr(34) & "cumsum(rain_day==0)-cummax((rain_day)*cumsum(rain_day==0))" & Chr(34)) clsDrySpell.AddParameter("result_name", Chr(34) & "Rolling_Rain_Days" & Chr(34)) - clsDrySpell.AddParameter("calculated_from", "list(Daily =" & " rain_day" & Chr(34) & ")") + clsDrySpell.AddParameter("calculated_from", "list(data_name = " & Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34) & "," & "col_name =" & Chr(34) & "rainy_day" & Chr(34) & ")") clsDrySpell.AddParameter("save", 1) End Sub @@ -213,21 +254,20 @@ Public Class dlgStartofRains Private Sub PeriodWithinThirtyDays() clsWithinThirtyDays.AddParameter("type", Chr(34) & "filter" & Chr(34)) clsWithinThirtyDays.AddParameter("function_exp", Chr(34) & "Dry_Period <" & nudLengthofTime.Value & Chr(34)) - clsWithinThirtyDays.AddParameter("calculated_from", "list(Daily = " & Chr(34) & "Dry_Period" & Chr(34) & ")") + clsWithinThirtyDays.AddParameter("calculated_from", "list(data_name = " & Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34) & "," & "col_name =" & "Dry_period" & ")") End Sub Private Sub FirstDOYPerYear() clsFirstDOYPerYear.AddParameter("type", Chr(34) & "summary" & Chr(34)) clsFirstDOYPerYear.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & "[" & 1 & "]" & Chr(34)) - clsFirstDOYPerYear.AddParameter("calculated_from", "list(Daily =" & ucrReceiverDOY.GetVariableNames & ")") + clsFirstDOYPerYear.AddParameter("calculated_from", "list(data_name = " & Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34) & "," & "col_name =" & ucrReceiverDOY.GetVariableNames()) clsFirstDOYPerYear.AddParameter("manipulations", "list(" & clsDayFromAndTo.ToScript & "," & clsMinimumRainfall.ToScript & "," & clsXdaysRain.ToScript & "," & clsDryPeriodTen.ToScript & "," & clsYearGroupDaily.ToScript & ")") - firstDayofTheYear() End Sub Private Sub YearGroupDaily() clsYearGroupDaily.AddParameter("type", Chr(34) & "by" & Chr(34)) clsYearGroupDaily.AddParameter("calculated_from", "list(Daily = " & ucrReceiverDate.GetVariableNames & ")") End Sub Private Sub firstDayofTheYear() - ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsFirstDOYPerYear) + ucrBase.clsRsyntax.AddParameter("calc", clsFirstDOYPerYear.ToScript) End Sub End Class \ No newline at end of file From f56a625d743e9fbb7a03ec46973aab3fa24cb6b6 Mon Sep 17 00:00:00 2001 From: Lunalo Date: Thu, 8 Dec 2016 13:35:10 +0300 Subject: [PATCH 05/72] Edits on dlgStartofRains --- instat/dlgStartofRains.Designer.vb | 81 ++++++++++++--------- instat/dlgStartofRains.vb | 109 +++++++++++++++++++++-------- 2 files changed, 128 insertions(+), 62 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index b9dca1811a4..57c56bd8afb 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -25,7 +25,6 @@ Partial Class dlgStartofRains Me.nudValue = New System.Windows.Forms.NumericUpDown() Me.nudMinimum = New System.Windows.Forms.NumericUpDown() Me.lblRainfall = New System.Windows.Forms.Label() - Me.lblDate = New System.Windows.Forms.Label() Me.grpConditionsForSatrtofRains = New System.Windows.Forms.GroupBox() Me.nudOutOfDays = New System.Windows.Forms.NumericUpDown() Me.lblWidth = New System.Windows.Forms.Label() @@ -49,10 +48,11 @@ Partial Class dlgStartofRains Me.lblTo = New System.Windows.Forms.Label() Me.lblDOY = New System.Windows.Forms.Label() Me.ucrReceiverDOY = New instat.ucrReceiverSingle() - Me.ucrReceiverDate = New instat.ucrReceiverSingle() Me.ucrReceiverRainfall = New instat.ucrReceiverSingle() Me.ucrSelectorForStartofRains = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() + Me.lblDate = New System.Windows.Forms.Label() + Me.ucrReceiverDate = New instat.ucrReceiverSingle() CType(Me.nudValue, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudMinimum, System.ComponentModel.ISupportInitialize).BeginInit() Me.grpConditionsForSatrtofRains.SuspendLayout() @@ -70,6 +70,7 @@ Partial Class dlgStartofRains ' Me.nudValue.Location = New System.Drawing.Point(201, 42) Me.nudValue.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) + Me.nudValue.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudValue.Name = "nudValue" Me.nudValue.Size = New System.Drawing.Size(41, 20) Me.nudValue.TabIndex = 4 @@ -78,6 +79,7 @@ Partial Class dlgStartofRains 'nudMinimum ' Me.nudMinimum.Location = New System.Drawing.Point(201, 18) + Me.nudMinimum.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudMinimum.Name = "nudMinimum" Me.nudMinimum.Size = New System.Drawing.Size(41, 20) Me.nudMinimum.TabIndex = 2 @@ -86,20 +88,11 @@ Partial Class dlgStartofRains 'lblRainfall ' Me.lblRainfall.AutoSize = True - Me.lblRainfall.Location = New System.Drawing.Point(231, 9) + Me.lblRainfall.Location = New System.Drawing.Point(232, 50) Me.lblRainfall.Name = "lblRainfall" - Me.lblRainfall.Size = New System.Drawing.Size(45, 13) + Me.lblRainfall.Size = New System.Drawing.Size(70, 13) Me.lblRainfall.TabIndex = 1 - Me.lblRainfall.Text = "Rainfall:" - ' - 'lblDate - ' - Me.lblDate.AutoSize = True - Me.lblDate.Location = New System.Drawing.Point(234, 49) - Me.lblDate.Name = "lblDate" - Me.lblDate.Size = New System.Drawing.Size(33, 13) - Me.lblDate.TabIndex = 3 - Me.lblDate.Text = "Date:" + Me.lblRainfall.Text = "Rain Column:" ' 'grpConditionsForSatrtofRains ' @@ -128,9 +121,11 @@ Partial Class dlgStartofRains 'nudOutOfDays ' Me.nudOutOfDays.Location = New System.Drawing.Point(332, 20) + Me.nudOutOfDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudOutOfDays.Name = "nudOutOfDays" Me.nudOutOfDays.Size = New System.Drawing.Size(53, 20) Me.nudOutOfDays.TabIndex = 11 + Me.nudOutOfDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'lblWidth ' @@ -144,16 +139,20 @@ Partial Class dlgStartofRains 'nudLengthofTime ' Me.nudLengthofTime.Location = New System.Drawing.Point(332, 72) + Me.nudLengthofTime.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudLengthofTime.Name = "nudLengthofTime" Me.nudLengthofTime.Size = New System.Drawing.Size(53, 20) Me.nudLengthofTime.TabIndex = 9 + Me.nudLengthofTime.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'nudMaximumDays ' Me.nudMaximumDays.Location = New System.Drawing.Point(201, 68) + Me.nudMaximumDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudMaximumDays.Name = "nudMaximumDays" Me.nudMaximumDays.Size = New System.Drawing.Size(41, 20) Me.nudMaximumDays.TabIndex = 7 + Me.nudMaximumDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'nudOverDays ' @@ -278,9 +277,13 @@ Partial Class dlgStartofRains 'nudFrom ' Me.nudFrom.Location = New System.Drawing.Point(81, 35) + Me.nudFrom.Maximum = New Decimal(New Integer() {366, 0, 0, 0}) + Me.nudFrom.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudFrom.Name = "nudFrom" + Me.nudFrom.RightToLeft = System.Windows.Forms.RightToLeft.Yes Me.nudFrom.Size = New System.Drawing.Size(55, 20) Me.nudFrom.TabIndex = 1 + Me.nudFrom.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'lblFrom ' @@ -294,11 +297,12 @@ Partial Class dlgStartofRains 'nudTo ' Me.nudTo.Location = New System.Drawing.Point(81, 61) - Me.nudTo.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) + Me.nudTo.Maximum = New Decimal(New Integer() {366, 0, 0, 0}) + Me.nudTo.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudTo.Name = "nudTo" Me.nudTo.Size = New System.Drawing.Size(53, 20) Me.nudTo.TabIndex = 3 - Me.nudTo.Value = New Decimal(New Integer() {20, 0, 0, 0}) + Me.nudTo.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'lblTo ' @@ -313,7 +317,7 @@ Partial Class dlgStartofRains 'lblDOY ' Me.lblDOY.AutoSize = True - Me.lblDOY.Location = New System.Drawing.Point(234, 89) + Me.lblDOY.Location = New System.Drawing.Point(232, 91) Me.lblDOY.Name = "lblDOY" Me.lblDOY.Size = New System.Drawing.Size(63, 13) Me.lblDOY.TabIndex = 8 @@ -321,25 +325,16 @@ Partial Class dlgStartofRains ' 'ucrReceiverDOY ' - Me.ucrReceiverDOY.Location = New System.Drawing.Point(234, 106) + Me.ucrReceiverDOY.Location = New System.Drawing.Point(234, 104) Me.ucrReceiverDOY.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverDOY.Name = "ucrReceiverDOY" Me.ucrReceiverDOY.Selector = Nothing Me.ucrReceiverDOY.Size = New System.Drawing.Size(144, 20) Me.ucrReceiverDOY.TabIndex = 9 ' - 'ucrReceiverDate - ' - Me.ucrReceiverDate.Location = New System.Drawing.Point(234, 65) - Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverDate.Name = "ucrReceiverDate" - Me.ucrReceiverDate.Selector = Nothing - Me.ucrReceiverDate.Size = New System.Drawing.Size(144, 20) - Me.ucrReceiverDate.TabIndex = 4 - ' 'ucrReceiverRainfall ' - Me.ucrReceiverRainfall.Location = New System.Drawing.Point(234, 26) + Me.ucrReceiverRainfall.Location = New System.Drawing.Point(235, 67) Me.ucrReceiverRainfall.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverRainfall.Name = "ucrReceiverRainfall" Me.ucrReceiverRainfall.Selector = Nothing @@ -350,7 +345,7 @@ Partial Class dlgStartofRains ' Me.ucrSelectorForStartofRains.bShowHiddenColumns = False Me.ucrSelectorForStartofRains.bUseCurrentFilter = True - Me.ucrSelectorForStartofRains.Location = New System.Drawing.Point(18, 9) + Me.ucrSelectorForStartofRains.Location = New System.Drawing.Point(9, 9) Me.ucrSelectorForStartofRains.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorForStartofRains.Name = "ucrSelectorForStartofRains" Me.ucrSelectorForStartofRains.Size = New System.Drawing.Size(210, 180) @@ -363,18 +358,36 @@ Partial Class dlgStartofRains Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 0 ' + 'lblDate + ' + Me.lblDate.AutoSize = True + Me.lblDate.Location = New System.Drawing.Point(232, 12) + Me.lblDate.Name = "lblDate" + Me.lblDate.Size = New System.Drawing.Size(33, 13) + Me.lblDate.TabIndex = 10 + Me.lblDate.Text = "Date:" + ' + 'ucrReceiverDate + ' + Me.ucrReceiverDate.Location = New System.Drawing.Point(234, 25) + Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverDate.Name = "ucrReceiverDate" + Me.ucrReceiverDate.Selector = Nothing + Me.ucrReceiverDate.Size = New System.Drawing.Size(144, 20) + Me.ucrReceiverDate.TabIndex = 11 + ' 'dlgStartofRains ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(415, 385) + Me.ClientSize = New System.Drawing.Size(413, 385) + Me.Controls.Add(Me.lblDate) + Me.Controls.Add(Me.ucrReceiverDate) Me.Controls.Add(Me.ucrReceiverDOY) Me.Controls.Add(Me.lblDOY) Me.Controls.Add(Me.grpRainParameters) Me.Controls.Add(Me.grpConditionsForSatrtofRains) - Me.Controls.Add(Me.lblDate) Me.Controls.Add(Me.lblRainfall) - Me.Controls.Add(Me.ucrReceiverDate) Me.Controls.Add(Me.ucrReceiverRainfall) Me.Controls.Add(Me.ucrSelectorForStartofRains) Me.Controls.Add(Me.ucrBase) @@ -407,9 +420,7 @@ Partial Class dlgStartofRains Friend WithEvents nudMinimum As NumericUpDown Friend WithEvents ucrSelectorForStartofRains As ucrSelectorByDataFrameAddRemove Friend WithEvents ucrReceiverRainfall As ucrReceiverSingle - Friend WithEvents ucrReceiverDate As ucrReceiverSingle Friend WithEvents lblRainfall As Label - Friend WithEvents lblDate As Label Friend WithEvents grpConditionsForSatrtofRains As GroupBox Friend WithEvents nudLengthofTime As NumericUpDown Friend WithEvents nudMaximumDays As NumericUpDown @@ -433,4 +444,6 @@ Partial Class dlgStartofRains Friend WithEvents nudOutOfDays As NumericUpDown Friend WithEvents nudThreshold As NumericUpDown Friend WithEvents lblThreshold As Label + Friend WithEvents lblDate As Label + Friend WithEvents ucrReceiverDate As ucrReceiverSingle End Class diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 3ea63f7cfff..fc81d4e1e96 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -14,7 +14,8 @@ ' along with this program. If not, see . Imports instat.Translations Public Class dlgStartofRains - Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsDryPeriodTen, clsWithinThirtyDays, clsDrySpell, clsYearGroupDaily As New RFunction + Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsDryPeriodTen, clsWithinThirtyDays, clsDrySpell, clsYearGroupDaily, clsSubCalcMinSum, clsSubCalcXDaysRain, clsSubCalcNoTenInThirty, clsManipulationFirstDOYPerYear, clsApplyRainDays As New RFunction + Private strCurrDataName As String = "" Public bFirstLoad As Boolean = True Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) @@ -31,31 +32,50 @@ Public Class dlgStartofRains Private Sub ucrReceiverDOY_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDOY.SelectionChanged firstDayofTheYear() DayFromAndToMethod() + FirstDOYPerYear() End Sub Private Sub ucrSelectorForStartofRains_DataFrameChanged() Handles ucrSelectorForStartofRains.DataFrameChanged - clsAddKey.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) + strCurrDataName = Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34) + clsAddKey.AddParameter("data_name", strCurrDataName) firstDayofTheYear() End Sub Private Sub InitialiseDialog() clsAddKey.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_key") clsDayFromAndTo.SetRCommand("instat_calculation$new") + clsDayFromAndTo.SetAssignTo("Day_From_and_To") clsYearGroupDaily.SetRCommand("instat_calculation$new") clsRainyDays.SetRCommand("instat_calculation$new") + 'clsRainyDays.SetAssignTo("Rainy_Days") clsRollingSum.SetRCommand("instat_calculation$new") + clsRollingSum.SetAssignTo("rolling_sum") clsMinimumRainfall.SetRCommand("instat_calculation$new") + clsMinimumRainfall.SetAssignTo("Minimum_Rainfall") clsRollingRainDays.SetRCommand("instat_calculation$new") + clsRollingRainDays.SetAssignTo("Rolling_Of_rain_days") clsXdaysRain.SetRCommand("instat_calculation$new") + clsXdaysRain.SetAssignTo("x_Days_Rain") clsFirstDOYPerYear.SetRCommand("instat_calculation$new") + clsFirstDOYPerYear.SetAssignTo("First_doy_per_year") clsDryPeriodTen.SetRCommand("instat_calculation$new") + clsDryPeriodTen.SetAssignTo("Dry_Period_10") + clsDrySpell.SetRCommand("instat_calculation$new") + clsDrySpell.SetAssignTo("Dry_Spell") clsWithinThirtyDays.SetRCommand("instat_calculation$new") + clsWithinThirtyDays.SetAssignTo("dry_spell_no_10_in_30") ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") + clsApplyRainDays.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") + clsApplyRainDays.AddParameter("calc", clsRFunctionParameter:=clsRainyDays) + clsSubCalcMinSum.SetRCommand("list") + clsSubCalcXDaysRain.SetRCommand("list") + clsSubCalcNoTenInThirty.SetRCommand("list") + clsManipulationFirstDOYPerYear.SetRCommand("list") ucrReceiverRainfall.Selector = ucrSelectorForStartofRains ucrReceiverRainfall.Selector = ucrSelectorForStartofRains ucrReceiverDate.Selector = ucrSelectorForStartofRains ucrReceiverDOY.Selector = ucrSelectorForStartofRains - ucrReceiverDOY.SetMeAsReceiver() + ucrReceiverDate.SetMeAsReceiver() End Sub @@ -95,6 +115,7 @@ Public Class dlgStartofRains RainyDaysMethod() MinimumRainfallMethod() XDaysRainMethod() + PeriodWithinThirtyDays() TestOKEnabled() End Sub @@ -107,7 +128,7 @@ Public Class dlgStartofRains RollingSumMethod() End Sub - Private Sub ucrReceiverDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDate.SelectionChanged + Private Sub ucrReceiverDate_SelectionChanged(sender As Object, e As EventArgs) YearGroupDaily() AddKeyMethod() End Sub @@ -158,13 +179,13 @@ Public Class dlgStartofRains clsAddKey.RemoveParameterByName("col_name") clsAddKey.RemoveParameterByName("data_name") End If - frmMain.clsRLink.RunInternalScript(clsAddKey.ToScript) End Sub Private Sub DayFromAndToMethod() If nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso (Not ucrReceiverDOY.IsEmpty) Then - clsDayFromAndTo.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & ">" & nudFrom.Value & ucrReceiverDOY.GetVariableNames(False) & "<" & nudTo.Value & Chr(34)) - clsDayFromAndTo.AddParameter("calculated_from", "list(Daily =" & ucrReceiverDOY.GetVariableNames() & ")") + clsDayFromAndTo.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & ">" & nudFrom.Value & " & " & ucrReceiverDOY.GetVariableNames(False) & "<" & nudTo.Value & Chr(34)) + clsDayFromAndTo.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverDOY.GetVariableNames() & ")") + clsDayFromAndTo.AddParameter("type", Chr(34) & "filter" & Chr(34)) Else clsDayFromAndTo.RemoveParameterByName("function_exp") clsDayFromAndTo.RemoveParameterByName("calculated_from") @@ -176,7 +197,7 @@ Public Class dlgStartofRains clsRainyDays.AddParameter("type", Chr(34) & "calculation" & Chr(34)) clsRainyDays.AddParameter("function_exp", Chr(34) & "match(" & ucrReceiverRainfall.GetVariableNames(False) & ">=" & nudThreshold.Value & "," & "1, nomatch = 0" & ")" & Chr(34)) clsRainyDays.AddParameter("result_name", Chr(34) & "rain_day" & Chr(34)) - clsRainyDays.AddParameter("calculated_from", "list(Daily =" & Chr(34) & "Rain" & Chr(34) & ")") + clsRainyDays.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & Chr(34) & "Rain" & Chr(34) & ")") clsRainyDays.AddParameter("save", 2) Else clsRainyDays.RemoveParameterByName("type") @@ -189,10 +210,10 @@ Public Class dlgStartofRains Private Sub RollingSumMethod() If Not ucrReceiverRainfall.IsEmpty Then - clsRollingSum.AddParameter("function_exp", Chr(34) & " rollapply(" & ucrReceiverRainfall.GetVariableNames(False) & " ,2,sum,align='right',fill=NA)" & Chr(34)) + clsRollingSum.AddParameter("function_exp", Chr(34) & " rollapply(data = " & ucrReceiverRainfall.GetVariableNames(False) & " ,width = " & nudOutOfDays.Value & ", FUN = sum, align='right', fill=NA)" & Chr(34)) clsRollingSum.AddParameter("type", Chr(34) & "calculation" & Chr(34)) clsRollingSum.AddParameter("result_name", Chr(34) & "roll_sum_Rain" & Chr(34)) - clsRollingSum.AddParameter("calculated_from", "list(Daily = " & ucrReceiverRainfall.GetVariableNames & ")") + clsRollingSum.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverRainfall.GetVariableNames & ")") clsRollingSum.AddParameter("save", 1) Else clsRollingSum.RemoveParameterByName("function_exp") @@ -204,70 +225,102 @@ Public Class dlgStartofRains End Sub Private Sub MinimumRainfallMethod() - If nudMinimum.Text <> "" Then - clsMinimumRainfall.AddParameter("function_exp", Chr(34) & "roll_sum_Rain >" & nudMinimum.Value) + If nudValue.Text <> "" Then + clsMinimumRainfall.AddParameter("function_exp", Chr(34) & "roll_sum_Rain >" & nudValue.Value & Chr(34)) clsMinimumRainfall.AddParameter("type", Chr(34) & "filter" & Chr(34)) - clsMinimumRainfall.AddParameter("sub_calculations", "list(" & clsRollingSum.ToScript & ")") + clsSubCalcMinSum.AddParameter("sub1", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) + clsMinimumRainfall.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubCalcMinSum) Else clsMinimumRainfall.RemoveParameterByName("function_exp") clsMinimumRainfall.RemoveParameterByName("type") clsMinimumRainfall.RemoveParameterByName("sub_calculations") + clsSubCalcMinSum.RemoveParameterByName("sub1") End If RollingOfRainDays() End Sub Private Sub RollingOfRainDays() + clsRollingRainDays.AddParameter("type", Chr(34) & "calculation" & Chr(34)) - clsRollingRainDays.AddParameter("function_exp", Chr(34) & "rollapply(data=rain_day, width=5, FUN=sum, align = 'right', fill=NA)" & Chr(34)) + clsRollingRainDays.AddParameter("function_exp", Chr(34) & "rollapply(data=rain_day, width= " & nudOutOfDays.Value & ", FUN=sum, align = 'right', fill=NA)" & Chr(34)) clsRollingRainDays.AddParameter("result_name", Chr(34) & "Rolling_Rain_Days" & Chr(34)) - clsRollingRainDays.AddParameter("calculated_from", "list(data_name = " & Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34) & "," & "col_name =" & "rainy_day" & ")") + clsRollingRainDays.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & Chr(34) & "rain_day" & Chr(34) & ")") clsRollingRainDays.AddParameter("save", 1) End Sub Private Sub XDaysRainMethod() If nudMinimum.Text <> "" Then clsXdaysRain.AddParameter("type", Chr(34) & "filter" & Chr(34)) - clsXdaysRain.AddParameter("function_exp", "Rolling_Rain_Days >=" & nudMinimum.Value) - clsXdaysRain.AddParameter("sub_calculations", "list(Rolling_Of_rain_days)") + clsXdaysRain.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >=" & nudMinimum.Value & Chr(34)) + clsSubCalcXDaysRain.AddParameter("sub1", clsRFunctionParameter:=clsRollingRainDays, bIncludeArgumentName:=False) + clsXdaysRain.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubCalcXDaysRain) Else clsXdaysRain.RemoveParameterByName("type") clsXdaysRain.RemoveParameterByName("function_exp") clsXdaysRain.RemoveParameterByName("sub_calculations") + clsSubCalcXDaysRain.RemoveParameterByName("sub1") End If + DrySpell() End Sub Private Sub DrySpell() clsDrySpell.AddParameter("type", Chr(34) & "calculation" & Chr(34)) clsDrySpell.AddParameter("function_exp", Chr(34) & "cumsum(rain_day==0)-cummax((rain_day)*cumsum(rain_day==0))" & Chr(34)) - clsDrySpell.AddParameter("result_name", Chr(34) & "Rolling_Rain_Days" & Chr(34)) - clsDrySpell.AddParameter("calculated_from", "list(data_name = " & Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34) & "," & "col_name =" & Chr(34) & "rainy_day" & Chr(34) & ")") + clsDrySpell.AddParameter("result_name", Chr(34) & "Dry_Spell" & Chr(34)) + clsDrySpell.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & Chr(34) & "rain_day" & Chr(34) & ")") clsDrySpell.AddParameter("save", 1) + NoTenInThirty() End Sub Private Sub NoTenInThirty() + clsSubCalcNoTenInThirty.AddParameter("sub1", clsRFunctionParameter:=clsDrySpell, bIncludeArgumentName:=False) clsDryPeriodTen.AddParameter("type", Chr(34) & "calculation" & Chr(34)) - clsDryPeriodTen.AddParameter("function_exp", Chr(34) & "rollapply(data = Dry_Spell, width=" & nudMaximumDays.Value & ", FUN=max, align='right', fill=NA)") + clsDryPeriodTen.AddParameter("function_exp", Chr(34) & "rollapply(data = Dry_Spell, width=" & nudMaximumDays.Value & ", FUN=max, align='right', fill=NA)" & Chr(34)) clsDryPeriodTen.AddParameter("result_name", Chr(34) & "Dry_Period" & Chr(34)) - clsDryPeriodTen.AddParameter("sub_calculations", "list(Dry_Spell)") + clsDryPeriodTen.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubCalcNoTenInThirty) clsDryPeriodTen.AddParameter("save", 2) + PeriodWithinThirtyDays() End Sub Private Sub PeriodWithinThirtyDays() clsWithinThirtyDays.AddParameter("type", Chr(34) & "filter" & Chr(34)) clsWithinThirtyDays.AddParameter("function_exp", Chr(34) & "Dry_Period <" & nudLengthofTime.Value & Chr(34)) - clsWithinThirtyDays.AddParameter("calculated_from", "list(data_name = " & Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34) & "," & "col_name =" & "Dry_period" & ")") + clsWithinThirtyDays.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & Chr(34) & "Dry_period" & ")" & Chr(34)) End Sub Private Sub FirstDOYPerYear() - clsFirstDOYPerYear.AddParameter("type", Chr(34) & "summary" & Chr(34)) - clsFirstDOYPerYear.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & "[" & 1 & "]" & Chr(34)) - clsFirstDOYPerYear.AddParameter("calculated_from", "list(data_name = " & Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34) & "," & "col_name =" & ucrReceiverDOY.GetVariableNames()) - clsFirstDOYPerYear.AddParameter("manipulations", "list(" & clsDayFromAndTo.ToScript & "," & clsMinimumRainfall.ToScript & "," & clsXdaysRain.ToScript & "," & clsDryPeriodTen.ToScript & "," & clsYearGroupDaily.ToScript & ")") + If Not ucrReceiverDOY.IsEmpty Then + clsManipulationFirstDOYPerYear.AddParameter("sub1", clsRFunctionParameter:=clsXdaysRain, bIncludeArgumentName:=False) + clsManipulationFirstDOYPerYear.AddParameter("sub2", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + clsManipulationFirstDOYPerYear.AddParameter("sub3", clsRFunctionParameter:=clsYearGroupDaily, bIncludeArgumentName:=False) + clsManipulationFirstDOYPerYear.AddParameter("sub4", clsRFunctionParameter:=clsMinimumRainfall, bIncludeArgumentName:=False) + clsManipulationFirstDOYPerYear.AddParameter("sub5", clsRFunctionParameter:=clsDayFromAndTo, bIncludeArgumentName:=False) + clsFirstDOYPerYear.AddParameter("type", Chr(34) & "summary" & Chr(34)) + clsFirstDOYPerYear.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & "[" & 1 & "]" & Chr(34)) + clsFirstDOYPerYear.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverDOY.GetVariableNames() & ")") + clsFirstDOYPerYear.AddParameter("manipulations", clsRFunctionParameter:=clsManipulationFirstDOYPerYear) + clsFirstDOYPerYear.AddParameter("result_name", Chr(34) & "Start_of_Rains" & Chr(34)) + Else + clsManipulationFirstDOYPerYear.RemoveParameterByName("sub1") + clsManipulationFirstDOYPerYear.RemoveParameterByName("sub2") + clsManipulationFirstDOYPerYear.RemoveParameterByName("sub3") + clsManipulationFirstDOYPerYear.RemoveParameterByName("sub4") + clsManipulationFirstDOYPerYear.RemoveParameterByName("sub5") + clsFirstDOYPerYear.RemoveParameterByName("type") + clsFirstDOYPerYear.RemoveParameterByName("function_exp") + clsFirstDOYPerYear.RemoveParameterByName("calculated_from") + clsFirstDOYPerYear.RemoveParameterByName("manipulations") + End If End Sub Private Sub YearGroupDaily() clsYearGroupDaily.AddParameter("type", Chr(34) & "by" & Chr(34)) - clsYearGroupDaily.AddParameter("calculated_from", "list(Daily = " & ucrReceiverDate.GetVariableNames & ")") + clsYearGroupDaily.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverDate.GetVariableNames & ")") End Sub Private Sub firstDayofTheYear() - ucrBase.clsRsyntax.AddParameter("calc", clsFirstDOYPerYear.ToScript) + ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsFirstDOYPerYear) + End Sub + + Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk + frmMain.clsRLink.RunScript(clsAddKey.ToScript, strComment:="Start of Rains: Defining Date column as key") + frmMain.clsRLink.RunScript(clsApplyRainDays.ToScript, strComment:="Start of Rains: Creating rain_day column") End Sub End Class \ No newline at end of file From 3b65a693aac6012bbb2bc0c807ddd83c2fe7095c Mon Sep 17 00:00:00 2001 From: Lunalo Date: Thu, 8 Dec 2016 14:09:55 +0300 Subject: [PATCH 06/72] Minor Edits --- instat/dlgStartofRains.Designer.vb | 44 +++++++++++++++--------------- instat/dlgStartofRains.vb | 8 +++--- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index 57c56bd8afb..4e64fc7a50f 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -47,12 +47,12 @@ Partial Class dlgStartofRains Me.nudTo = New System.Windows.Forms.NumericUpDown() Me.lblTo = New System.Windows.Forms.Label() Me.lblDOY = New System.Windows.Forms.Label() + Me.lblDate = New System.Windows.Forms.Label() + Me.ucrReceiverDate = New instat.ucrReceiverSingle() Me.ucrReceiverDOY = New instat.ucrReceiverSingle() Me.ucrReceiverRainfall = New instat.ucrReceiverSingle() Me.ucrSelectorForStartofRains = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.lblDate = New System.Windows.Forms.Label() - Me.ucrReceiverDate = New instat.ucrReceiverSingle() CType(Me.nudValue, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudMinimum, System.ComponentModel.ISupportInitialize).BeginInit() Me.grpConditionsForSatrtofRains.SuspendLayout() @@ -132,9 +132,9 @@ Partial Class dlgStartofRains Me.lblWidth.AutoSize = True Me.lblWidth.Location = New System.Drawing.Point(256, 20) Me.lblWidth.Name = "lblWidth" - Me.lblWidth.Size = New System.Drawing.Size(75, 13) + Me.lblWidth.Size = New System.Drawing.Size(66, 13) Me.lblWidth.TabIndex = 10 - Me.lblWidth.Text = "Out of 5 Days:" + Me.lblWidth.Text = "Out of Days:" ' 'nudLengthofTime ' @@ -323,6 +323,24 @@ Partial Class dlgStartofRains Me.lblDOY.TabIndex = 8 Me.lblDOY.Text = "Day of Year" ' + 'lblDate + ' + Me.lblDate.AutoSize = True + Me.lblDate.Location = New System.Drawing.Point(232, 12) + Me.lblDate.Name = "lblDate" + Me.lblDate.Size = New System.Drawing.Size(33, 13) + Me.lblDate.TabIndex = 10 + Me.lblDate.Text = "Date:" + ' + 'ucrReceiverDate + ' + Me.ucrReceiverDate.Location = New System.Drawing.Point(234, 25) + Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverDate.Name = "ucrReceiverDate" + Me.ucrReceiverDate.Selector = Nothing + Me.ucrReceiverDate.Size = New System.Drawing.Size(144, 20) + Me.ucrReceiverDate.TabIndex = 11 + ' 'ucrReceiverDOY ' Me.ucrReceiverDOY.Location = New System.Drawing.Point(234, 104) @@ -358,24 +376,6 @@ Partial Class dlgStartofRains Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 0 ' - 'lblDate - ' - Me.lblDate.AutoSize = True - Me.lblDate.Location = New System.Drawing.Point(232, 12) - Me.lblDate.Name = "lblDate" - Me.lblDate.Size = New System.Drawing.Size(33, 13) - Me.lblDate.TabIndex = 10 - Me.lblDate.Text = "Date:" - ' - 'ucrReceiverDate - ' - Me.ucrReceiverDate.Location = New System.Drawing.Point(234, 25) - Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverDate.Name = "ucrReceiverDate" - Me.ucrReceiverDate.Selector = Nothing - Me.ucrReceiverDate.Size = New System.Drawing.Size(144, 20) - Me.ucrReceiverDate.TabIndex = 11 - ' 'dlgStartofRains ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index fc81d4e1e96..883b644891d 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -113,9 +113,11 @@ Public Class dlgStartofRains Private Sub grpConditionsForSatrtofRains_Enter(sender As Object, e As EventArgs) Handles nudValue.TextChanged, nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged, nudOverDays.TextChanged RainyDaysMethod() + DayFromAndToMethod() MinimumRainfallMethod() XDaysRainMethod() PeriodWithinThirtyDays() + RollingOfRainDays() TestOKEnabled() End Sub @@ -128,7 +130,7 @@ Public Class dlgStartofRains RollingSumMethod() End Sub - Private Sub ucrReceiverDate_SelectionChanged(sender As Object, e As EventArgs) + Private Sub ucrReceiverDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDate.SelectionChanged YearGroupDaily() AddKeyMethod() End Sub @@ -173,11 +175,9 @@ Public Class dlgStartofRains Private Sub AddKeyMethod() If Not ucrReceiverDate.IsEmpty Then - clsAddKey.AddParameter("data_name", Chr(34) & ucrSelectorForStartofRains.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) clsAddKey.AddParameter("col_name", ucrReceiverDate.GetVariableNames) Else clsAddKey.RemoveParameterByName("col_name") - clsAddKey.RemoveParameterByName("data_name") End If End Sub @@ -274,7 +274,7 @@ Public Class dlgStartofRains Private Sub NoTenInThirty() clsSubCalcNoTenInThirty.AddParameter("sub1", clsRFunctionParameter:=clsDrySpell, bIncludeArgumentName:=False) clsDryPeriodTen.AddParameter("type", Chr(34) & "calculation" & Chr(34)) - clsDryPeriodTen.AddParameter("function_exp", Chr(34) & "rollapply(data = Dry_Spell, width=" & nudMaximumDays.Value & ", FUN=max, align='right', fill=NA)" & Chr(34)) + clsDryPeriodTen.AddParameter("function_exp", Chr(34) & "rollapply(data = Dry_Spell, width=" & nudLengthofTime.Value & ", FUN=max, align='right', fill=NA)" & Chr(34)) clsDryPeriodTen.AddParameter("result_name", Chr(34) & "Dry_Period" & Chr(34)) clsDryPeriodTen.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubCalcNoTenInThirty) clsDryPeriodTen.AddParameter("save", 2) From 322276a7410dec914d8d36a08a9c83b7e490bfc0 Mon Sep 17 00:00:00 2001 From: Lunalo Date: Thu, 8 Dec 2016 14:15:23 +0300 Subject: [PATCH 07/72] Minor changes --- instat/dlgStartofRains.Designer.vb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index 4e64fc7a50f..5580b8ff095 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -113,7 +113,7 @@ Partial Class dlgStartofRains Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudValue) Me.grpConditionsForSatrtofRains.Location = New System.Drawing.Point(12, 220) Me.grpConditionsForSatrtofRains.Name = "grpConditionsForSatrtofRains" - Me.grpConditionsForSatrtofRains.Size = New System.Drawing.Size(395, 105) + Me.grpConditionsForSatrtofRains.Size = New System.Drawing.Size(395, 95) Me.grpConditionsForSatrtofRains.TabIndex = 7 Me.grpConditionsForSatrtofRains.TabStop = False Me.grpConditionsForSatrtofRains.Text = "Conditions for Start of Rains" @@ -283,6 +283,8 @@ Partial Class dlgStartofRains Me.nudFrom.RightToLeft = System.Windows.Forms.RightToLeft.Yes Me.nudFrom.Size = New System.Drawing.Size(55, 20) Me.nudFrom.TabIndex = 1 + Me.nudFrom.TextAlign = System.Windows.Forms.HorizontalAlignment.Right + Me.nudFrom.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left Me.nudFrom.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'lblFrom @@ -371,7 +373,7 @@ Partial Class dlgStartofRains ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(12, 331) + Me.ucrBase.Location = New System.Drawing.Point(12, 321) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 0 @@ -380,7 +382,7 @@ Partial Class dlgStartofRains ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(413, 385) + Me.ClientSize = New System.Drawing.Size(413, 378) Me.Controls.Add(Me.lblDate) Me.Controls.Add(Me.ucrReceiverDate) Me.Controls.Add(Me.ucrReceiverDOY) From 7b03b82eae7caeadd059da77531a0ec676980f68 Mon Sep 17 00:00:00 2001 From: Lunalo Date: Thu, 8 Dec 2016 15:30:26 +0300 Subject: [PATCH 08/72] Edits on dlgSatrtOfRains --- instat/dlgStartofRains.Designer.vb | 58 +++++++++++++++--------------- instat/dlgStartofRains.vb | 8 +++-- 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index 5580b8ff095..2136e565f51 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -73,7 +73,7 @@ Partial Class dlgStartofRains Me.nudValue.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudValue.Name = "nudValue" Me.nudValue.Size = New System.Drawing.Size(41, 20) - Me.nudValue.TabIndex = 4 + Me.nudValue.TabIndex = 7 Me.nudValue.Value = New Decimal(New Integer() {30, 0, 0, 0}) ' 'nudMinimum @@ -91,7 +91,7 @@ Partial Class dlgStartofRains Me.lblRainfall.Location = New System.Drawing.Point(232, 50) Me.lblRainfall.Name = "lblRainfall" Me.lblRainfall.Size = New System.Drawing.Size(70, 13) - Me.lblRainfall.TabIndex = 1 + Me.lblRainfall.TabIndex = 3 Me.lblRainfall.Text = "Rain Column:" ' 'grpConditionsForSatrtofRains @@ -114,7 +114,7 @@ Partial Class dlgStartofRains Me.grpConditionsForSatrtofRains.Location = New System.Drawing.Point(12, 220) Me.grpConditionsForSatrtofRains.Name = "grpConditionsForSatrtofRains" Me.grpConditionsForSatrtofRains.Size = New System.Drawing.Size(395, 95) - Me.grpConditionsForSatrtofRains.TabIndex = 7 + Me.grpConditionsForSatrtofRains.TabIndex = 8 Me.grpConditionsForSatrtofRains.TabStop = False Me.grpConditionsForSatrtofRains.Text = "Conditions for Start of Rains" ' @@ -124,7 +124,7 @@ Partial Class dlgStartofRains Me.nudOutOfDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudOutOfDays.Name = "nudOutOfDays" Me.nudOutOfDays.Size = New System.Drawing.Size(53, 20) - Me.nudOutOfDays.TabIndex = 11 + Me.nudOutOfDays.TabIndex = 4 Me.nudOutOfDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'lblWidth @@ -133,7 +133,7 @@ Partial Class dlgStartofRains Me.lblWidth.Location = New System.Drawing.Point(256, 20) Me.lblWidth.Name = "lblWidth" Me.lblWidth.Size = New System.Drawing.Size(66, 13) - Me.lblWidth.TabIndex = 10 + Me.lblWidth.TabIndex = 3 Me.lblWidth.Text = "Out of Days:" ' 'nudLengthofTime @@ -142,7 +142,7 @@ Partial Class dlgStartofRains Me.nudLengthofTime.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudLengthofTime.Name = "nudLengthofTime" Me.nudLengthofTime.Size = New System.Drawing.Size(53, 20) - Me.nudLengthofTime.TabIndex = 9 + Me.nudLengthofTime.TabIndex = 14 Me.nudLengthofTime.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'nudMaximumDays @@ -151,7 +151,7 @@ Partial Class dlgStartofRains Me.nudMaximumDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudMaximumDays.Name = "nudMaximumDays" Me.nudMaximumDays.Size = New System.Drawing.Size(41, 20) - Me.nudMaximumDays.TabIndex = 7 + Me.nudMaximumDays.TabIndex = 12 Me.nudMaximumDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'nudOverDays @@ -161,7 +161,7 @@ Partial Class dlgStartofRains Me.nudOverDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudOverDays.Name = "nudOverDays" Me.nudOverDays.Size = New System.Drawing.Size(53, 20) - Me.nudOverDays.TabIndex = 7 + Me.nudOverDays.TabIndex = 9 Me.nudOverDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'lblLengthofTime @@ -170,7 +170,7 @@ Partial Class dlgStartofRains Me.lblLengthofTime.Location = New System.Drawing.Point(246, 74) Me.lblLengthofTime.Name = "lblLengthofTime" Me.lblLengthofTime.Size = New System.Drawing.Size(81, 13) - Me.lblLengthofTime.TabIndex = 8 + Me.lblLengthofTime.TabIndex = 13 Me.lblLengthofTime.Text = "Length of Time:" ' 'lblMaximumDays @@ -179,7 +179,7 @@ Partial Class dlgStartofRains Me.lblMaximumDays.Location = New System.Drawing.Point(114, 72) Me.lblMaximumDays.Name = "lblMaximumDays" Me.lblMaximumDays.Size = New System.Drawing.Size(81, 13) - Me.lblMaximumDays.TabIndex = 6 + Me.lblMaximumDays.TabIndex = 11 Me.lblMaximumDays.Text = "Maximum Days:" ' 'lblVal @@ -188,7 +188,7 @@ Partial Class dlgStartofRains Me.lblVal.Location = New System.Drawing.Point(163, 44) Me.lblVal.Name = "lblVal" Me.lblVal.Size = New System.Drawing.Size(37, 13) - Me.lblVal.TabIndex = 3 + Me.lblVal.TabIndex = 6 Me.lblVal.Text = "Value:" ' 'lblOverDays @@ -197,7 +197,7 @@ Partial Class dlgStartofRains Me.lblOverDays.Location = New System.Drawing.Point(268, 49) Me.lblOverDays.Name = "lblOverDays" Me.lblOverDays.Size = New System.Drawing.Size(60, 13) - Me.lblOverDays.TabIndex = 6 + Me.lblOverDays.TabIndex = 8 Me.lblOverDays.Tag = "" Me.lblOverDays.Text = "Over Days:" ' @@ -216,7 +216,7 @@ Partial Class dlgStartofRains Me.chkDrySpell.Location = New System.Drawing.Point(7, 71) Me.chkDrySpell.Name = "chkDrySpell" Me.chkDrySpell.Size = New System.Drawing.Size(68, 17) - Me.chkDrySpell.TabIndex = 5 + Me.chkDrySpell.TabIndex = 10 Me.chkDrySpell.Text = "Dry Spell" Me.chkDrySpell.UseVisualStyleBackColor = True ' @@ -226,7 +226,7 @@ Partial Class dlgStartofRains Me.chkTotalRainfall.Location = New System.Drawing.Point(7, 46) Me.chkTotalRainfall.Name = "chkTotalRainfall" Me.chkTotalRainfall.Size = New System.Drawing.Size(88, 17) - Me.chkTotalRainfall.TabIndex = 1 + Me.chkTotalRainfall.TabIndex = 5 Me.chkTotalRainfall.Text = "Total Rainfall" Me.chkTotalRainfall.UseVisualStyleBackColor = True ' @@ -251,7 +251,7 @@ Partial Class dlgStartofRains Me.grpRainParameters.Location = New System.Drawing.Point(234, 129) Me.grpRainParameters.Name = "grpRainParameters" Me.grpRainParameters.Size = New System.Drawing.Size(150, 87) - Me.grpRainParameters.TabIndex = 5 + Me.grpRainParameters.TabIndex = 7 Me.grpRainParameters.TabStop = False ' 'nudThreshold @@ -261,7 +261,7 @@ Partial Class dlgStartofRains Me.nudThreshold.Location = New System.Drawing.Point(81, 11) Me.nudThreshold.Name = "nudThreshold" Me.nudThreshold.Size = New System.Drawing.Size(53, 20) - Me.nudThreshold.TabIndex = 7 + Me.nudThreshold.TabIndex = 1 Me.nudThreshold.Value = New Decimal(New Integer() {85, 0, 0, 131072}) ' 'lblThreshold @@ -270,7 +270,7 @@ Partial Class dlgStartofRains Me.lblThreshold.Location = New System.Drawing.Point(7, 13) Me.lblThreshold.Name = "lblThreshold" Me.lblThreshold.Size = New System.Drawing.Size(57, 13) - Me.lblThreshold.TabIndex = 6 + Me.lblThreshold.TabIndex = 0 Me.lblThreshold.Tag = "Threshold" Me.lblThreshold.Text = "Threshold:" ' @@ -282,7 +282,7 @@ Partial Class dlgStartofRains Me.nudFrom.Name = "nudFrom" Me.nudFrom.RightToLeft = System.Windows.Forms.RightToLeft.Yes Me.nudFrom.Size = New System.Drawing.Size(55, 20) - Me.nudFrom.TabIndex = 1 + Me.nudFrom.TabIndex = 3 Me.nudFrom.TextAlign = System.Windows.Forms.HorizontalAlignment.Right Me.nudFrom.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left Me.nudFrom.Value = New Decimal(New Integer() {1, 0, 0, 0}) @@ -293,7 +293,7 @@ Partial Class dlgStartofRains Me.lblFrom.Location = New System.Drawing.Point(31, 37) Me.lblFrom.Name = "lblFrom" Me.lblFrom.Size = New System.Drawing.Size(33, 13) - Me.lblFrom.TabIndex = 0 + Me.lblFrom.TabIndex = 2 Me.lblFrom.Text = "From:" ' 'nudTo @@ -303,7 +303,7 @@ Partial Class dlgStartofRains Me.nudTo.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudTo.Name = "nudTo" Me.nudTo.Size = New System.Drawing.Size(53, 20) - Me.nudTo.TabIndex = 3 + Me.nudTo.TabIndex = 5 Me.nudTo.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'lblTo @@ -312,7 +312,7 @@ Partial Class dlgStartofRains Me.lblTo.Location = New System.Drawing.Point(41, 63) Me.lblTo.Name = "lblTo" Me.lblTo.Size = New System.Drawing.Size(23, 13) - Me.lblTo.TabIndex = 2 + Me.lblTo.TabIndex = 4 Me.lblTo.Tag = "" Me.lblTo.Text = "To:" ' @@ -321,9 +321,9 @@ Partial Class dlgStartofRains Me.lblDOY.AutoSize = True Me.lblDOY.Location = New System.Drawing.Point(232, 91) Me.lblDOY.Name = "lblDOY" - Me.lblDOY.Size = New System.Drawing.Size(63, 13) - Me.lblDOY.TabIndex = 8 - Me.lblDOY.Text = "Day of Year" + Me.lblDOY.Size = New System.Drawing.Size(66, 13) + Me.lblDOY.TabIndex = 5 + Me.lblDOY.Text = "Day of Year:" ' 'lblDate ' @@ -331,7 +331,7 @@ Partial Class dlgStartofRains Me.lblDate.Location = New System.Drawing.Point(232, 12) Me.lblDate.Name = "lblDate" Me.lblDate.Size = New System.Drawing.Size(33, 13) - Me.lblDate.TabIndex = 10 + Me.lblDate.TabIndex = 1 Me.lblDate.Text = "Date:" ' 'ucrReceiverDate @@ -341,7 +341,7 @@ Partial Class dlgStartofRains Me.ucrReceiverDate.Name = "ucrReceiverDate" Me.ucrReceiverDate.Selector = Nothing Me.ucrReceiverDate.Size = New System.Drawing.Size(144, 20) - Me.ucrReceiverDate.TabIndex = 11 + Me.ucrReceiverDate.TabIndex = 2 ' 'ucrReceiverDOY ' @@ -350,7 +350,7 @@ Partial Class dlgStartofRains Me.ucrReceiverDOY.Name = "ucrReceiverDOY" Me.ucrReceiverDOY.Selector = Nothing Me.ucrReceiverDOY.Size = New System.Drawing.Size(144, 20) - Me.ucrReceiverDOY.TabIndex = 9 + Me.ucrReceiverDOY.TabIndex = 6 ' 'ucrReceiverRainfall ' @@ -359,7 +359,7 @@ Partial Class dlgStartofRains Me.ucrReceiverRainfall.Name = "ucrReceiverRainfall" Me.ucrReceiverRainfall.Selector = Nothing Me.ucrReceiverRainfall.Size = New System.Drawing.Size(144, 20) - Me.ucrReceiverRainfall.TabIndex = 2 + Me.ucrReceiverRainfall.TabIndex = 4 ' 'ucrSelectorForStartofRains ' @@ -376,7 +376,7 @@ Partial Class dlgStartofRains Me.ucrBase.Location = New System.Drawing.Point(12, 321) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) - Me.ucrBase.TabIndex = 0 + Me.ucrBase.TabIndex = 9 ' 'dlgStartofRains ' diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 883b644891d..3eed4d66bb3 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -33,6 +33,7 @@ Public Class dlgStartofRains firstDayofTheYear() DayFromAndToMethod() FirstDOYPerYear() + TestOKEnabled() End Sub Private Sub ucrSelectorForStartofRains_DataFrameChanged() Handles ucrSelectorForStartofRains.DataFrameChanged @@ -86,6 +87,9 @@ Public Class dlgStartofRains chkTotalRainfall.Checked = False CheckBoxesSetting() TestOKEnabled() + nudValue.Value = 20 + nudOverDays.Value = 2 + nudOutOfDays.Value = 2 End Sub Private Sub ReopenDialog() @@ -108,7 +112,6 @@ Public Class dlgStartofRains Private Sub grpRainParameters_Enter(sender As Object, e As EventArgs) Handles nudFrom.TextChanged, nudTo.TextChanged, nudThreshold.TextChanged DayFromAndToMethod() RainyDaysMethod() - TestOKEnabled() End Sub Private Sub grpConditionsForSatrtofRains_Enter(sender As Object, e As EventArgs) Handles nudValue.TextChanged, nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged, nudOverDays.TextChanged @@ -118,7 +121,6 @@ Public Class dlgStartofRains XDaysRainMethod() PeriodWithinThirtyDays() RollingOfRainDays() - TestOKEnabled() End Sub Private Sub grpConditionsForSatrtofRains1_Enter(sender As Object, e As EventArgs) Handles chkConsecutiveRainyDays.CheckedChanged, chkTotalRainfall.CheckedChanged, chkDrySpell.CheckedChanged @@ -128,11 +130,13 @@ Public Class dlgStartofRains Private Sub ucrReceiverRainfall_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverRainfall.SelectionChanged RainyDaysMethod() RollingSumMethod() + TestOKEnabled() End Sub Private Sub ucrReceiverDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDate.SelectionChanged YearGroupDaily() AddKeyMethod() + TestOKEnabled() End Sub Private Sub CheckBoxesSetting() From c26b9d04ff50ede4c353d83a1b8aa4106a275a5b Mon Sep 17 00:00:00 2001 From: Lily Date: Tue, 3 Jan 2017 09:04:32 +0000 Subject: [PATCH 09/72] StartOfRains Edits --- instat/dlgStartofRains.Designer.vb | 25 +++++++++++----------- instat/dlgStartofRains.vb | 34 ++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index 2136e565f51..74a62d91743 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -88,7 +88,7 @@ Partial Class dlgStartofRains 'lblRainfall ' Me.lblRainfall.AutoSize = True - Me.lblRainfall.Location = New System.Drawing.Point(232, 50) + Me.lblRainfall.Location = New System.Drawing.Point(232, 55) Me.lblRainfall.Name = "lblRainfall" Me.lblRainfall.Size = New System.Drawing.Size(70, 13) Me.lblRainfall.TabIndex = 3 @@ -250,7 +250,7 @@ Partial Class dlgStartofRains Me.grpRainParameters.Controls.Add(Me.lblTo) Me.grpRainParameters.Location = New System.Drawing.Point(234, 129) Me.grpRainParameters.Name = "grpRainParameters" - Me.grpRainParameters.Size = New System.Drawing.Size(150, 87) + Me.grpRainParameters.Size = New System.Drawing.Size(144, 87) Me.grpRainParameters.TabIndex = 7 Me.grpRainParameters.TabStop = False ' @@ -267,7 +267,7 @@ Partial Class dlgStartofRains 'lblThreshold ' Me.lblThreshold.AutoSize = True - Me.lblThreshold.Location = New System.Drawing.Point(7, 13) + Me.lblThreshold.Location = New System.Drawing.Point(6, 13) Me.lblThreshold.Name = "lblThreshold" Me.lblThreshold.Size = New System.Drawing.Size(57, 13) Me.lblThreshold.TabIndex = 0 @@ -281,7 +281,7 @@ Partial Class dlgStartofRains Me.nudFrom.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudFrom.Name = "nudFrom" Me.nudFrom.RightToLeft = System.Windows.Forms.RightToLeft.Yes - Me.nudFrom.Size = New System.Drawing.Size(55, 20) + Me.nudFrom.Size = New System.Drawing.Size(53, 20) Me.nudFrom.TabIndex = 3 Me.nudFrom.TextAlign = System.Windows.Forms.HorizontalAlignment.Right Me.nudFrom.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left @@ -290,7 +290,7 @@ Partial Class dlgStartofRains 'lblFrom ' Me.lblFrom.AutoSize = True - Me.lblFrom.Location = New System.Drawing.Point(31, 37) + Me.lblFrom.Location = New System.Drawing.Point(7, 37) Me.lblFrom.Name = "lblFrom" Me.lblFrom.Size = New System.Drawing.Size(33, 13) Me.lblFrom.TabIndex = 2 @@ -309,7 +309,7 @@ Partial Class dlgStartofRains 'lblTo ' Me.lblTo.AutoSize = True - Me.lblTo.Location = New System.Drawing.Point(41, 63) + Me.lblTo.Location = New System.Drawing.Point(8, 63) Me.lblTo.Name = "lblTo" Me.lblTo.Size = New System.Drawing.Size(23, 13) Me.lblTo.TabIndex = 4 @@ -319,7 +319,7 @@ Partial Class dlgStartofRains 'lblDOY ' Me.lblDOY.AutoSize = True - Me.lblDOY.Location = New System.Drawing.Point(232, 91) + Me.lblDOY.Location = New System.Drawing.Point(232, 94) Me.lblDOY.Name = "lblDOY" Me.lblDOY.Size = New System.Drawing.Size(66, 13) Me.lblDOY.TabIndex = 5 @@ -328,7 +328,7 @@ Partial Class dlgStartofRains 'lblDate ' Me.lblDate.AutoSize = True - Me.lblDate.Location = New System.Drawing.Point(232, 12) + Me.lblDate.Location = New System.Drawing.Point(232, 14) Me.lblDate.Name = "lblDate" Me.lblDate.Size = New System.Drawing.Size(33, 13) Me.lblDate.TabIndex = 1 @@ -336,7 +336,7 @@ Partial Class dlgStartofRains ' 'ucrReceiverDate ' - Me.ucrReceiverDate.Location = New System.Drawing.Point(234, 25) + Me.ucrReceiverDate.Location = New System.Drawing.Point(234, 29) Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverDate.Name = "ucrReceiverDate" Me.ucrReceiverDate.Selector = Nothing @@ -345,7 +345,7 @@ Partial Class dlgStartofRains ' 'ucrReceiverDOY ' - Me.ucrReceiverDOY.Location = New System.Drawing.Point(234, 104) + Me.ucrReceiverDOY.Location = New System.Drawing.Point(234, 109) Me.ucrReceiverDOY.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverDOY.Name = "ucrReceiverDOY" Me.ucrReceiverDOY.Selector = Nothing @@ -354,11 +354,11 @@ Partial Class dlgStartofRains ' 'ucrReceiverRainfall ' - Me.ucrReceiverRainfall.Location = New System.Drawing.Point(235, 67) + Me.ucrReceiverRainfall.Location = New System.Drawing.Point(235, 70) Me.ucrReceiverRainfall.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverRainfall.Name = "ucrReceiverRainfall" Me.ucrReceiverRainfall.Selector = Nothing - Me.ucrReceiverRainfall.Size = New System.Drawing.Size(144, 20) + Me.ucrReceiverRainfall.Size = New System.Drawing.Size(143, 20) Me.ucrReceiverRainfall.TabIndex = 4 ' 'ucrSelectorForStartofRains @@ -393,6 +393,7 @@ Partial Class dlgStartofRains Me.Controls.Add(Me.ucrReceiverRainfall) Me.Controls.Add(Me.ucrSelectorForStartofRains) Me.Controls.Add(Me.ucrBase) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "dlgStartofRains" diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 3eed4d66bb3..62a54659f96 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -88,8 +88,14 @@ Public Class dlgStartofRains CheckBoxesSetting() TestOKEnabled() nudValue.Value = 20 + nudMinimum.Value = 1 + nudMaximumDays.Value = 10 + nudLengthofTime.Value = 30 nudOverDays.Value = 2 nudOutOfDays.Value = 2 + nudThreshold.Value = 0.85 + nudFrom.Value = 1 + nudTo.Value = 30 End Sub Private Sub ReopenDialog() @@ -97,14 +103,13 @@ Public Class dlgStartofRains End Sub Private Sub TestOKEnabled() - If Not (ucrReceiverRainfall.IsEmpty AndAlso ucrReceiverDate.IsEmpty AndAlso ucrReceiverDOY.IsEmpty) Then + If Not ucrReceiverRainfall.IsEmpty AndAlso Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverDOY.IsEmpty AndAlso nudThreshold.Text <> "" AndAlso nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso ((chkConsecutiveRainyDays.Checked AndAlso nudMinimum.Text <> "" AndAlso nudOutOfDays.Text <> "") OrElse Not chkConsecutiveRainyDays.Checked) AndAlso ((chkTotalRainfall.Checked AndAlso nudValue.Text <> "" AndAlso nudOverDays.Text <> "") OrElse Not chkTotalRainfall.Checked) AndAlso ((chkDrySpell.Checked AndAlso nudMaximumDays.Text <> "" AndAlso nudLengthofTime.Text <> "") OrElse Not chkDrySpell.Checked) Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) End If End Sub - Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() End Sub @@ -112,20 +117,24 @@ Public Class dlgStartofRains Private Sub grpRainParameters_Enter(sender As Object, e As EventArgs) Handles nudFrom.TextChanged, nudTo.TextChanged, nudThreshold.TextChanged DayFromAndToMethod() RainyDaysMethod() + TestOKEnabled() End Sub - Private Sub grpConditionsForSatrtofRains_Enter(sender As Object, e As EventArgs) Handles nudValue.TextChanged, nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged, nudOverDays.TextChanged + Private Sub grpConditionsForSatrtofRains_Enter(sender As Object, e As EventArgs) Handles nudValue.TextChanged, nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged, nudOverDays.TextChanged, nudOutOfDays.TextChanged RainyDaysMethod() DayFromAndToMethod() MinimumRainfallMethod() XDaysRainMethod() PeriodWithinThirtyDays() RollingOfRainDays() + TestOKEnabled() End Sub Private Sub grpConditionsForSatrtofRains1_Enter(sender As Object, e As EventArgs) Handles chkConsecutiveRainyDays.CheckedChanged, chkTotalRainfall.CheckedChanged, chkDrySpell.CheckedChanged CheckBoxesSetting() MinimumRainfallMethod() + FirstDOYPerYear() + TestOKEnabled() End Sub Private Sub ucrReceiverRainfall_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverRainfall.SelectionChanged RainyDaysMethod() @@ -188,7 +197,7 @@ Public Class dlgStartofRains Private Sub DayFromAndToMethod() If nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso (Not ucrReceiverDOY.IsEmpty) Then clsDayFromAndTo.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & ">" & nudFrom.Value & " & " & ucrReceiverDOY.GetVariableNames(False) & "<" & nudTo.Value & Chr(34)) - clsDayFromAndTo.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverDOY.GetVariableNames() & ")") + clsDayFromAndTo.AddParameter(" calculated_from", " list(" & strCurrDataName & "=" & Chr(34) & ucrReceiverDOY.GetVariableNames() & Chr(34) & ")") clsDayFromAndTo.AddParameter("type", Chr(34) & "filter" & Chr(34)) Else clsDayFromAndTo.RemoveParameterByName("function_exp") @@ -217,7 +226,7 @@ Public Class dlgStartofRains clsRollingSum.AddParameter("function_exp", Chr(34) & " rollapply(data = " & ucrReceiverRainfall.GetVariableNames(False) & " ,width = " & nudOutOfDays.Value & ", FUN = sum, align='right', fill=NA)" & Chr(34)) clsRollingSum.AddParameter("type", Chr(34) & "calculation" & Chr(34)) clsRollingSum.AddParameter("result_name", Chr(34) & "roll_sum_Rain" & Chr(34)) - clsRollingSum.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverRainfall.GetVariableNames & ")") + clsRollingSum.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & Chr(34) & ucrReceiverRainfall.GetVariableNames & Chr(34) & ")") clsRollingSum.AddParameter("save", 1) Else clsRollingSum.RemoveParameterByName("function_exp") @@ -233,7 +242,7 @@ Public Class dlgStartofRains clsMinimumRainfall.AddParameter("function_exp", Chr(34) & "roll_sum_Rain >" & nudValue.Value & Chr(34)) clsMinimumRainfall.AddParameter("type", Chr(34) & "filter" & Chr(34)) clsSubCalcMinSum.AddParameter("sub1", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) - clsMinimumRainfall.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubCalcMinSum) + clsMinimumRainfall.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubCalcMinSum) ' list ( " and ")" Else clsMinimumRainfall.RemoveParameterByName("function_exp") clsMinimumRainfall.RemoveParameterByName("type") @@ -292,17 +301,24 @@ Public Class dlgStartofRains End Sub Private Sub FirstDOYPerYear() + ' run these when things are checked If Not ucrReceiverDOY.IsEmpty Then - clsManipulationFirstDOYPerYear.AddParameter("sub1", clsRFunctionParameter:=clsXdaysRain, bIncludeArgumentName:=False) - clsManipulationFirstDOYPerYear.AddParameter("sub2", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) clsManipulationFirstDOYPerYear.AddParameter("sub3", clsRFunctionParameter:=clsYearGroupDaily, bIncludeArgumentName:=False) - clsManipulationFirstDOYPerYear.AddParameter("sub4", clsRFunctionParameter:=clsMinimumRainfall, bIncludeArgumentName:=False) clsManipulationFirstDOYPerYear.AddParameter("sub5", clsRFunctionParameter:=clsDayFromAndTo, bIncludeArgumentName:=False) clsFirstDOYPerYear.AddParameter("type", Chr(34) & "summary" & Chr(34)) clsFirstDOYPerYear.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & "[" & 1 & "]" & Chr(34)) clsFirstDOYPerYear.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverDOY.GetVariableNames() & ")") clsFirstDOYPerYear.AddParameter("manipulations", clsRFunctionParameter:=clsManipulationFirstDOYPerYear) clsFirstDOYPerYear.AddParameter("result_name", Chr(34) & "Start_of_Rains" & Chr(34)) + If chkConsecutiveRainyDays.Checked Then + clsManipulationFirstDOYPerYear.AddParameter("sub4", clsRFunctionParameter:=clsMinimumRainfall, bIncludeArgumentName:=False) + End If + If chkTotalRainfall.Checked Then + clsManipulationFirstDOYPerYear.AddParameter("sub1", clsRFunctionParameter:=clsXdaysRain, bIncludeArgumentName:=False) + End If + If chkDrySpell.Checked Then + clsManipulationFirstDOYPerYear.AddParameter("sub2", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + End If Else clsManipulationFirstDOYPerYear.RemoveParameterByName("sub1") clsManipulationFirstDOYPerYear.RemoveParameterByName("sub2") From a07d0c07acea0ef988ec2629094709fccaee7427 Mon Sep 17 00:00:00 2001 From: Lily Date: Tue, 3 Jan 2017 14:14:02 +0000 Subject: [PATCH 10/72] removed chr(34) --- instat/dlgStartofRains.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 62a54659f96..370c8b43fa6 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -197,7 +197,7 @@ Public Class dlgStartofRains Private Sub DayFromAndToMethod() If nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso (Not ucrReceiverDOY.IsEmpty) Then clsDayFromAndTo.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & ">" & nudFrom.Value & " & " & ucrReceiverDOY.GetVariableNames(False) & "<" & nudTo.Value & Chr(34)) - clsDayFromAndTo.AddParameter(" calculated_from", " list(" & strCurrDataName & "=" & Chr(34) & ucrReceiverDOY.GetVariableNames() & Chr(34) & ")") + clsDayFromAndTo.AddParameter("calculated_from", " list(" & strCurrDataName & "=" & ucrReceiverDOY.GetVariableNames() & ")") clsDayFromAndTo.AddParameter("type", Chr(34) & "filter" & Chr(34)) Else clsDayFromAndTo.RemoveParameterByName("function_exp") From 452e9c0d7d81f926f847a87867d12d8cbea34b33 Mon Sep 17 00:00:00 2001 From: Lily Date: Tue, 3 Jan 2017 16:52:53 +0000 Subject: [PATCH 11/72] Start of Rains Changes --- instat/dlgStartofRains.Designer.vb | 70 ++++++++++++++++++++---------- instat/dlgStartofRains.vb | 66 ++++++++++++++++------------ 2 files changed, 86 insertions(+), 50 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index 74a62d91743..8dbbbb9b10c 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -53,6 +53,8 @@ Partial Class dlgStartofRains Me.ucrReceiverRainfall = New instat.ucrReceiverSingle() Me.ucrSelectorForStartofRains = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() + Me.ucrReceiverYear = New instat.ucrReceiverSingle() + Me.lblYear = New System.Windows.Forms.Label() CType(Me.nudValue, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudMinimum, System.ComponentModel.ISupportInitialize).BeginInit() Me.grpConditionsForSatrtofRains.SuspendLayout() @@ -68,7 +70,7 @@ Partial Class dlgStartofRains ' 'nudValue ' - Me.nudValue.Location = New System.Drawing.Point(201, 42) + Me.nudValue.Location = New System.Drawing.Point(201, 43) Me.nudValue.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) Me.nudValue.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudValue.Name = "nudValue" @@ -78,7 +80,7 @@ Partial Class dlgStartofRains ' 'nudMinimum ' - Me.nudMinimum.Location = New System.Drawing.Point(201, 18) + Me.nudMinimum.Location = New System.Drawing.Point(201, 19) Me.nudMinimum.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudMinimum.Name = "nudMinimum" Me.nudMinimum.Size = New System.Drawing.Size(41, 20) @@ -88,7 +90,7 @@ Partial Class dlgStartofRains 'lblRainfall ' Me.lblRainfall.AutoSize = True - Me.lblRainfall.Location = New System.Drawing.Point(232, 55) + Me.lblRainfall.Location = New System.Drawing.Point(250, 83) Me.lblRainfall.Name = "lblRainfall" Me.lblRainfall.Size = New System.Drawing.Size(70, 13) Me.lblRainfall.TabIndex = 3 @@ -111,7 +113,7 @@ Partial Class dlgStartofRains Me.grpConditionsForSatrtofRains.Controls.Add(Me.chkConsecutiveRainyDays) Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudMinimum) Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudValue) - Me.grpConditionsForSatrtofRains.Location = New System.Drawing.Point(12, 220) + Me.grpConditionsForSatrtofRains.Location = New System.Drawing.Point(9, 285) Me.grpConditionsForSatrtofRains.Name = "grpConditionsForSatrtofRains" Me.grpConditionsForSatrtofRains.Size = New System.Drawing.Size(395, 95) Me.grpConditionsForSatrtofRains.TabIndex = 8 @@ -130,7 +132,7 @@ Partial Class dlgStartofRains 'lblWidth ' Me.lblWidth.AutoSize = True - Me.lblWidth.Location = New System.Drawing.Point(256, 20) + Me.lblWidth.Location = New System.Drawing.Point(264, 23) Me.lblWidth.Name = "lblWidth" Me.lblWidth.Size = New System.Drawing.Size(66, 13) Me.lblWidth.TabIndex = 3 @@ -138,7 +140,7 @@ Partial Class dlgStartofRains ' 'nudLengthofTime ' - Me.nudLengthofTime.Location = New System.Drawing.Point(332, 72) + Me.nudLengthofTime.Location = New System.Drawing.Point(332, 68) Me.nudLengthofTime.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudLengthofTime.Name = "nudLengthofTime" Me.nudLengthofTime.Size = New System.Drawing.Size(53, 20) @@ -156,7 +158,7 @@ Partial Class dlgStartofRains ' 'nudOverDays ' - Me.nudOverDays.Location = New System.Drawing.Point(332, 46) + Me.nudOverDays.Location = New System.Drawing.Point(332, 43) Me.nudOverDays.Maximum = New Decimal(New Integer() {366, 0, 0, 0}) Me.nudOverDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudOverDays.Name = "nudOverDays" @@ -167,7 +169,7 @@ Partial Class dlgStartofRains 'lblLengthofTime ' Me.lblLengthofTime.AutoSize = True - Me.lblLengthofTime.Location = New System.Drawing.Point(246, 74) + Me.lblLengthofTime.Location = New System.Drawing.Point(249, 71) Me.lblLengthofTime.Name = "lblLengthofTime" Me.lblLengthofTime.Size = New System.Drawing.Size(81, 13) Me.lblLengthofTime.TabIndex = 13 @@ -176,7 +178,7 @@ Partial Class dlgStartofRains 'lblMaximumDays ' Me.lblMaximumDays.AutoSize = True - Me.lblMaximumDays.Location = New System.Drawing.Point(114, 72) + Me.lblMaximumDays.Location = New System.Drawing.Point(118, 71) Me.lblMaximumDays.Name = "lblMaximumDays" Me.lblMaximumDays.Size = New System.Drawing.Size(81, 13) Me.lblMaximumDays.TabIndex = 11 @@ -185,7 +187,7 @@ Partial Class dlgStartofRains 'lblVal ' Me.lblVal.AutoSize = True - Me.lblVal.Location = New System.Drawing.Point(163, 44) + Me.lblVal.Location = New System.Drawing.Point(162, 47) Me.lblVal.Name = "lblVal" Me.lblVal.Size = New System.Drawing.Size(37, 13) Me.lblVal.TabIndex = 6 @@ -194,7 +196,7 @@ Partial Class dlgStartofRains 'lblOverDays ' Me.lblOverDays.AutoSize = True - Me.lblOverDays.Location = New System.Drawing.Point(268, 49) + Me.lblOverDays.Location = New System.Drawing.Point(270, 46) Me.lblOverDays.Name = "lblOverDays" Me.lblOverDays.Size = New System.Drawing.Size(60, 13) Me.lblOverDays.TabIndex = 8 @@ -204,7 +206,7 @@ Partial Class dlgStartofRains 'lblMinimum ' Me.lblMinimum.AutoSize = True - Me.lblMinimum.Location = New System.Drawing.Point(149, 21) + Me.lblMinimum.Location = New System.Drawing.Point(149, 22) Me.lblMinimum.Name = "lblMinimum" Me.lblMinimum.Size = New System.Drawing.Size(51, 13) Me.lblMinimum.TabIndex = 1 @@ -223,7 +225,7 @@ Partial Class dlgStartofRains 'chkTotalRainfall ' Me.chkTotalRainfall.AutoSize = True - Me.chkTotalRainfall.Location = New System.Drawing.Point(7, 46) + Me.chkTotalRainfall.Location = New System.Drawing.Point(7, 44) Me.chkTotalRainfall.Name = "chkTotalRainfall" Me.chkTotalRainfall.Size = New System.Drawing.Size(88, 17) Me.chkTotalRainfall.TabIndex = 5 @@ -248,7 +250,7 @@ Partial Class dlgStartofRains Me.grpRainParameters.Controls.Add(Me.lblFrom) Me.grpRainParameters.Controls.Add(Me.nudTo) Me.grpRainParameters.Controls.Add(Me.lblTo) - Me.grpRainParameters.Location = New System.Drawing.Point(234, 129) + Me.grpRainParameters.Location = New System.Drawing.Point(9, 192) Me.grpRainParameters.Name = "grpRainParameters" Me.grpRainParameters.Size = New System.Drawing.Size(144, 87) Me.grpRainParameters.TabIndex = 7 @@ -319,7 +321,7 @@ Partial Class dlgStartofRains 'lblDOY ' Me.lblDOY.AutoSize = True - Me.lblDOY.Location = New System.Drawing.Point(232, 94) + Me.lblDOY.Location = New System.Drawing.Point(251, 167) Me.lblDOY.Name = "lblDOY" Me.lblDOY.Size = New System.Drawing.Size(66, 13) Me.lblDOY.TabIndex = 5 @@ -328,7 +330,7 @@ Partial Class dlgStartofRains 'lblDate ' Me.lblDate.AutoSize = True - Me.lblDate.Location = New System.Drawing.Point(232, 14) + Me.lblDate.Location = New System.Drawing.Point(251, 41) Me.lblDate.Name = "lblDate" Me.lblDate.Size = New System.Drawing.Size(33, 13) Me.lblDate.TabIndex = 1 @@ -336,25 +338,25 @@ Partial Class dlgStartofRains ' 'ucrReceiverDate ' - Me.ucrReceiverDate.Location = New System.Drawing.Point(234, 29) + Me.ucrReceiverDate.Location = New System.Drawing.Point(250, 56) Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverDate.Name = "ucrReceiverDate" Me.ucrReceiverDate.Selector = Nothing - Me.ucrReceiverDate.Size = New System.Drawing.Size(144, 20) + Me.ucrReceiverDate.Size = New System.Drawing.Size(143, 20) Me.ucrReceiverDate.TabIndex = 2 ' 'ucrReceiverDOY ' - Me.ucrReceiverDOY.Location = New System.Drawing.Point(234, 109) + Me.ucrReceiverDOY.Location = New System.Drawing.Point(250, 182) Me.ucrReceiverDOY.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverDOY.Name = "ucrReceiverDOY" Me.ucrReceiverDOY.Selector = Nothing - Me.ucrReceiverDOY.Size = New System.Drawing.Size(144, 20) + Me.ucrReceiverDOY.Size = New System.Drawing.Size(143, 20) Me.ucrReceiverDOY.TabIndex = 6 ' 'ucrReceiverRainfall ' - Me.ucrReceiverRainfall.Location = New System.Drawing.Point(235, 70) + Me.ucrReceiverRainfall.Location = New System.Drawing.Point(250, 98) Me.ucrReceiverRainfall.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverRainfall.Name = "ucrReceiverRainfall" Me.ucrReceiverRainfall.Selector = Nothing @@ -373,16 +375,36 @@ Partial Class dlgStartofRains ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(12, 321) + Me.ucrBase.Location = New System.Drawing.Point(9, 386) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 9 ' + 'ucrReceiverYear + ' + Me.ucrReceiverYear.Location = New System.Drawing.Point(250, 140) + Me.ucrReceiverYear.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverYear.Name = "ucrReceiverYear" + Me.ucrReceiverYear.Selector = Nothing + Me.ucrReceiverYear.Size = New System.Drawing.Size(143, 20) + Me.ucrReceiverYear.TabIndex = 11 + ' + 'lblYear + ' + Me.lblYear.AutoSize = True + Me.lblYear.Location = New System.Drawing.Point(251, 125) + Me.lblYear.Name = "lblYear" + Me.lblYear.Size = New System.Drawing.Size(32, 13) + Me.lblYear.TabIndex = 10 + Me.lblYear.Text = "Year:" + ' 'dlgStartofRains ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(413, 378) + Me.ClientSize = New System.Drawing.Size(414, 445) + Me.Controls.Add(Me.ucrReceiverYear) + Me.Controls.Add(Me.lblYear) Me.Controls.Add(Me.lblDate) Me.Controls.Add(Me.ucrReceiverDate) Me.Controls.Add(Me.ucrReceiverDOY) @@ -449,4 +471,6 @@ Partial Class dlgStartofRains Friend WithEvents lblThreshold As Label Friend WithEvents lblDate As Label Friend WithEvents ucrReceiverDate As ucrReceiverSingle + Friend WithEvents ucrReceiverYear As ucrReceiverSingle + Friend WithEvents lblYear As Label End Class diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 370c8b43fa6..54a95e739ee 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -14,7 +14,8 @@ ' along with this program. If not, see . Imports instat.Translations Public Class dlgStartofRains - Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsDryPeriodTen, clsWithinThirtyDays, clsDrySpell, clsYearGroupDaily, clsSubCalcMinSum, clsSubCalcXDaysRain, clsSubCalcNoTenInThirty, clsManipulationFirstDOYPerYear, clsApplyRainDays As New RFunction + Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsDryPeriodTen, clsWithinThirtyDays, clsDrySpell, clsYearGroupDaily, clsSubCalcMinSum, clsSubCalcXDaysRain, clsSubCalcNoTenInThirty, clsManipulationFirstDOYPerYear, clsApplyRainDays, clsRainDayOnly As New RFunction + Public clsMinimumRainfallList, clsDryPeriodTenList As New RFunction Private strCurrDataName As String = "" Public bFirstLoad As Boolean = True Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -47,8 +48,9 @@ Public Class dlgStartofRains clsDayFromAndTo.SetRCommand("instat_calculation$new") clsDayFromAndTo.SetAssignTo("Day_From_and_To") clsYearGroupDaily.SetRCommand("instat_calculation$new") + clsYearGroupDaily.SetAssignTo("Year_Group_Daily") clsRainyDays.SetRCommand("instat_calculation$new") - 'clsRainyDays.SetAssignTo("Rainy_Days") + clsRainyDays.SetAssignTo("Rainy_Days") clsRollingSum.SetRCommand("instat_calculation$new") clsRollingSum.SetAssignTo("rolling_sum") clsMinimumRainfall.SetRCommand("instat_calculation$new") @@ -66,18 +68,15 @@ Public Class dlgStartofRains clsWithinThirtyDays.SetRCommand("instat_calculation$new") clsWithinThirtyDays.SetAssignTo("dry_spell_no_10_in_30") ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") - clsApplyRainDays.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") - clsApplyRainDays.AddParameter("calc", clsRFunctionParameter:=clsRainyDays) clsSubCalcMinSum.SetRCommand("list") clsSubCalcXDaysRain.SetRCommand("list") clsSubCalcNoTenInThirty.SetRCommand("list") clsManipulationFirstDOYPerYear.SetRCommand("list") ucrReceiverRainfall.Selector = ucrSelectorForStartofRains - ucrReceiverRainfall.Selector = ucrSelectorForStartofRains + ucrReceiverYear.Selector = ucrSelectorForStartofRains ucrReceiverDate.Selector = ucrSelectorForStartofRains ucrReceiverDOY.Selector = ucrSelectorForStartofRains ucrReceiverDate.SetMeAsReceiver() - End Sub Private Sub SetDefaults() @@ -95,7 +94,7 @@ Public Class dlgStartofRains nudOutOfDays.Value = 2 nudThreshold.Value = 0.85 nudFrom.Value = 1 - nudTo.Value = 30 + nudTo.Value = 366 End Sub Private Sub ReopenDialog() @@ -103,7 +102,7 @@ Public Class dlgStartofRains End Sub Private Sub TestOKEnabled() - If Not ucrReceiverRainfall.IsEmpty AndAlso Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverDOY.IsEmpty AndAlso nudThreshold.Text <> "" AndAlso nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso ((chkConsecutiveRainyDays.Checked AndAlso nudMinimum.Text <> "" AndAlso nudOutOfDays.Text <> "") OrElse Not chkConsecutiveRainyDays.Checked) AndAlso ((chkTotalRainfall.Checked AndAlso nudValue.Text <> "" AndAlso nudOverDays.Text <> "") OrElse Not chkTotalRainfall.Checked) AndAlso ((chkDrySpell.Checked AndAlso nudMaximumDays.Text <> "" AndAlso nudLengthofTime.Text <> "") OrElse Not chkDrySpell.Checked) Then + If Not ucrReceiverRainfall.IsEmpty AndAlso Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverDOY.IsEmpty AndAlso Not ucrReceiverYear.IsEmpty AndAlso nudThreshold.Text <> "" AndAlso nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso ((chkConsecutiveRainyDays.Checked AndAlso nudMinimum.Text <> "" AndAlso nudOutOfDays.Text <> "") OrElse Not chkConsecutiveRainyDays.Checked) AndAlso ((chkTotalRainfall.Checked AndAlso nudValue.Text <> "" AndAlso nudOverDays.Text <> "") OrElse Not chkTotalRainfall.Checked) AndAlso ((chkDrySpell.Checked AndAlso nudMaximumDays.Text <> "" AndAlso nudLengthofTime.Text <> "") OrElse Not chkDrySpell.Checked) Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -127,6 +126,7 @@ Public Class dlgStartofRains XDaysRainMethod() PeriodWithinThirtyDays() RollingOfRainDays() + RollingSumMethod() TestOKEnabled() End Sub @@ -142,8 +142,12 @@ Public Class dlgStartofRains TestOKEnabled() End Sub - Private Sub ucrReceiverDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDate.SelectionChanged + Private Sub ucrReceiverYear_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverYear.SelectionChanged YearGroupDaily() + TestOKEnabled() + End Sub + + Private Sub ucrReceiverDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDate.SelectionChanged AddKeyMethod() TestOKEnabled() End Sub @@ -196,7 +200,7 @@ Public Class dlgStartofRains Private Sub DayFromAndToMethod() If nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso (Not ucrReceiverDOY.IsEmpty) Then - clsDayFromAndTo.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & ">" & nudFrom.Value & " & " & ucrReceiverDOY.GetVariableNames(False) & "<" & nudTo.Value & Chr(34)) + clsDayFromAndTo.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & ">=" & nudFrom.Value & " & " & ucrReceiverDOY.GetVariableNames(False) & "<=" & nudTo.Value & Chr(34)) clsDayFromAndTo.AddParameter("calculated_from", " list(" & strCurrDataName & "=" & ucrReceiverDOY.GetVariableNames() & ")") clsDayFromAndTo.AddParameter("type", Chr(34) & "filter" & Chr(34)) Else @@ -211,7 +215,7 @@ Public Class dlgStartofRains clsRainyDays.AddParameter("function_exp", Chr(34) & "match(" & ucrReceiverRainfall.GetVariableNames(False) & ">=" & nudThreshold.Value & "," & "1, nomatch = 0" & ")" & Chr(34)) clsRainyDays.AddParameter("result_name", Chr(34) & "rain_day" & Chr(34)) clsRainyDays.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & Chr(34) & "Rain" & Chr(34) & ")") - clsRainyDays.AddParameter("save", 2) + clsRainyDays.AddParameter("save", 0) Else clsRainyDays.RemoveParameterByName("type") clsRainyDays.RemoveParameterByName("function_exp") @@ -223,10 +227,10 @@ Public Class dlgStartofRains Private Sub RollingSumMethod() If Not ucrReceiverRainfall.IsEmpty Then - clsRollingSum.AddParameter("function_exp", Chr(34) & " rollapply(data = " & ucrReceiverRainfall.GetVariableNames(False) & " ,width = " & nudOutOfDays.Value & ", FUN = sum, align='right', fill=NA)" & Chr(34)) + clsRollingSum.AddParameter("function_exp", Chr(34) & " rollapply(data = " & ucrReceiverRainfall.GetVariableNames(False) & " ,width = " & nudOverDays.Value & ", FUN = sum, align='right', fill=NA)" & Chr(34)) clsRollingSum.AddParameter("type", Chr(34) & "calculation" & Chr(34)) clsRollingSum.AddParameter("result_name", Chr(34) & "roll_sum_Rain" & Chr(34)) - clsRollingSum.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & Chr(34) & ucrReceiverRainfall.GetVariableNames & Chr(34) & ")") + clsRollingSum.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverRainfall.GetVariableNames & ")") clsRollingSum.AddParameter("save", 1) Else clsRollingSum.RemoveParameterByName("function_exp") @@ -242,30 +246,30 @@ Public Class dlgStartofRains clsMinimumRainfall.AddParameter("function_exp", Chr(34) & "roll_sum_Rain >" & nudValue.Value & Chr(34)) clsMinimumRainfall.AddParameter("type", Chr(34) & "filter" & Chr(34)) clsSubCalcMinSum.AddParameter("sub1", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) - clsMinimumRainfall.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubCalcMinSum) ' list ( " and ")" + clsMinimumRainfall.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubCalcMinSum) Else clsMinimumRainfall.RemoveParameterByName("function_exp") clsMinimumRainfall.RemoveParameterByName("type") clsMinimumRainfall.RemoveParameterByName("sub_calculations") - clsSubCalcMinSum.RemoveParameterByName("sub1") + 'clsMinimumRainfallList.RemoveParameterByName("sub1") End If RollingOfRainDays() End Sub Private Sub RollingOfRainDays() - clsRollingRainDays.AddParameter("type", Chr(34) & "calculation" & Chr(34)) - clsRollingRainDays.AddParameter("function_exp", Chr(34) & "rollapply(data=rain_day, width= " & nudOutOfDays.Value & ", FUN=sum, align = 'right', fill=NA)" & Chr(34)) + clsRollingRainDays.AddParameter("function_exp", Chr(34) & "rollapply(data=rain_day, Width = " & nudOutOfDays.Value & ", FUN = sum, align = 'right', fill=NA)" & Chr(34)) clsRollingRainDays.AddParameter("result_name", Chr(34) & "Rolling_Rain_Days" & Chr(34)) clsRollingRainDays.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & Chr(34) & "rain_day" & Chr(34) & ")") clsRollingRainDays.AddParameter("save", 1) End Sub + Private Sub XDaysRainMethod() If nudMinimum.Text <> "" Then clsXdaysRain.AddParameter("type", Chr(34) & "filter" & Chr(34)) clsXdaysRain.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >=" & nudMinimum.Value & Chr(34)) - clsSubCalcXDaysRain.AddParameter("sub1", clsRFunctionParameter:=clsRollingRainDays, bIncludeArgumentName:=False) clsXdaysRain.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubCalcXDaysRain) + clsSubCalcXDaysRain.AddParameter("sub1", clsRFunctionParameter:=clsRollingRainDays, bIncludeArgumentName:=False) Else clsXdaysRain.RemoveParameterByName("type") clsXdaysRain.RemoveParameterByName("function_exp") @@ -289,7 +293,8 @@ Public Class dlgStartofRains clsDryPeriodTen.AddParameter("type", Chr(34) & "calculation" & Chr(34)) clsDryPeriodTen.AddParameter("function_exp", Chr(34) & "rollapply(data = Dry_Spell, width=" & nudLengthofTime.Value & ", FUN=max, align='right', fill=NA)" & Chr(34)) clsDryPeriodTen.AddParameter("result_name", Chr(34) & "Dry_Period" & Chr(34)) - clsDryPeriodTen.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubCalcNoTenInThirty) + clsDryPeriodTen.AddParameter("sub_calculations", clsRFunctionParameter:=clsDryPeriodTenList) + clsDryPeriodTenList.AddParameter("sub1", clsRFunctionParameter:=clsSubCalcNoTenInThirty, bIncludeArgumentName:=False) clsDryPeriodTen.AddParameter("save", 2) PeriodWithinThirtyDays() End Sub @@ -310,14 +315,24 @@ Public Class dlgStartofRains clsFirstDOYPerYear.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverDOY.GetVariableNames() & ")") clsFirstDOYPerYear.AddParameter("manipulations", clsRFunctionParameter:=clsManipulationFirstDOYPerYear) clsFirstDOYPerYear.AddParameter("result_name", Chr(34) & "Start_of_Rains" & Chr(34)) + clsFirstDOYPerYear.AddParameter("save", 2) + If chkConsecutiveRainyDays.Checked Then - clsManipulationFirstDOYPerYear.AddParameter("sub4", clsRFunctionParameter:=clsMinimumRainfall, bIncludeArgumentName:=False) + clsManipulationFirstDOYPerYear.AddParameter("sub1", clsRFunctionParameter:=clsXdaysRain, bIncludeArgumentName:=False) + Else + clsManipulationFirstDOYPerYear.RemoveParameterByName("sub1") End If + If chkTotalRainfall.Checked Then - clsManipulationFirstDOYPerYear.AddParameter("sub1", clsRFunctionParameter:=clsXdaysRain, bIncludeArgumentName:=False) + clsManipulationFirstDOYPerYear.AddParameter("sub4", clsRFunctionParameter:=clsMinimumRainfall, bIncludeArgumentName:=False) + Else + clsManipulationFirstDOYPerYear.RemoveParameterByName("sub4") End If + If chkDrySpell.Checked Then clsManipulationFirstDOYPerYear.AddParameter("sub2", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + Else + clsManipulationFirstDOYPerYear.RemoveParameterByName("sub2") End If Else clsManipulationFirstDOYPerYear.RemoveParameterByName("sub1") @@ -331,16 +346,13 @@ Public Class dlgStartofRains clsFirstDOYPerYear.RemoveParameterByName("manipulations") End If End Sub + Private Sub YearGroupDaily() clsYearGroupDaily.AddParameter("type", Chr(34) & "by" & Chr(34)) - clsYearGroupDaily.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverDate.GetVariableNames & ")") + clsYearGroupDaily.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverYear.GetVariableNames & ")") End Sub + Private Sub firstDayofTheYear() ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsFirstDOYPerYear) End Sub - - Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk - frmMain.clsRLink.RunScript(clsAddKey.ToScript, strComment:="Start of Rains: Defining Date column as key") - frmMain.clsRLink.RunScript(clsApplyRainDays.ToScript, strComment:="Start of Rains: Creating rain_day column") - End Sub End Class \ No newline at end of file From a237fbde56af6baa6694db62528c456873b77122 Mon Sep 17 00:00:00 2001 From: Lily Date: Thu, 5 Jan 2017 10:54:25 +0000 Subject: [PATCH 12/72] Start of Rains --- instat/dlgStartofRains.Designer.vb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index 8dbbbb9b10c..72816e310ca 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -74,7 +74,7 @@ Partial Class dlgStartofRains Me.nudValue.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) Me.nudValue.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudValue.Name = "nudValue" - Me.nudValue.Size = New System.Drawing.Size(41, 20) + Me.nudValue.Size = New System.Drawing.Size(47, 20) Me.nudValue.TabIndex = 7 Me.nudValue.Value = New Decimal(New Integer() {30, 0, 0, 0}) ' @@ -83,7 +83,7 @@ Partial Class dlgStartofRains Me.nudMinimum.Location = New System.Drawing.Point(201, 19) Me.nudMinimum.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudMinimum.Name = "nudMinimum" - Me.nudMinimum.Size = New System.Drawing.Size(41, 20) + Me.nudMinimum.Size = New System.Drawing.Size(47, 20) Me.nudMinimum.TabIndex = 2 Me.nudMinimum.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' @@ -122,17 +122,17 @@ Partial Class dlgStartofRains ' 'nudOutOfDays ' - Me.nudOutOfDays.Location = New System.Drawing.Point(332, 20) + Me.nudOutOfDays.Location = New System.Drawing.Point(337, 20) Me.nudOutOfDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudOutOfDays.Name = "nudOutOfDays" - Me.nudOutOfDays.Size = New System.Drawing.Size(53, 20) + Me.nudOutOfDays.Size = New System.Drawing.Size(52, 20) Me.nudOutOfDays.TabIndex = 4 Me.nudOutOfDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'lblWidth ' Me.lblWidth.AutoSize = True - Me.lblWidth.Location = New System.Drawing.Point(264, 23) + Me.lblWidth.Location = New System.Drawing.Point(269, 23) Me.lblWidth.Name = "lblWidth" Me.lblWidth.Size = New System.Drawing.Size(66, 13) Me.lblWidth.TabIndex = 3 @@ -140,10 +140,10 @@ Partial Class dlgStartofRains ' 'nudLengthofTime ' - Me.nudLengthofTime.Location = New System.Drawing.Point(332, 68) + Me.nudLengthofTime.Location = New System.Drawing.Point(337, 68) Me.nudLengthofTime.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudLengthofTime.Name = "nudLengthofTime" - Me.nudLengthofTime.Size = New System.Drawing.Size(53, 20) + Me.nudLengthofTime.Size = New System.Drawing.Size(52, 20) Me.nudLengthofTime.TabIndex = 14 Me.nudLengthofTime.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' @@ -152,24 +152,24 @@ Partial Class dlgStartofRains Me.nudMaximumDays.Location = New System.Drawing.Point(201, 68) Me.nudMaximumDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudMaximumDays.Name = "nudMaximumDays" - Me.nudMaximumDays.Size = New System.Drawing.Size(41, 20) + Me.nudMaximumDays.Size = New System.Drawing.Size(47, 20) Me.nudMaximumDays.TabIndex = 12 Me.nudMaximumDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'nudOverDays ' - Me.nudOverDays.Location = New System.Drawing.Point(332, 43) + Me.nudOverDays.Location = New System.Drawing.Point(337, 45) Me.nudOverDays.Maximum = New Decimal(New Integer() {366, 0, 0, 0}) Me.nudOverDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudOverDays.Name = "nudOverDays" - Me.nudOverDays.Size = New System.Drawing.Size(53, 20) + Me.nudOverDays.Size = New System.Drawing.Size(52, 20) Me.nudOverDays.TabIndex = 9 Me.nudOverDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'lblLengthofTime ' Me.lblLengthofTime.AutoSize = True - Me.lblLengthofTime.Location = New System.Drawing.Point(249, 71) + Me.lblLengthofTime.Location = New System.Drawing.Point(254, 71) Me.lblLengthofTime.Name = "lblLengthofTime" Me.lblLengthofTime.Size = New System.Drawing.Size(81, 13) Me.lblLengthofTime.TabIndex = 13 @@ -178,7 +178,7 @@ Partial Class dlgStartofRains 'lblMaximumDays ' Me.lblMaximumDays.AutoSize = True - Me.lblMaximumDays.Location = New System.Drawing.Point(118, 71) + Me.lblMaximumDays.Location = New System.Drawing.Point(118, 70) Me.lblMaximumDays.Name = "lblMaximumDays" Me.lblMaximumDays.Size = New System.Drawing.Size(81, 13) Me.lblMaximumDays.TabIndex = 11 @@ -187,7 +187,7 @@ Partial Class dlgStartofRains 'lblVal ' Me.lblVal.AutoSize = True - Me.lblVal.Location = New System.Drawing.Point(162, 47) + Me.lblVal.Location = New System.Drawing.Point(162, 46) Me.lblVal.Name = "lblVal" Me.lblVal.Size = New System.Drawing.Size(37, 13) Me.lblVal.TabIndex = 6 @@ -196,7 +196,7 @@ Partial Class dlgStartofRains 'lblOverDays ' Me.lblOverDays.AutoSize = True - Me.lblOverDays.Location = New System.Drawing.Point(270, 46) + Me.lblOverDays.Location = New System.Drawing.Point(275, 47) Me.lblOverDays.Name = "lblOverDays" Me.lblOverDays.Size = New System.Drawing.Size(60, 13) Me.lblOverDays.TabIndex = 8 From 74cd994f37e40d039ab8327184ced0935f1e76a2 Mon Sep 17 00:00:00 2001 From: Lily Date: Thu, 5 Jan 2017 14:11:15 +0000 Subject: [PATCH 13/72] Start of Rains --- instat/dlgStartofRains.vb | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 54a95e739ee..a87aaed84ca 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -15,7 +15,7 @@ Imports instat.Translations Public Class dlgStartofRains Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsDryPeriodTen, clsWithinThirtyDays, clsDrySpell, clsYearGroupDaily, clsSubCalcMinSum, clsSubCalcXDaysRain, clsSubCalcNoTenInThirty, clsManipulationFirstDOYPerYear, clsApplyRainDays, clsRainDayOnly As New RFunction - Public clsMinimumRainfallList, clsDryPeriodTenList As New RFunction + Public clsMinimumRainfallList, clsDryPeriodTenList, clsSubRainDays, clsSubDryPeriodTen As New RFunction Private strCurrDataName As String = "" Public bFirstLoad As Boolean = True Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -66,12 +66,17 @@ Public Class dlgStartofRains clsDrySpell.SetRCommand("instat_calculation$new") clsDrySpell.SetAssignTo("Dry_Spell") clsWithinThirtyDays.SetRCommand("instat_calculation$new") - clsWithinThirtyDays.SetAssignTo("dry_spell_no_10_in_30") + clsWithinThirtyDays.SetAssignTo("dry_spell_10") ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") + clsApplyRainDays.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") + clsApplyRainDays.AddParameter("calc", clsRFunctionParameter:=clsRainyDays) clsSubCalcMinSum.SetRCommand("list") clsSubCalcXDaysRain.SetRCommand("list") + clsSubRainDays.SetRCommand("list") + clsSubDryPeriodTen.SetRCommand("list") clsSubCalcNoTenInThirty.SetRCommand("list") clsManipulationFirstDOYPerYear.SetRCommand("list") + clsDryPeriodTenList.SetRCommand("list") ucrReceiverRainfall.Selector = ucrSelectorForStartofRains ucrReceiverYear.Selector = ucrSelectorForStartofRains ucrReceiverDate.Selector = ucrSelectorForStartofRains @@ -189,7 +194,6 @@ Public Class dlgStartofRains End If End Sub - Private Sub AddKeyMethod() If Not ucrReceiverDate.IsEmpty Then clsAddKey.AddParameter("col_name", ucrReceiverDate.GetVariableNames) @@ -215,7 +219,7 @@ Public Class dlgStartofRains clsRainyDays.AddParameter("function_exp", Chr(34) & "match(" & ucrReceiverRainfall.GetVariableNames(False) & ">=" & nudThreshold.Value & "," & "1, nomatch = 0" & ")" & Chr(34)) clsRainyDays.AddParameter("result_name", Chr(34) & "rain_day" & Chr(34)) clsRainyDays.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & Chr(34) & "Rain" & Chr(34) & ")") - clsRainyDays.AddParameter("save", 0) + clsRainyDays.AddParameter("save", 2) Else clsRainyDays.RemoveParameterByName("type") clsRainyDays.RemoveParameterByName("function_exp") @@ -258,7 +262,7 @@ Public Class dlgStartofRains Private Sub RollingOfRainDays() clsRollingRainDays.AddParameter("type", Chr(34) & "calculation" & Chr(34)) - clsRollingRainDays.AddParameter("function_exp", Chr(34) & "rollapply(data=rain_day, Width = " & nudOutOfDays.Value & ", FUN = sum, align = 'right', fill=NA)" & Chr(34)) + clsRollingRainDays.AddParameter("function_exp", Chr(34) & "rollapply(data=rain_day, width = " & nudOutOfDays.Value & ", FUN = sum, align = 'right', fill=NA)" & Chr(34)) clsRollingRainDays.AddParameter("result_name", Chr(34) & "Rolling_Rain_Days" & Chr(34)) clsRollingRainDays.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & Chr(34) & "rain_day" & Chr(34) & ")") clsRollingRainDays.AddParameter("save", 1) @@ -289,12 +293,11 @@ Public Class dlgStartofRains End Sub Private Sub NoTenInThirty() - clsSubCalcNoTenInThirty.AddParameter("sub1", clsRFunctionParameter:=clsDrySpell, bIncludeArgumentName:=False) clsDryPeriodTen.AddParameter("type", Chr(34) & "calculation" & Chr(34)) clsDryPeriodTen.AddParameter("function_exp", Chr(34) & "rollapply(data = Dry_Spell, width=" & nudLengthofTime.Value & ", FUN=max, align='right', fill=NA)" & Chr(34)) clsDryPeriodTen.AddParameter("result_name", Chr(34) & "Dry_Period" & Chr(34)) clsDryPeriodTen.AddParameter("sub_calculations", clsRFunctionParameter:=clsDryPeriodTenList) - clsDryPeriodTenList.AddParameter("sub1", clsRFunctionParameter:=clsSubCalcNoTenInThirty, bIncludeArgumentName:=False) + clsDryPeriodTenList.AddParameter("sub1", clsRFunctionParameter:=clsDrySpell, bIncludeArgumentName:=False) clsDryPeriodTen.AddParameter("save", 2) PeriodWithinThirtyDays() End Sub @@ -302,7 +305,8 @@ Public Class dlgStartofRains Private Sub PeriodWithinThirtyDays() clsWithinThirtyDays.AddParameter("type", Chr(34) & "filter" & Chr(34)) clsWithinThirtyDays.AddParameter("function_exp", Chr(34) & "Dry_Period <" & nudLengthofTime.Value & Chr(34)) - clsWithinThirtyDays.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & Chr(34) & "Dry_period" & ")" & Chr(34)) + clsWithinThirtyDays.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubDryPeriodTen) + clsSubDryPeriodTen.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) End Sub Private Sub FirstDOYPerYear() @@ -330,7 +334,7 @@ Public Class dlgStartofRains End If If chkDrySpell.Checked Then - clsManipulationFirstDOYPerYear.AddParameter("sub2", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + clsManipulationFirstDOYPerYear.AddParameter("sub2", clsRFunctionParameter:=clsWithinThirtyDays, bIncludeArgumentName:=False) Else clsManipulationFirstDOYPerYear.RemoveParameterByName("sub2") End If @@ -355,4 +359,9 @@ Public Class dlgStartofRains Private Sub firstDayofTheYear() ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsFirstDOYPerYear) End Sub + + Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk + frmMain.clsRLink.RunScript(clsAddKey.ToScript, strComment:="Start of Rains: Defining Date column as key") + 'frmMain.clsRLink.RunScript(clsApplyRainDays.ToScript, strComment:="Start of Rains: Creating rain_day column") + End Sub End Class \ No newline at end of file From 487336e780a299bb83862621260d3093b0417d91 Mon Sep 17 00:00:00 2001 From: Lily Date: Mon, 9 Jan 2017 12:31:43 +0000 Subject: [PATCH 14/72] Getting threshold to run --- instat/dlgStartofRains.vb | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index a87aaed84ca..ec626bc1706 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -50,7 +50,7 @@ Public Class dlgStartofRains clsYearGroupDaily.SetRCommand("instat_calculation$new") clsYearGroupDaily.SetAssignTo("Year_Group_Daily") clsRainyDays.SetRCommand("instat_calculation$new") - clsRainyDays.SetAssignTo("Rainy_Days") + clsApplyRainDays.SetRCommand("InstatDataObject$apply_instat_calculation") clsRollingSum.SetRCommand("instat_calculation$new") clsRollingSum.SetAssignTo("rolling_sum") clsMinimumRainfall.SetRCommand("instat_calculation$new") @@ -68,8 +68,6 @@ Public Class dlgStartofRains clsWithinThirtyDays.SetRCommand("instat_calculation$new") clsWithinThirtyDays.SetAssignTo("dry_spell_10") ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") - clsApplyRainDays.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") - clsApplyRainDays.AddParameter("calc", clsRFunctionParameter:=clsRainyDays) clsSubCalcMinSum.SetRCommand("list") clsSubCalcXDaysRain.SetRCommand("list") clsSubRainDays.SetRCommand("list") @@ -137,10 +135,13 @@ Public Class dlgStartofRains Private Sub grpConditionsForSatrtofRains1_Enter(sender As Object, e As EventArgs) Handles chkConsecutiveRainyDays.CheckedChanged, chkTotalRainfall.CheckedChanged, chkDrySpell.CheckedChanged CheckBoxesSetting() + RainyDaysMethod() MinimumRainfallMethod() FirstDOYPerYear() + ApplyRainyDays() TestOKEnabled() End Sub + Private Sub ucrReceiverRainfall_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverRainfall.SelectionChanged RainyDaysMethod() RollingSumMethod() @@ -218,7 +219,7 @@ Public Class dlgStartofRains clsRainyDays.AddParameter("type", Chr(34) & "calculation" & Chr(34)) clsRainyDays.AddParameter("function_exp", Chr(34) & "match(" & ucrReceiverRainfall.GetVariableNames(False) & ">=" & nudThreshold.Value & "," & "1, nomatch = 0" & ")" & Chr(34)) clsRainyDays.AddParameter("result_name", Chr(34) & "rain_day" & Chr(34)) - clsRainyDays.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & Chr(34) & "Rain" & Chr(34) & ")") + clsRainyDays.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverRainfall.GetVariableNames(True) & ")") clsRainyDays.AddParameter("save", 2) Else clsRainyDays.RemoveParameterByName("type") @@ -360,8 +361,14 @@ Public Class dlgStartofRains ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsFirstDOYPerYear) End Sub + Private Sub ApplyRainyDays() + If chkConsecutiveRainyDays.Checked Or chkDrySpell.Checked Then ' Does 'or' do or/and or just or? + clsApplyRainDays.AddParameter("calc", clsRFunctionParameter:=clsRainyDays) + frmMain.clsRLink.RunScript(clsApplyRainDays.ToScript, strComment:="Start of Rains: Creating rain_day column") + End If + End Sub + Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk frmMain.clsRLink.RunScript(clsAddKey.ToScript, strComment:="Start of Rains: Defining Date column as key") - 'frmMain.clsRLink.RunScript(clsApplyRainDays.ToScript, strComment:="Start of Rains: Creating rain_day column") End Sub End Class \ No newline at end of file From a33c105f64ccfa45a183e8652f5864a89de803d4 Mon Sep 17 00:00:00 2001 From: Lily Date: Mon, 9 Jan 2017 12:45:48 +0000 Subject: [PATCH 15/72] Running when OK clicked --- instat/dlgStartofRains.vb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index ec626bc1706..748911531b8 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -138,7 +138,6 @@ Public Class dlgStartofRains RainyDaysMethod() MinimumRainfallMethod() FirstDOYPerYear() - ApplyRainyDays() TestOKEnabled() End Sub @@ -361,14 +360,9 @@ Public Class dlgStartofRains ucrBase.clsRsyntax.AddParameter("calc", clsRFunctionParameter:=clsFirstDOYPerYear) End Sub - Private Sub ApplyRainyDays() - If chkConsecutiveRainyDays.Checked Or chkDrySpell.Checked Then ' Does 'or' do or/and or just or? - clsApplyRainDays.AddParameter("calc", clsRFunctionParameter:=clsRainyDays) - frmMain.clsRLink.RunScript(clsApplyRainDays.ToScript, strComment:="Start of Rains: Creating rain_day column") - End If - End Sub - Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk frmMain.clsRLink.RunScript(clsAddKey.ToScript, strComment:="Start of Rains: Defining Date column as key") + clsApplyRainDays.AddParameter("calc", clsRFunctionParameter:=clsRainyDays) + frmMain.clsRLink.RunScript(clsApplyRainDays.ToScript, strComment:="Start of Rains: Creating rain_day column") End Sub End Class \ No newline at end of file From 499022a186b602ff61a068f287cba5cfaa599eab Mon Sep 17 00:00:00 2001 From: Lily Date: Mon, 9 Jan 2017 14:48:42 +0000 Subject: [PATCH 16/72] Tab changes --- instat/dlgStartofRains.Designer.vb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index 72816e310ca..8b44406cef6 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -116,7 +116,7 @@ Partial Class dlgStartofRains Me.grpConditionsForSatrtofRains.Location = New System.Drawing.Point(9, 285) Me.grpConditionsForSatrtofRains.Name = "grpConditionsForSatrtofRains" Me.grpConditionsForSatrtofRains.Size = New System.Drawing.Size(395, 95) - Me.grpConditionsForSatrtofRains.TabIndex = 8 + Me.grpConditionsForSatrtofRains.TabIndex = 10 Me.grpConditionsForSatrtofRains.TabStop = False Me.grpConditionsForSatrtofRains.Text = "Conditions for Start of Rains" ' @@ -253,7 +253,7 @@ Partial Class dlgStartofRains Me.grpRainParameters.Location = New System.Drawing.Point(9, 192) Me.grpRainParameters.Name = "grpRainParameters" Me.grpRainParameters.Size = New System.Drawing.Size(144, 87) - Me.grpRainParameters.TabIndex = 7 + Me.grpRainParameters.TabIndex = 9 Me.grpRainParameters.TabStop = False ' 'nudThreshold @@ -324,7 +324,7 @@ Partial Class dlgStartofRains Me.lblDOY.Location = New System.Drawing.Point(251, 167) Me.lblDOY.Name = "lblDOY" Me.lblDOY.Size = New System.Drawing.Size(66, 13) - Me.lblDOY.TabIndex = 5 + Me.lblDOY.TabIndex = 7 Me.lblDOY.Text = "Day of Year:" ' 'lblDate @@ -352,7 +352,7 @@ Partial Class dlgStartofRains Me.ucrReceiverDOY.Name = "ucrReceiverDOY" Me.ucrReceiverDOY.Selector = Nothing Me.ucrReceiverDOY.Size = New System.Drawing.Size(143, 20) - Me.ucrReceiverDOY.TabIndex = 6 + Me.ucrReceiverDOY.TabIndex = 8 ' 'ucrReceiverRainfall ' @@ -378,7 +378,7 @@ Partial Class dlgStartofRains Me.ucrBase.Location = New System.Drawing.Point(9, 386) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) - Me.ucrBase.TabIndex = 9 + Me.ucrBase.TabIndex = 11 ' 'ucrReceiverYear ' @@ -387,7 +387,7 @@ Partial Class dlgStartofRains Me.ucrReceiverYear.Name = "ucrReceiverYear" Me.ucrReceiverYear.Selector = Nothing Me.ucrReceiverYear.Size = New System.Drawing.Size(143, 20) - Me.ucrReceiverYear.TabIndex = 11 + Me.ucrReceiverYear.TabIndex = 6 ' 'lblYear ' @@ -395,7 +395,7 @@ Partial Class dlgStartofRains Me.lblYear.Location = New System.Drawing.Point(251, 125) Me.lblYear.Name = "lblYear" Me.lblYear.Size = New System.Drawing.Size(32, 13) - Me.lblYear.TabIndex = 10 + Me.lblYear.TabIndex = 5 Me.lblYear.Text = "Year:" ' 'dlgStartofRains From 2b4c9fc7abcaf9b0dba812eb1f30be3e30fea2c8 Mon Sep 17 00:00:00 2001 From: Lily Date: Tue, 10 Jan 2017 10:43:40 +0000 Subject: [PATCH 17/72] Layout edit --- instat/dlgStartofRains.Designer.vb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index 8b44406cef6..2244b370ae2 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -149,7 +149,7 @@ Partial Class dlgStartofRains ' 'nudMaximumDays ' - Me.nudMaximumDays.Location = New System.Drawing.Point(201, 68) + Me.nudMaximumDays.Location = New System.Drawing.Point(201, 67) Me.nudMaximumDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudMaximumDays.Name = "nudMaximumDays" Me.nudMaximumDays.Size = New System.Drawing.Size(47, 20) @@ -158,7 +158,7 @@ Partial Class dlgStartofRains ' 'nudOverDays ' - Me.nudOverDays.Location = New System.Drawing.Point(337, 45) + Me.nudOverDays.Location = New System.Drawing.Point(337, 44) Me.nudOverDays.Maximum = New Decimal(New Integer() {366, 0, 0, 0}) Me.nudOverDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudOverDays.Name = "nudOverDays" @@ -215,7 +215,7 @@ Partial Class dlgStartofRains 'chkDrySpell ' Me.chkDrySpell.AutoSize = True - Me.chkDrySpell.Location = New System.Drawing.Point(7, 71) + Me.chkDrySpell.Location = New System.Drawing.Point(7, 70) Me.chkDrySpell.Name = "chkDrySpell" Me.chkDrySpell.Size = New System.Drawing.Size(68, 17) Me.chkDrySpell.TabIndex = 10 @@ -225,7 +225,7 @@ Partial Class dlgStartofRains 'chkTotalRainfall ' Me.chkTotalRainfall.AutoSize = True - Me.chkTotalRainfall.Location = New System.Drawing.Point(7, 44) + Me.chkTotalRainfall.Location = New System.Drawing.Point(7, 45) Me.chkTotalRainfall.Name = "chkTotalRainfall" Me.chkTotalRainfall.Size = New System.Drawing.Size(88, 17) Me.chkTotalRainfall.TabIndex = 5 From 2411b7ea362d46d9368dee03558965e7463d8354 Mon Sep 17 00:00:00 2001 From: Lily Date: Mon, 16 Jan 2017 16:51:08 +0000 Subject: [PATCH 18/72] Bug fixes --- instat/dlgStartofRains.vb | 199 ++++++++++++++++++++------------------ 1 file changed, 106 insertions(+), 93 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 748911531b8..d013df4c370 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -14,8 +14,8 @@ ' along with this program. If not, see . Imports instat.Translations Public Class dlgStartofRains - Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsDryPeriodTen, clsWithinThirtyDays, clsDrySpell, clsYearGroupDaily, clsSubCalcMinSum, clsSubCalcXDaysRain, clsSubCalcNoTenInThirty, clsManipulationFirstDOYPerYear, clsApplyRainDays, clsRainDayOnly As New RFunction - Public clsMinimumRainfallList, clsDryPeriodTenList, clsSubRainDays, clsSubDryPeriodTen As New RFunction + Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsDryPeriodTen, clsWithinThirtyDays, clsDrySpell, clsYearGroupDaily, clsManipulationFirstDOYPerYear As New RFunction + Public clsDryPeriodTenList, clsSubRainDays1, clsSubRainDays2, clsCombinedFilter, clsCombinedList As New RFunction Private strCurrDataName As String = "" Public bFirstLoad As Boolean = True Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -50,13 +50,12 @@ Public Class dlgStartofRains clsYearGroupDaily.SetRCommand("instat_calculation$new") clsYearGroupDaily.SetAssignTo("Year_Group_Daily") clsRainyDays.SetRCommand("instat_calculation$new") - clsApplyRainDays.SetRCommand("InstatDataObject$apply_instat_calculation") clsRollingSum.SetRCommand("instat_calculation$new") - clsRollingSum.SetAssignTo("rolling_sum") + clsRollingSum.SetAssignTo("rolling_sum_day") clsMinimumRainfall.SetRCommand("instat_calculation$new") clsMinimumRainfall.SetAssignTo("Minimum_Rainfall") clsRollingRainDays.SetRCommand("instat_calculation$new") - clsRollingRainDays.SetAssignTo("Rolling_Of_rain_days") + clsRollingRainDays.SetAssignTo("Rolling_rain") clsXdaysRain.SetRCommand("instat_calculation$new") clsXdaysRain.SetAssignTo("x_Days_Rain") clsFirstDOYPerYear.SetRCommand("instat_calculation$new") @@ -68,13 +67,15 @@ Public Class dlgStartofRains clsWithinThirtyDays.SetRCommand("instat_calculation$new") clsWithinThirtyDays.SetAssignTo("dry_spell_10") ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$apply_instat_calculation") - clsSubCalcMinSum.SetRCommand("list") - clsSubCalcXDaysRain.SetRCommand("list") - clsSubRainDays.SetRCommand("list") - clsSubDryPeriodTen.SetRCommand("list") - clsSubCalcNoTenInThirty.SetRCommand("list") + clsSubRainDays1.SetRCommand("list") + clsSubRainDays2.SetRCommand("list") + clsCombinedList.SetRCommand("list") clsManipulationFirstDOYPerYear.SetRCommand("list") clsDryPeriodTenList.SetRCommand("list") + + clsCombinedFilter.SetRCommand("instat_calculation$new") + clsCombinedFilter.SetAssignTo("combined_filter") + ucrReceiverRainfall.Selector = ucrSelectorForStartofRains ucrReceiverYear.Selector = ucrSelectorForStartofRains ucrReceiverDate.Selector = ucrSelectorForStartofRains @@ -125,18 +126,18 @@ Public Class dlgStartofRains Private Sub grpConditionsForSatrtofRains_Enter(sender As Object, e As EventArgs) Handles nudValue.TextChanged, nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged, nudOverDays.TextChanged, nudOutOfDays.TextChanged RainyDaysMethod() DayFromAndToMethod() - MinimumRainfallMethod() - XDaysRainMethod() - PeriodWithinThirtyDays() + CombinedFilter() RollingOfRainDays() + DrySpell() RollingSumMethod() TestOKEnabled() End Sub Private Sub grpConditionsForSatrtofRains1_Enter(sender As Object, e As EventArgs) Handles chkConsecutiveRainyDays.CheckedChanged, chkTotalRainfall.CheckedChanged, chkDrySpell.CheckedChanged CheckBoxesSetting() + DrySpell() RainyDaysMethod() - MinimumRainfallMethod() + CombinedFilter() FirstDOYPerYear() TestOKEnabled() End Sub @@ -181,7 +182,6 @@ Public Class dlgStartofRains lblMaximumDays.Visible = False End If If chkConsecutiveRainyDays.Checked Then - nudMinimum.Visible = True nudOutOfDays.Visible = True lblMinimum.Visible = True @@ -219,7 +219,8 @@ Public Class dlgStartofRains clsRainyDays.AddParameter("function_exp", Chr(34) & "match(" & ucrReceiverRainfall.GetVariableNames(False) & ">=" & nudThreshold.Value & "," & "1, nomatch = 0" & ")" & Chr(34)) clsRainyDays.AddParameter("result_name", Chr(34) & "rain_day" & Chr(34)) clsRainyDays.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverRainfall.GetVariableNames(True) & ")") - clsRainyDays.AddParameter("save", 2) + clsRainyDays.AddParameter("save", 0) + ' clsSubRainDays.AddParameter("sub1", clsRFunctionParameter:=clsRainyDays, bIncludeArgumentName:=False) Else clsRainyDays.RemoveParameterByName("type") clsRainyDays.RemoveParameterByName("function_exp") @@ -230,12 +231,13 @@ Public Class dlgStartofRains End Sub Private Sub RollingSumMethod() + ' chk total rainfall If Not ucrReceiverRainfall.IsEmpty Then - clsRollingSum.AddParameter("function_exp", Chr(34) & " rollapply(data = " & ucrReceiverRainfall.GetVariableNames(False) & " ,width = " & nudOverDays.Value & ", FUN = sum, align='right', fill=NA)" & Chr(34)) + clsRollingSum.AddParameter("function_exp", Chr(34) & " rollapply(data = " & ucrReceiverRainfall.GetVariableNames(False) & " ,width = " & nudOverDays.Value & ", FUN = sum, na.rm = FALSE, align='right', fill=NA)" & Chr(34)) clsRollingSum.AddParameter("type", Chr(34) & "calculation" & Chr(34)) clsRollingSum.AddParameter("result_name", Chr(34) & "roll_sum_Rain" & Chr(34)) clsRollingSum.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverRainfall.GetVariableNames & ")") - clsRollingSum.AddParameter("save", 1) + clsRollingSum.AddParameter("save", 0) Else clsRollingSum.RemoveParameterByName("function_exp") clsRollingSum.RemoveParameterByName("type") @@ -245,105 +247,118 @@ Public Class dlgStartofRains End If End Sub - Private Sub MinimumRainfallMethod() - If nudValue.Text <> "" Then - clsMinimumRainfall.AddParameter("function_exp", Chr(34) & "roll_sum_Rain >" & nudValue.Value & Chr(34)) - clsMinimumRainfall.AddParameter("type", Chr(34) & "filter" & Chr(34)) - clsSubCalcMinSum.AddParameter("sub1", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) - clsMinimumRainfall.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubCalcMinSum) - Else - clsMinimumRainfall.RemoveParameterByName("function_exp") - clsMinimumRainfall.RemoveParameterByName("type") - clsMinimumRainfall.RemoveParameterByName("sub_calculations") - 'clsMinimumRainfallList.RemoveParameterByName("sub1") - End If - RollingOfRainDays() - End Sub - Private Sub RollingOfRainDays() + ' If rolling of rain days one is checked Then clsRollingRainDays.AddParameter("type", Chr(34) & "calculation" & Chr(34)) - clsRollingRainDays.AddParameter("function_exp", Chr(34) & "rollapply(data=rain_day, width = " & nudOutOfDays.Value & ", FUN = sum, align = 'right', fill=NA)" & Chr(34)) + clsRollingRainDays.AddParameter("function_exp", Chr(34) & "rollapply(data=rain_day, width = " & nudOutOfDays.Value & ", FUN = sum, na.rm = FALSE, align = 'right', fill=NA)" & Chr(34)) clsRollingRainDays.AddParameter("result_name", Chr(34) & "Rolling_Rain_Days" & Chr(34)) - clsRollingRainDays.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & Chr(34) & "rain_day" & Chr(34) & ")") - clsRollingRainDays.AddParameter("save", 1) + clsRollingRainDays.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubRainDays1) + clsSubRainDays1.AddParameter("sub1", clsRFunctionParameter:=clsRainyDays, bIncludeArgumentName:=False) + clsRollingRainDays.AddParameter("save", 0) End Sub - Private Sub XDaysRainMethod() - If nudMinimum.Text <> "" Then - clsXdaysRain.AddParameter("type", Chr(34) & "filter" & Chr(34)) - clsXdaysRain.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >=" & nudMinimum.Value & Chr(34)) - clsXdaysRain.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubCalcXDaysRain) - clsSubCalcXDaysRain.AddParameter("sub1", clsRFunctionParameter:=clsRollingRainDays, bIncludeArgumentName:=False) + Private Sub DrySpell() + If chkDrySpell.Checked Then + clsDrySpell.AddParameter("type", Chr(34) & "calculation" & Chr(34)) + clsDrySpell.AddParameter("function_exp", Chr(34) & "cumsum(rain_day==0)-cummax((rain_day)*cumsum(rain_day==0))" & Chr(34)) + clsDrySpell.AddParameter("result_name", Chr(34) & "Dry_Spell" & Chr(34)) + clsDrySpell.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubRainDays2) + clsSubRainDays2.AddParameter("sub1", clsRFunctionParameter:=clsRainyDays, bIncludeArgumentName:=False) + clsDrySpell.AddParameter("save", 0) + clsDryPeriodTen.AddParameter("type", Chr(34) & "calculation" & Chr(34)) + clsDryPeriodTen.AddParameter("function_exp", Chr(34) & "rollapply(data = Dry_Spell, width=" & nudLengthofTime.Value & ", FUN=max, na.rm = FALSE, align='right', fill=NA)" & Chr(34)) + clsDryPeriodTen.AddParameter("result_name", Chr(34) & "Dry_Period" & Chr(34)) + clsDryPeriodTen.AddParameter("sub_calculations", clsRFunctionParameter:=clsDryPeriodTenList) + clsDryPeriodTenList.AddParameter("sub1", clsRFunctionParameter:=clsDrySpell, bIncludeArgumentName:=False) + clsDryPeriodTen.AddParameter("save", 2) Else - clsXdaysRain.RemoveParameterByName("type") - clsXdaysRain.RemoveParameterByName("function_exp") - clsXdaysRain.RemoveParameterByName("sub_calculations") - clsSubCalcXDaysRain.RemoveParameterByName("sub1") + clsDrySpell.RemoveParameterByName("type") + clsDrySpell.RemoveParameterByName("function_exp") + clsDrySpell.RemoveParameterByName("result_name") + clsDrySpell.RemoveParameterByName("sub_calculations") + clsSubRainDays2.RemoveParameterByName("sub1") + clsDrySpell.RemoveParameterByName("save") + clsDryPeriodTen.RemoveParameterByName("type") + clsDryPeriodTen.RemoveParameterByName("function_exp") + clsDryPeriodTen.RemoveParameterByName("sub_calculations") + clsDryPeriodTen.RemoveParameterByName("result_name") + clsDryPeriodTen.RemoveParameterByName("save") + clsDryPeriodTenList.RemoveParameterByName("sub1") End If - DrySpell() - End Sub - Private Sub DrySpell() - clsDrySpell.AddParameter("type", Chr(34) & "calculation" & Chr(34)) - clsDrySpell.AddParameter("function_exp", Chr(34) & "cumsum(rain_day==0)-cummax((rain_day)*cumsum(rain_day==0))" & Chr(34)) - clsDrySpell.AddParameter("result_name", Chr(34) & "Dry_Spell" & Chr(34)) - clsDrySpell.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & Chr(34) & "rain_day" & Chr(34) & ")") - clsDrySpell.AddParameter("save", 1) - NoTenInThirty() End Sub - Private Sub NoTenInThirty() - clsDryPeriodTen.AddParameter("type", Chr(34) & "calculation" & Chr(34)) - clsDryPeriodTen.AddParameter("function_exp", Chr(34) & "rollapply(data = Dry_Spell, width=" & nudLengthofTime.Value & ", FUN=max, align='right', fill=NA)" & Chr(34)) - clsDryPeriodTen.AddParameter("result_name", Chr(34) & "Dry_Period" & Chr(34)) - clsDryPeriodTen.AddParameter("sub_calculations", clsRFunctionParameter:=clsDryPeriodTenList) - clsDryPeriodTenList.AddParameter("sub1", clsRFunctionParameter:=clsDrySpell, bIncludeArgumentName:=False) - clsDryPeriodTen.AddParameter("save", 2) - PeriodWithinThirtyDays() - End Sub + Private Sub CombinedFilter() + clsCombinedFilter.AddParameter("type", Chr(34) & "filter" & Chr(34)) + clsCombinedFilter.AddParameter("sub_calculations", clsRFunctionParameter:=clsCombinedList) + + ' Run with all first, then sort out to separate bits. + ' do six if statements for now + + If chkConsecutiveRainyDays.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= 1 & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub2", clsRFunctionParameter:=clsRollingRainDays, bIncludeArgumentName:=False) + clsCombinedList.RemoveParameterByName("sub1") + clsCombinedList.RemoveParameterByName("sub3") + + ElseIf chkTotalRainfall.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "roll_sum_Rain >20 & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) + clsCombinedList.RemoveParameterByName("sub2") + clsCombinedList.RemoveParameterByName("sub1") + + ElseIf chkDrySpell.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + clsCombinedList.RemoveParameterByName("sub2") + clsCombinedList.RemoveParameterByName("sub3") - Private Sub PeriodWithinThirtyDays() - clsWithinThirtyDays.AddParameter("type", Chr(34) & "filter" & Chr(34)) - clsWithinThirtyDays.AddParameter("function_exp", Chr(34) & "Dry_Period <" & nudLengthofTime.Value & Chr(34)) - clsWithinThirtyDays.AddParameter("sub_calculations", clsRFunctionParameter:=clsSubDryPeriodTen) - clsSubDryPeriodTen.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + ElseIf chkConsecutiveRainyDays.Checked AndAlso chkTotalRainfall.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= 1 & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub2", clsRFunctionParameter:=clsRollingRainDays, bIncludeArgumentName:=False) + clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) + clsCombinedList.RemoveParameterByName("sub1") + + ElseIf chkConsecutiveRainyDays.Checked AndAlso chkDrySpell.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & Rolling_Rain_Days >= 1 & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub2", clsRFunctionParameter:=clsRollingRainDays, bIncludeArgumentName:=False) + clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + clsCombinedList.RemoveParameterByName("sub3") + + ElseIf chkConsecutiveRainyDays.Checked AndAlso chkTotalRainfall.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) + clsCombinedList.RemoveParameterByName("sub2") + Else + clsCombinedFilter.RemoveParameterByName("function_exp") + clsCombinedFilter.RemoveParameterByName("type") + clsCombinedFilter.RemoveParameterByName("sub_calculations") + clsCombinedList.RemoveParameterByName("sub1") + clsCombinedList.RemoveParameterByName("sub2") + clsCombinedList.RemoveParameterByName("sub3") + End If End Sub Private Sub FirstDOYPerYear() ' run these when things are checked If Not ucrReceiverDOY.IsEmpty Then - clsManipulationFirstDOYPerYear.AddParameter("sub3", clsRFunctionParameter:=clsYearGroupDaily, bIncludeArgumentName:=False) - clsManipulationFirstDOYPerYear.AddParameter("sub5", clsRFunctionParameter:=clsDayFromAndTo, bIncludeArgumentName:=False) + + clsManipulationFirstDOYPerYear.AddParameter("sub1", clsRFunctionParameter:=clsCombinedFilter, bIncludeArgumentName:=False) + clsManipulationFirstDOYPerYear.AddParameter("sub2", clsRFunctionParameter:=clsYearGroupDaily, bIncludeArgumentName:=False) + clsManipulationFirstDOYPerYear.AddParameter("sub3", clsRFunctionParameter:=clsDayFromAndTo, bIncludeArgumentName:=False) + clsFirstDOYPerYear.AddParameter("type", Chr(34) & "summary" & Chr(34)) clsFirstDOYPerYear.AddParameter("function_exp", Chr(34) & ucrReceiverDOY.GetVariableNames(False) & "[" & 1 & "]" & Chr(34)) clsFirstDOYPerYear.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverDOY.GetVariableNames() & ")") clsFirstDOYPerYear.AddParameter("manipulations", clsRFunctionParameter:=clsManipulationFirstDOYPerYear) - clsFirstDOYPerYear.AddParameter("result_name", Chr(34) & "Start_of_Rains" & Chr(34)) + clsFirstDOYPerYear.AddParameter("result_name", Chr(34) & "First_Possible_Onset_wet_season" & Chr(34)) clsFirstDOYPerYear.AddParameter("save", 2) - If chkConsecutiveRainyDays.Checked Then - clsManipulationFirstDOYPerYear.AddParameter("sub1", clsRFunctionParameter:=clsXdaysRain, bIncludeArgumentName:=False) - Else - clsManipulationFirstDOYPerYear.RemoveParameterByName("sub1") - End If - - If chkTotalRainfall.Checked Then - clsManipulationFirstDOYPerYear.AddParameter("sub4", clsRFunctionParameter:=clsMinimumRainfall, bIncludeArgumentName:=False) - Else - clsManipulationFirstDOYPerYear.RemoveParameterByName("sub4") - End If - - If chkDrySpell.Checked Then - clsManipulationFirstDOYPerYear.AddParameter("sub2", clsRFunctionParameter:=clsWithinThirtyDays, bIncludeArgumentName:=False) - Else - clsManipulationFirstDOYPerYear.RemoveParameterByName("sub2") - End If Else clsManipulationFirstDOYPerYear.RemoveParameterByName("sub1") clsManipulationFirstDOYPerYear.RemoveParameterByName("sub2") clsManipulationFirstDOYPerYear.RemoveParameterByName("sub3") - clsManipulationFirstDOYPerYear.RemoveParameterByName("sub4") - clsManipulationFirstDOYPerYear.RemoveParameterByName("sub5") clsFirstDOYPerYear.RemoveParameterByName("type") clsFirstDOYPerYear.RemoveParameterByName("function_exp") clsFirstDOYPerYear.RemoveParameterByName("calculated_from") @@ -362,7 +377,5 @@ Public Class dlgStartofRains Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk frmMain.clsRLink.RunScript(clsAddKey.ToScript, strComment:="Start of Rains: Defining Date column as key") - clsApplyRainDays.AddParameter("calc", clsRFunctionParameter:=clsRainyDays) - frmMain.clsRLink.RunScript(clsApplyRainDays.ToScript, strComment:="Start of Rains: Creating rain_day column") End Sub End Class \ No newline at end of file From 6a97b39e600d06533f823da6e88d0452ba25b604 Mon Sep 17 00:00:00 2001 From: lilyclements Date: Fri, 20 Jan 2017 11:25:11 +0000 Subject: [PATCH 19/72] Update dlgStartofRains.vb --- instat/dlgStartofRains.vb | 191 ++++++++++++++++++++++++++++---------- 1 file changed, 143 insertions(+), 48 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index d013df4c370..d57a53ad9e9 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -12,10 +12,10 @@ ' ' You should have received a copy of the GNU General Public License k ' along with this program. If not, see . -Imports instat.Translations +Imports instat.Translations Public Class dlgStartofRains Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsDryPeriodTen, clsWithinThirtyDays, clsDrySpell, clsYearGroupDaily, clsManipulationFirstDOYPerYear As New RFunction - Public clsDryPeriodTenList, clsSubRainDays1, clsSubRainDays2, clsCombinedFilter, clsCombinedList As New RFunction + Public clsDryPeriodTenList, clsSubRainDays1, clsSubRainDays2, clsCombinedFilter, clsCombinedList, clsWetSpell, clsWetSpellList As New RFunction Private strCurrDataName As String = "" Public bFirstLoad As Boolean = True Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -27,7 +27,7 @@ Public Class dlgStartofRains Else ReopenDialog() End If - TestOKEnabled() + TestOKEnabled() End Sub Private Sub ucrReceiverDOY_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDOY.SelectionChanged @@ -72,6 +72,10 @@ Public Class dlgStartofRains clsCombinedList.SetRCommand("list") clsManipulationFirstDOYPerYear.SetRCommand("list") clsDryPeriodTenList.SetRCommand("list") + clsWetSpellList.SetRFunction("list") + clsWetSpell.SetRFunction("instat_calculation$new") + clsWetSpell.SetAssignTo("Wet_Spell") + clsCombinedFilter.SetRCommand("instat_calculation$new") clsCombinedFilter.SetAssignTo("combined_filter") @@ -81,8 +85,13 @@ Public Class dlgStartofRains ucrReceiverDate.Selector = ucrSelectorForStartofRains ucrReceiverDOY.Selector = ucrSelectorForStartofRains ucrReceiverDate.SetMeAsReceiver() - End Sub - + + nudPercentile.Minimum = 0 + nudPercentile.Maximum = 1 + nudPercentile.DecimalPlaces = 2 + nudPercentile.Increments = 0.1 + End Sub + Private Sub SetDefaults() ucrSelectorForStartofRains.Reset() chkConsecutiveRainyDays.Checked = False @@ -91,6 +100,7 @@ Public Class dlgStartofRains CheckBoxesSetting() TestOKEnabled() nudValue.Value = 20 + nudPercentile.Value = 0.8 nudMinimum.Value = 1 nudMaximumDays.Value = 10 nudLengthofTime.Value = 30 @@ -99,8 +109,9 @@ Public Class dlgStartofRains nudThreshold.Value = 0.85 nudFrom.Value = 1 nudTo.Value = 366 - End Sub - + rdoAmount.Checked = True + End Sub + Private Sub ReopenDialog() End Sub @@ -123,17 +134,26 @@ Public Class dlgStartofRains TestOKEnabled() End Sub - Private Sub grpConditionsForSatrtofRains_Enter(sender As Object, e As EventArgs) Handles nudValue.TextChanged, nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged, nudOverDays.TextChanged, nudOutOfDays.TextChanged + Private Sub grpConditionsForStartofRains_Enter(sender As Object, e As EventArgs) Handles nudValue.TextChanged, nudPercentile.TextChanged nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged, nudOverDays.TextChanged, nudOutOfDays.TextChanged RainyDaysMethod() DayFromAndToMethod() CombinedFilter() RollingOfRainDays() DrySpell() RollingSumMethod() + WetSpell() + TestOKEnabled() + End Sub + + Private rdoAmountAndPercentile_Changed (sender As Object, e As EventArgs) Handles rdoAmount.CheckedChanged, rdoPercentile.CheckedChanged + CheckBoxesSetting() + CombinedFilter() + RollingSumMethod() + WetSpell() TestOKEnabled() End Sub - Private Sub grpConditionsForSatrtofRains1_Enter(sender As Object, e As EventArgs) Handles chkConsecutiveRainyDays.CheckedChanged, chkTotalRainfall.CheckedChanged, chkDrySpell.CheckedChanged + Private Sub grpConditionsForStartofRains1_Enter(sender As Object, e As EventArgs) Handles chkConsecutiveRainyDays.CheckedChanged, chkTotalRainfall.CheckedChanged, chkDrySpell.CheckedChanged CheckBoxesSetting() DrySpell() RainyDaysMethod() @@ -160,12 +180,21 @@ Public Class dlgStartofRains Private Sub CheckBoxesSetting() If chkTotalRainfall.Checked Then - nudValue.Visible = True nudOverDays.Visible = True - lblVal.Visible = True + lblVal.Visible = True ' need to move this around, change the text of it too. lblOverDays.Visible = True + If rdoAmount.Checked Then + nudValue.Visible = True + nudPercentile.Visible = False + ElseIf rdoPercentile.Checked Then + nudValue.Visible = False + nudPercentile.Visible = True + Else + nudValue.Visible = False + nudPercentile.Visible = False Else nudValue.Visible = False + nudPercentile.Visible = False nudOverDays.Visible = False lblVal.Visible = False lblOverDays.Visible = False @@ -247,6 +276,25 @@ Public Class dlgStartofRains End If End Sub + ' If we have 'Percentile' checked + Private Sub WetSpell() + If rdoPercentile.checked Then + clsWetSpell.AddParameter("type", chr(34) & "type" & chr(34)) + clsWetSpell.AddParameter("function_exp", chr(34) & "quantile(roll_rain_7_days, c(" nudPercentile.Value "), na.rm=T" + clsWetSpell.AddParameter("result_name", chr(34) & "wet_spell" & chr(34)) + clsWetSpell.AddParameter("sub_calculations", clsRFunctionParameter := clsWetSpellList) + clsWetSpellList.AddParameter("sub1", clsRFunctionParameter := clsRollingSum, bIncludeArgumentName = False) + clsWetSpell.AddParameter("save", "0") + Else + clsWetSpell.AddParameter("type") + clsWetSpell.RemoveParameterByName("function_exp") + clsWetSpell.RemoveParameterByName("result_name") + clsWetSpell.RemoveParameterByName("sub_calculations") + clsWetSpellList.RemoveParameterByName("sub1") + clsWetSpell.RemoveParameterByName("save") + End If + End Sub + Private Sub RollingOfRainDays() ' If rolling of rain days one is checked Then clsRollingRainDays.AddParameter("type", Chr(34) & "calculation" & Chr(34)) @@ -295,48 +343,93 @@ Public Class dlgStartofRains ' Run with all first, then sort out to separate bits. ' do six if statements for now - If chkConsecutiveRainyDays.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= 1 & Rain>0.85" & Chr(34)) - clsCombinedList.AddParameter("sub2", clsRFunctionParameter:=clsRollingRainDays, bIncludeArgumentName:=False) - clsCombinedList.RemoveParameterByName("sub1") - clsCombinedList.RemoveParameterByName("sub3") - - ElseIf chkTotalRainfall.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "roll_sum_Rain >20 & Rain>0.85" & Chr(34)) - clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) - clsCombinedList.RemoveParameterByName("sub2") - clsCombinedList.RemoveParameterByName("sub1") - - ElseIf chkDrySpell.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & Rain>0.85" & Chr(34)) - clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) - clsCombinedList.RemoveParameterByName("sub2") - clsCombinedList.RemoveParameterByName("sub3") - - ElseIf chkConsecutiveRainyDays.Checked AndAlso chkTotalRainfall.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= 1 & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) - clsCombinedList.AddParameter("sub2", clsRFunctionParameter:=clsRollingRainDays, bIncludeArgumentName:=False) - clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) - clsCombinedList.RemoveParameterByName("sub1") - - ElseIf chkConsecutiveRainyDays.Checked AndAlso chkDrySpell.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & Rolling_Rain_Days >= 1 & Rain>0.85" & Chr(34)) - clsCombinedList.AddParameter("sub2", clsRFunctionParameter:=clsRollingRainDays, bIncludeArgumentName:=False) - clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) - clsCombinedList.RemoveParameterByName("sub3") - - ElseIf chkConsecutiveRainyDays.Checked AndAlso chkTotalRainfall.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) - clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) - clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) - clsCombinedList.RemoveParameterByName("sub2") - Else + If chkConsecutiveRainyDays.Checked AndAlso chkTotalRainfall.Checked AndAlso chkDrySpell.Checked Then + clsCombinedFilter.RemoveParameterByName("function_exp") + If rdoAmount.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & Rolling_Rain_Days >= 1 & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) + clsCombinedList.RemoveParameterByName("sub4") + ElseIf rdoPercentile.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & Rolling_Rain_Days >= 1 & roll_sum_Rain > wet_spell & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub4", clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) + End If + clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) + clsCombinedList.AddParameter("sub2", clsRFunctionParameter := clsRollingRainDays, bIncludeArgumentName := False) + + + ElseIf chkTotalRainfall.Checked AndAlso chkDrySpell.Checked Then + clsCombinedFilter.RemoveParameterByName("function_exp") + + If rdoAmount.Checked then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) + clsCombinedList.RemoveParameterByName("sub4") + ElseIf rdoPercentile.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & roll_sum_Rain >wet_spell & Rain>0.85" & Chr(34))clsCombinedList.AddParameter(“sub4”, clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) + clsCombinedList.AddParameter("sub4", clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) + End If + clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) + clsCombinedList.RemoveParameterByName("sub2") + + + + ElseIf chkConsecutiveRainyDays.Checked AndAlso chkDrySpell.Checked Then + clsCombinedFilter.RemoveParameterByName("function_exp") + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & Rolling_Rain_Days >= 1 & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + clsCombinedList.RemoveParameterByName("sub3") + clsCombinedList.AddParameter("sub2", clsRFunctionParameter := clsRollingRainDays, bIncludeArgumentName := False) + + + ElseIf chkConsecutiveRainyDays.Checked AndAlso chkTotalRainfall.Checked Then + clsCombinedFilter.RemoveParameterByName("function_exp") + If rdoAmount.checked then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= 1 & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) + clsCombinedList.RemoveParameterByName("sub4") + ElseIf rdoPercentile.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= 1 & roll_sum_Rain > wet_spell & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub4", clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) + End If + clsCombinedList.RemoveParameterByName("sub1") + clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) + clsCombinedList.AddParameter("sub2", clsRFunctionParameter := clsRollingRainDays, bIncludeArgumentName := False) + + ElseIf chkConsecutiveRainyDays.Checked Then + clsCombinedFilter.RemoveParameterByName("function_exp") + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= 1 & Rain>0.85" & Chr(34)) + clsCombinedList.RemoveParameterByName("sub1") + clsCombinedList.RemoveParameterByName("sub3") + clsCombinedList.AddParameter("sub2", clsRFunctionParameter := clsRollingRainDays, bIncludeArgumentName := False) + + ElseIf chkTotalRainfall.Checked Then + clsCombinedFilter.RemoveParameterByName("function_exp") + If rdoAmount.Checked then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & " roll_sum_Rain >20 & Rain>0.85" & Chr(34)) + clsCombinedList.RemoveParameterByName("sub4") + ElseIf rdoPercentile.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & " roll_sum_Rain > wet_spell & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub4", clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) + End If + + clsCombinedList.RemoveParameterByName("sub1") + clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) + clsCombinedList.RemoveParameterByName("sub2") + + ElseIf chkDrySpell.Checked Then + clsCombinedFilter.RemoveParameterByName("function_exp") + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + clsCombinedList. RemoveParameterByName("sub3") + clsCombinedList. RemoveParameterByName("sub2") + + Else clsCombinedFilter.RemoveParameterByName("function_exp") clsCombinedFilter.RemoveParameterByName("type") clsCombinedFilter.RemoveParameterByName("sub_calculations") clsCombinedList.RemoveParameterByName("sub1") clsCombinedList.RemoveParameterByName("sub2") clsCombinedList.RemoveParameterByName("sub3") + clsCombinedList.RemoveParameterByName("sub4") End If End Sub @@ -378,4 +471,6 @@ Public Class dlgStartofRains Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk frmMain.clsRLink.RunScript(clsAddKey.ToScript, strComment:="Start of Rains: Defining Date column as key") End Sub -End Class \ No newline at end of file + + Private Sub +End Class From 72b6cf4b5ae3ce97f85eda34c9001420aef5315d Mon Sep 17 00:00:00 2001 From: lilyclements Date: Fri, 20 Jan 2017 11:41:55 +0000 Subject: [PATCH 20/72] Update dlgStartofRains.vb --- instat/dlgStartofRains.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index d57a53ad9e9..05d0a9a302b 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -117,7 +117,7 @@ Public Class dlgStartofRains End Sub Private Sub TestOKEnabled() - If Not ucrReceiverRainfall.IsEmpty AndAlso Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverDOY.IsEmpty AndAlso Not ucrReceiverYear.IsEmpty AndAlso nudThreshold.Text <> "" AndAlso nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso ((chkConsecutiveRainyDays.Checked AndAlso nudMinimum.Text <> "" AndAlso nudOutOfDays.Text <> "") OrElse Not chkConsecutiveRainyDays.Checked) AndAlso ((chkTotalRainfall.Checked AndAlso nudValue.Text <> "" AndAlso nudOverDays.Text <> "") OrElse Not chkTotalRainfall.Checked) AndAlso ((chkDrySpell.Checked AndAlso nudMaximumDays.Text <> "" AndAlso nudLengthofTime.Text <> "") OrElse Not chkDrySpell.Checked) Then + If Not ucrReceiverRainfall.IsEmpty AndAlso Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverDOY.IsEmpty AndAlso Not ucrReceiverYear.IsEmpty AndAlso nudThreshold.Text <> "" AndAlso nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso ((chkConsecutiveRainyDays.Checked AndAlso nudMinimum.Text <> "" AndAlso nudOutOfDays.Text <> "") OrElse Not chkConsecutiveRainyDays.Checked) AndAlso (((chkTotalRainfall.Checked AndAlso nudOverDays.Text <> "") AndAlso ((rdoAmount.Checked AndAlso nudValue.Text <> "") OrElse (rdoPercentile.Checked AndAlso nudPercentile.Text <> ""))) OrElse Not chkTotalRainfall.Checked) AndAlso ((chkDrySpell.Checked AndAlso nudMaximumDays.Text <> "" AndAlso nudLengthofTime.Text <> "") OrElse Not chkDrySpell.Checked) Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) From 19fb5ad7d96e2add2639e242474a706d11dcbdd9 Mon Sep 17 00:00:00 2001 From: lilyclements Date: Fri, 20 Jan 2017 13:27:38 +0000 Subject: [PATCH 21/72] Update dlgStartofRains.vb --- instat/dlgStartofRains.vb | 80 +++++++++++++++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 7 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 05d0a9a302b..fe63ce3ba97 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -117,7 +117,7 @@ Public Class dlgStartofRains End Sub Private Sub TestOKEnabled() - If Not ucrReceiverRainfall.IsEmpty AndAlso Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverDOY.IsEmpty AndAlso Not ucrReceiverYear.IsEmpty AndAlso nudThreshold.Text <> "" AndAlso nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso ((chkConsecutiveRainyDays.Checked AndAlso nudMinimum.Text <> "" AndAlso nudOutOfDays.Text <> "") OrElse Not chkConsecutiveRainyDays.Checked) AndAlso (((chkTotalRainfall.Checked AndAlso nudOverDays.Text <> "") AndAlso ((rdoAmount.Checked AndAlso nudValue.Text <> "") OrElse (rdoPercentile.Checked AndAlso nudPercentile.Text <> ""))) OrElse Not chkTotalRainfall.Checked) AndAlso ((chkDrySpell.Checked AndAlso nudMaximumDays.Text <> "" AndAlso nudLengthofTime.Text <> "") OrElse Not chkDrySpell.Checked) Then + If Not ucrReceiverRainfall.IsEmpty AndAlso Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverDOY.IsEmpty AndAlso Not ucrReceiverYear.IsEmpty AndAlso nudThreshold.Text <> "" AndAlso nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso ((chkConsecutiveRainyDays.Checked AndAlso nudMinimum.Text <> "" AndAlso nudOutOfDays.Text <> "") OrElse Not chkConsecutiveRainyDays.Checked) AndAlso (((chkTotalRainfall.Checked AndAlso nudOverDays.Text <> "") AndAlso ((rdoAmount.Checked AndAlso nudValue.Text <> "") OrElse (rdoPercentile.Checked AndAlso nudPercentile.Text <> ""))) OrElse Not chkTotalRainfall.Checked) AndAlso ((chkDrySpell.Checked AndAlso nudMaximumDays.Text <> "" AndAlso nudLengthofTime.Text <> "") OrElse Not chkDrySpell.Checked) AndAlso ((chkDryPeriod.Checked AndAlso nudDryPeriodRainPeriod.Text <> "" AndAlso nudDryPeriodMaxRain.Text <> "" AndAlso nudDryPeriodOverallInterval.Text <> "") OrElse Not chkDryPeriod.Checked) Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -133,6 +133,13 @@ Public Class dlgStartofRains RainyDaysMethod() TestOKEnabled() End Sub + + Private Sub DryPeriod(sender As Object, e As EventArgs) Handles nudDryPeriodRainPeriod.TextChanged, nudDryPeriodInterval.TextChanged, nudDryPeriodMaxRain.TextChanged + DryPeriodRainPeriod() + DryPeriodAboveThreshold() + DryPeriodOverallInterval() + TestOKEnabled() + End Sub Private Sub grpConditionsForStartofRains_Enter(sender As Object, e As EventArgs) Handles nudValue.TextChanged, nudPercentile.TextChanged nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged, nudOverDays.TextChanged, nudOutOfDays.TextChanged RainyDaysMethod() @@ -165,6 +172,9 @@ Public Class dlgStartofRains Private Sub ucrReceiverRainfall_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverRainfall.SelectionChanged RainyDaysMethod() RollingSumMethod() + DryPeriodRainPeriod() + DryPeriodAboveThreshold() + DryPeriodOverallInterval() TestOKEnabled() End Sub @@ -279,14 +289,14 @@ Public Class dlgStartofRains ' If we have 'Percentile' checked Private Sub WetSpell() If rdoPercentile.checked Then - clsWetSpell.AddParameter("type", chr(34) & "type" & chr(34)) + clsWetSpell.AddParameter("type", chr(34) & "calculation" & chr(34)) clsWetSpell.AddParameter("function_exp", chr(34) & "quantile(roll_rain_7_days, c(" nudPercentile.Value "), na.rm=T" clsWetSpell.AddParameter("result_name", chr(34) & "wet_spell" & chr(34)) clsWetSpell.AddParameter("sub_calculations", clsRFunctionParameter := clsWetSpellList) clsWetSpellList.AddParameter("sub1", clsRFunctionParameter := clsRollingSum, bIncludeArgumentName = False) clsWetSpell.AddParameter("save", "0") Else - clsWetSpell.AddParameter("type") + clsWetSpell.RemoveParameterByName("type") clsWetSpell.RemoveParameterByName("function_exp") clsWetSpell.RemoveParameterByName("result_name") clsWetSpell.RemoveParameterByName("sub_calculations") @@ -333,8 +343,65 @@ Public Class dlgStartofRains clsDryPeriodTen.RemoveParameterByName("save") clsDryPeriodTenList.RemoveParameterByName("sub1") End If - End Sub + + + Private Sub DryPeriodRainPeriod() + If Not ucrReceiverRainfall.IsEmpty Then + clsDPRainInDays.AddParameter("type", chr(34) & "calculation" & chr(34)) + clsDPRainInDays.AddParameter("function_exp", Chr(34) & "rollapply(data = " & ucrReceiverRainfall.GetVariableNames(False) & " ,width = " & nud.DryPeriodRainPeriod & ", FUN = sum, na.rm = FALSE, align='left', fill=NA)" & Chr(34)) + clsDPRainInDays.AddParameter("result_name", chr(34) & "Rain_in_Days" & chr(34)) + clsDPRainInDays.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverRainfall.GetVariableNames & ")") + clsDPRainInDays.AddParameter("save", "0") + Else + clsDPRainInDays.RemoveParameterByName("type") + clsDPRainInDays.RemoveParameterByName("function_exp") + clsDPRainInDays.RemoveParameterByName("result_name") + clsDPRainInDays.RemoveParameterByName("calculated_from") + clsDPRainInDays.RemoveParameterByName("save") + End If + End Sub + + + Private Sub DryPeriodAboveThreshold() + ' If this value is above 40mm, then give it a 0. Otherwise, give it a 1. (i.e., if there is a 20 day period of under 40mm of rain, it is "1") + + If ((Not ucrReceiverRainfall.IsEmpty) AndAlso (nudDryPeriodMaxRain <> "")) Then + clsDPRain.AddParameter("type", Chr(34) & "calculation" & Chr(34)) + clsDPRain.AddParameter("function_exp", Chr(34) & "match( Rain_in_Days <=" & nudDryPeriodMaxRain.Value & ", 1, nomatch = 0)" & Chr(34)) + clsDPRain.AddParameter("result_name", Chr(34) & "Above_Threshold" & Chr(34)) + clsDPRain.AddParameter("sub_calculations", clsRFunctionParameter:=clsDPRainList) + clsDPRainList.AddParameter("sub1", clsRFunctionParameter:=clsDPRainInDays, bIncludeArgumentName:=False) + clsDPRain.AddParameter("save", 2) + ' clsSubRainDays.AddParameter("sub1", clsRFunctionParameter:=clsRainyDays, bIncludeArgumentName:=False) + Else + clsDPRain.RemoveParameterByName("type") + clsDPRain.RemoveParameterByName("function_exp") + clsDPRain.RemoveParameterByName("result_name") + clsDPRain.RemoveParameterByName("sub_calculations") + clsDPRainList.RemoveParameterByName("sub1") + clsDPRain.RemoveParameterByName("save") + End If + End Sub + + Private Sub DryPeriodOverallInterval() + ' # Rolling sum of that ^ of a 45 day period (i.e., for the next 45 days, how many times does rainfall over 20 days not reach 40mm?) + If Not ucrReceiverRainfall.IsEmpty Then + DPOverallInterval.AddParameter("type", chr(34) & "calculation" & chr(34)) + DPOverallIntervalAddParameter("function_exp", Chr(34) & "rollapply(data = Above_Threshold ,width = (" & nud.DryPeriodInterval.Value & "-" & nudDryPeriodRainPeriod.Value & "+ 1), FUN = sum, na.rm = FALSE, align='left', fill=NA)" & Chr(34)) + DPOverallInterval.AddParameter("result_name", chr(34) & "DP_Overall_Interval_Rain" & chr(34)) + DPOverallInterval.AddParameter("sub_calculations", clsRFunctionParameter:=clsDPOverallIntervalList) + DPOverallIntervalList.AddParameter("sub1", clsRFunctionParameter:=clsDPRain, bIncludeArgumentName:=False) + DPOverallInterval.AddParameter("save", "2") + Else + DPOverallInterval.RemoveParameterByName("type") + DPOverallInterval.RemoveParameterByName("function_exp") + DPOverallInterval.RemoveParameterByName("result_name") + DPOverallInterval.RemoveParameterByName("sub_calculations") + DPOverallIntervalList.RemoveParameterByName("sub1") + DPOverallInterval.RemoveParameterByName("save") + End If + End Sub Private Sub CombinedFilter() clsCombinedFilter.AddParameter("type", Chr(34) & "filter" & Chr(34)) @@ -471,6 +538,5 @@ Public Class dlgStartofRains Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk frmMain.clsRLink.RunScript(clsAddKey.ToScript, strComment:="Start of Rains: Defining Date column as key") End Sub - - Private Sub -End Class + + End Class From e3d7f2eb2ceacfc2eb59b88eb096b4cd9b8c3507 Mon Sep 17 00:00:00 2001 From: lilyclements Date: Fri, 20 Jan 2017 13:40:59 +0000 Subject: [PATCH 22/72] Update dlgStartofRains.vb --- instat/dlgStartofRains.vb | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index fe63ce3ba97..1ced0c9dffe 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -15,7 +15,7 @@ Imports instat.Translations Public Class dlgStartofRains Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsDryPeriodTen, clsWithinThirtyDays, clsDrySpell, clsYearGroupDaily, clsManipulationFirstDOYPerYear As New RFunction - Public clsDryPeriodTenList, clsSubRainDays1, clsSubRainDays2, clsCombinedFilter, clsCombinedList, clsWetSpell, clsWetSpellList As New RFunction + Public clsDryPeriodTenList, clsSubRainDays1, clsSubRainDays2, clsCombinedFilter, clsCombinedList, clsWetSpell, clsWetSpellList, clsDPOverallInterval, clsDPOverallIntervalList, clsDPRain, clsDPRainList, clsDPRainInDays As New RFunction Private strCurrDataName As String = "" Public bFirstLoad As Boolean = True Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -90,6 +90,16 @@ Public Class dlgStartofRains nudPercentile.Maximum = 1 nudPercentile.DecimalPlaces = 2 nudPercentile.Increments = 0.1 + + clsDPOverallInterval.SetRCommand("instat_calculation$new") + clsDPOverallInterval.SetAssignTo("Overall_Interval") + clsDPRain.SetRCommand("instat_calculation$new") + clsDPRain.SetAssignTo("Above_Threshold") + clsDPRainInDays.SetRCommand("instat_calculation$new") + clsDPRainInDays.SetAssignTo("Rain_Period_Length") + + clsDPOverallIntervalList.SetRCommand("list") + clsDPRainList.SetRCommand("list") End Sub Private Sub SetDefaults() @@ -361,7 +371,6 @@ Public Class dlgStartofRains clsDPRainInDays.RemoveParameterByName("save") End If End Sub - Private Sub DryPeriodAboveThreshold() ' If this value is above 40mm, then give it a 0. Otherwise, give it a 1. (i.e., if there is a 20 day period of under 40mm of rain, it is "1") @@ -372,7 +381,7 @@ Public Class dlgStartofRains clsDPRain.AddParameter("result_name", Chr(34) & "Above_Threshold" & Chr(34)) clsDPRain.AddParameter("sub_calculations", clsRFunctionParameter:=clsDPRainList) clsDPRainList.AddParameter("sub1", clsRFunctionParameter:=clsDPRainInDays, bIncludeArgumentName:=False) - clsDPRain.AddParameter("save", 2) + clsDPRain.AddParameter("save", 0) ' clsSubRainDays.AddParameter("sub1", clsRFunctionParameter:=clsRainyDays, bIncludeArgumentName:=False) Else clsDPRain.RemoveParameterByName("type") @@ -387,19 +396,19 @@ Public Class dlgStartofRains Private Sub DryPeriodOverallInterval() ' # Rolling sum of that ^ of a 45 day period (i.e., for the next 45 days, how many times does rainfall over 20 days not reach 40mm?) If Not ucrReceiverRainfall.IsEmpty Then - DPOverallInterval.AddParameter("type", chr(34) & "calculation" & chr(34)) - DPOverallIntervalAddParameter("function_exp", Chr(34) & "rollapply(data = Above_Threshold ,width = (" & nud.DryPeriodInterval.Value & "-" & nudDryPeriodRainPeriod.Value & "+ 1), FUN = sum, na.rm = FALSE, align='left', fill=NA)" & Chr(34)) - DPOverallInterval.AddParameter("result_name", chr(34) & "DP_Overall_Interval_Rain" & chr(34)) - DPOverallInterval.AddParameter("sub_calculations", clsRFunctionParameter:=clsDPOverallIntervalList) - DPOverallIntervalList.AddParameter("sub1", clsRFunctionParameter:=clsDPRain, bIncludeArgumentName:=False) - DPOverallInterval.AddParameter("save", "2") + clsDPOverallInterval.AddParameter("type", chr(34) & "calculation" & chr(34)) + clsDPOverallInterval("function_exp", Chr(34) & "rollapply(data = Above_Threshold ,width = (" & nud.DryPeriodInterval.Value & "-" & nudDryPeriodRainPeriod.Value & "+ 1), FUN = sum, na.rm = FALSE, align='left', fill=NA)" & Chr(34)) + clsDPOverallInterval.AddParameter("result_name", chr(34) & "DP_Overall_Interval_Rain" & chr(34)) + clsDPOverallInterval.AddParameter("sub_calculations", clsRFunctionParameter:=clsDPOverallIntervalList) + clsDPOverallIntervalList.AddParameter("sub1", clsRFunctionParameter:=clsDPRain, bIncludeArgumentName:=False) + clsDPOverallInterval.AddParameter("save", "2") Else - DPOverallInterval.RemoveParameterByName("type") - DPOverallInterval.RemoveParameterByName("function_exp") - DPOverallInterval.RemoveParameterByName("result_name") - DPOverallInterval.RemoveParameterByName("sub_calculations") - DPOverallIntervalList.RemoveParameterByName("sub1") - DPOverallInterval.RemoveParameterByName("save") + clsDPOverallInterval.RemoveParameterByName("type") + clsDPOverallInterval.RemoveParameterByName("function_exp") + clsDPOverallInterval.RemoveParameterByName("result_name") + clsDPOverallInterval.RemoveParameterByName("sub_calculations") + clsDPOverallInterval.RemoveParameterByName("sub1") + clsDPOverallInterval.RemoveParameterByName("save") End If End Sub From 463bc031c73efb5569f6b913c12796594c572d46 Mon Sep 17 00:00:00 2001 From: lilyclements Date: Fri, 20 Jan 2017 15:03:56 +0000 Subject: [PATCH 23/72] Update dlgStartofRains.vb --- instat/dlgStartofRains.vb | 56 +++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 1ced0c9dffe..7adb16d5e39 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -14,7 +14,7 @@ ' along with this program. If not, see . Imports instat.Translations Public Class dlgStartofRains - Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsXdaysRain, clsFirstDOYPerYear, clsDryPeriodTen, clsWithinThirtyDays, clsDrySpell, clsYearGroupDaily, clsManipulationFirstDOYPerYear As New RFunction + Public clsAddKey, clsDayFromAndTo, clsRainyDays, clsRollingSum, clsMinimumRainfall, clsRollingRainDays, clsFirstDOYPerYear, clsDryPeriodTen, clsWithinThirtyDays, clsDrySpell, clsYearGroupDaily, clsManipulationFirstDOYPerYear As New RFunction Public clsDryPeriodTenList, clsSubRainDays1, clsSubRainDays2, clsCombinedFilter, clsCombinedList, clsWetSpell, clsWetSpellList, clsDPOverallInterval, clsDPOverallIntervalList, clsDPRain, clsDPRainList, clsDPRainInDays As New RFunction Private strCurrDataName As String = "" Public bFirstLoad As Boolean = True @@ -56,8 +56,6 @@ Public Class dlgStartofRains clsMinimumRainfall.SetAssignTo("Minimum_Rainfall") clsRollingRainDays.SetRCommand("instat_calculation$new") clsRollingRainDays.SetAssignTo("Rolling_rain") - clsXdaysRain.SetRCommand("instat_calculation$new") - clsXdaysRain.SetAssignTo("x_Days_Rain") clsFirstDOYPerYear.SetRCommand("instat_calculation$new") clsFirstDOYPerYear.SetAssignTo("First_doy_per_year") clsDryPeriodTen.SetRCommand("instat_calculation$new") @@ -107,6 +105,7 @@ Public Class dlgStartofRains chkConsecutiveRainyDays.Checked = False chkDrySpell.Checked = False chkTotalRainfall.Checked = False + chkDryPeriod.Checked = False CheckBoxesSetting() TestOKEnabled() nudValue.Value = 20 @@ -120,6 +119,9 @@ Public Class dlgStartofRains nudFrom.Value = 1 nudTo.Value = 366 rdoAmount.Checked = True + nudDryPeriodMaxRain.Value = "40" + nudDryPeriodRainPeriod.Value = "30" + nudDryPeriodOverallInterval.Value = "45" End Sub Private Sub ReopenDialog() @@ -241,8 +243,34 @@ Public Class dlgStartofRains lblMinimum.Visible = False lblWidth.Visible = False End If + If chkDrySpell.Checked then + nudDryPeriodRainPeriod.Visible = True + nudDryPeriodMaxRain.Visible = True + nudDryPeriodOverallInterval.Visible = True + lblDryPeriodRainPeriod.Visible = True + lblDryPeriodMaxRain.Visible = True + lblDryPeriodOverallInterval.Visible = True + Else + nudDryPeriodRainPeriod.Visible = False + nudDryPeriodMaxRain.Visible = False + nudDryPeriodOverallInterval.Visible = False + lblDryPeriodRainPeriod.Visible = False + lblDryPeriodMaxRain.Visible = False + lblDryPeriodOverallInterval.Visible = False End Sub - + + ' nud max and mins. + Private Sub nudValues() + nudDryPeriodRainPeriod.Maximum = nudDryPeriodOverallInterval.Value - 1 + nudDryPeriodOverallInterval.Minimum = nudDryPeriodRainPeriod.Value + 1 + nudMinimum.Maximum = nudOutofDays.Value - 1 + nudOutofDays.Minimum = nudMinimum.Value + 1 + nudFrom.Maximum = nudTo.Value - 1 + nudTo.Minimum = nudFrom.Value + 1 + nudMaximumDays.Maximum = nudLengthOfTime.Value - 1 + nudLengthOfTime.Minimum = nudMaximumDays + 1 + End Sub + Private Sub AddKeyMethod() If Not ucrReceiverDate.IsEmpty Then clsAddKey.AddParameter("col_name", ucrReceiverDate.GetVariableNames) @@ -335,7 +363,7 @@ Public Class dlgStartofRains clsDrySpell.AddParameter("save", 0) clsDryPeriodTen.AddParameter("type", Chr(34) & "calculation" & Chr(34)) clsDryPeriodTen.AddParameter("function_exp", Chr(34) & "rollapply(data = Dry_Spell, width=" & nudLengthofTime.Value & ", FUN=max, na.rm = FALSE, align='right', fill=NA)" & Chr(34)) - clsDryPeriodTen.AddParameter("result_name", Chr(34) & "Dry_Period" & Chr(34)) + clsDryPeriodTen.AddParameter("result_name", Chr(34) & "Dry_Spell" & Chr(34)) clsDryPeriodTen.AddParameter("sub_calculations", clsRFunctionParameter:=clsDryPeriodTenList) clsDryPeriodTenList.AddParameter("sub1", clsRFunctionParameter:=clsDrySpell, bIncludeArgumentName:=False) clsDryPeriodTen.AddParameter("save", 2) @@ -422,10 +450,10 @@ Public Class dlgStartofRains If chkConsecutiveRainyDays.Checked AndAlso chkTotalRainfall.Checked AndAlso chkDrySpell.Checked Then clsCombinedFilter.RemoveParameterByName("function_exp") If rdoAmount.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & Rolling_Rain_Days >= 1 & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell < "& Chr(34) & nudMaximumDays.Value & Chr(34) & "& Rolling_Rain_Days >=" & Chr(34) & nudMinimum.Value & Chr(34) & "roll_sum_Rain >20 & Rain>0.85" & Chr(34)) clsCombinedList.RemoveParameterByName("sub4") ElseIf rdoPercentile.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & Rolling_Rain_Days >= 1 & roll_sum_Rain > wet_spell & Rain>0.85" & Chr(34)) + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <"& Chr(34) & nudMaximumDays.Value & Chr(34) & "& Rolling_Rain_Days >= 1" & Chr(34) & nudMinimum.Value & Chr(34) & "roll_sum_Rain > wet_spell & Rain>0.85" & Chr(34)) clsCombinedList.AddParameter("sub4", clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) End If clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) @@ -437,10 +465,10 @@ Public Class dlgStartofRains clsCombinedFilter.RemoveParameterByName("function_exp") If rdoAmount.Checked then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <"& Chr(34) & nudMaximumDays.Value & Chr(34) & " & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) clsCombinedList.RemoveParameterByName("sub4") ElseIf rdoPercentile.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & roll_sum_Rain >wet_spell & Rain>0.85" & Chr(34))clsCombinedList.AddParameter(“sub4”, clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <"& Chr(34) & nudMaximumDays.Value & Chr(34) & " & roll_sum_Rain >wet_spell & Rain>0.85" & Chr(34))clsCombinedList.AddParameter(“sub4”, clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) clsCombinedList.AddParameter("sub4", clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) End If clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) @@ -451,7 +479,7 @@ Public Class dlgStartofRains ElseIf chkConsecutiveRainyDays.Checked AndAlso chkDrySpell.Checked Then clsCombinedFilter.RemoveParameterByName("function_exp") - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & Rolling_Rain_Days >= 1 & Rain>0.85" & Chr(34)) + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <"& Chr(34) & nudMaximumDays.Value & Chr(34) & " & Rolling_Rain_Days >= " & Chr(34) & nudMinimum.Value & Chr(34) & " & Rain>0.85" & Chr(34)) clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) clsCombinedList.RemoveParameterByName("sub3") clsCombinedList.AddParameter("sub2", clsRFunctionParameter := clsRollingRainDays, bIncludeArgumentName := False) @@ -460,10 +488,10 @@ Public Class dlgStartofRains ElseIf chkConsecutiveRainyDays.Checked AndAlso chkTotalRainfall.Checked Then clsCombinedFilter.RemoveParameterByName("function_exp") If rdoAmount.checked then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= 1 & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= " & Chr(34) & nudMinimum.Value & Chr(34) & " & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) clsCombinedList.RemoveParameterByName("sub4") ElseIf rdoPercentile.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= 1 & roll_sum_Rain > wet_spell & Rain>0.85" & Chr(34)) + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= " & Chr(34) & nudMinimum.Value & Chr(34) & " & roll_sum_Rain > wet_spell & Rain>0.85" & Chr(34)) clsCombinedList.AddParameter("sub4", clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) End If clsCombinedList.RemoveParameterByName("sub1") @@ -472,7 +500,7 @@ Public Class dlgStartofRains ElseIf chkConsecutiveRainyDays.Checked Then clsCombinedFilter.RemoveParameterByName("function_exp") - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= 1 & Rain>0.85" & Chr(34)) + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= " & Chr(34) & nudMinimum.Value & Chr(34) & " & Rain>0.85" & Chr(34)) clsCombinedList.RemoveParameterByName("sub1") clsCombinedList.RemoveParameterByName("sub3") clsCombinedList.AddParameter("sub2", clsRFunctionParameter := clsRollingRainDays, bIncludeArgumentName := False) @@ -493,7 +521,7 @@ Public Class dlgStartofRains ElseIf chkDrySpell.Checked Then clsCombinedFilter.RemoveParameterByName("function_exp") - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Period <30 & Rain>0.85" & Chr(34)) + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <"& Chr(34) & nudMaximumDays.Value & Chr(34) & " & Rain>0.85" & Chr(34)) clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) clsCombinedList. RemoveParameterByName("sub3") clsCombinedList. RemoveParameterByName("sub2") From 0ae02f622a500923d13365349da0a79df260e7c0 Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 25 Jan 2017 09:32:15 +0000 Subject: [PATCH 24/72] SoR changes --- instat/dlgStartofRains.vb | 63 ++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index 7adb16d5e39..c97931ea8bd 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -153,7 +153,7 @@ Public Class dlgStartofRains TestOKEnabled() End Sub - Private Sub grpConditionsForStartofRains_Enter(sender As Object, e As EventArgs) Handles nudValue.TextChanged, nudPercentile.TextChanged nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged, nudOverDays.TextChanged, nudOutOfDays.TextChanged + Private Sub grpConditionsForStartofRains_Enter(sender As Object, e As EventArgs) Handles nudValue.TextChanged, nudPercentile.TextChanged, nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged, nudOverDays.TextChanged, nudOutOfDays.TextChanged RainyDaysMethod() DayFromAndToMethod() CombinedFilter() @@ -163,7 +163,7 @@ Public Class dlgStartofRains WetSpell() TestOKEnabled() End Sub - + Private rdoAmountAndPercentile_Changed (sender As Object, e As EventArgs) Handles rdoAmount.CheckedChanged, rdoPercentile.CheckedChanged CheckBoxesSetting() CombinedFilter() @@ -207,13 +207,14 @@ Public Class dlgStartofRains lblOverDays.Visible = True If rdoAmount.Checked Then nudValue.Visible = True - nudPercentile.Visible = False + nudPercentile.Visible = False ElseIf rdoPercentile.Checked Then nudValue.Visible = False - nudPercentile.Visible = True + nudPercentile.Visible = True Else nudValue.Visible = False - nudPercentile.Visible = False + nudPercentile.Visible = False + End If Else nudValue.Visible = False nudPercentile.Visible = False @@ -232,31 +233,33 @@ Public Class dlgStartofRains lblLengthofTime.Visible = False lblMaximumDays.Visible = False End If - If chkConsecutiveRainyDays.Checked Then - nudMinimum.Visible = True - nudOutOfDays.Visible = True - lblMinimum.Visible = True - lblWidth.Visible = True - Else - nudMinimum.Visible = False - nudOutOfDays.Visible = False - lblMinimum.Visible = False - lblWidth.Visible = False - End If - If chkDrySpell.Checked then - nudDryPeriodRainPeriod.Visible = True - nudDryPeriodMaxRain.Visible = True - nudDryPeriodOverallInterval.Visible = True - lblDryPeriodRainPeriod.Visible = True - lblDryPeriodMaxRain.Visible = True - lblDryPeriodOverallInterval.Visible = True - Else - nudDryPeriodRainPeriod.Visible = False - nudDryPeriodMaxRain.Visible = False - nudDryPeriodOverallInterval.Visible = False - lblDryPeriodRainPeriod.Visible = False - lblDryPeriodMaxRain.Visible = False - lblDryPeriodOverallInterval.Visible = False + If chkConsecutiveRainyDays.Checked Then + nudMinimum.Visible = True + nudOutOfDays.Visible = True + lblMinimum.Visible = True + lblWidth.Visible = True + Else + nudMinimum.Visible = False + nudOutOfDays.Visible = False + lblMinimum.Visible = False + lblWidth.Visible = False + End If + If chkDrySpell.Checked Then + nudDryPeriodRainPeriod.Visible = True + nudDryPeriodMaxRain.Visible = True + nudDryPeriodOverallInterval.Visible = True + lblDryPeriodRainPeriod.Visible = True + lblDryPeriodMaxRain.Visible = True + lblDryPeriodOverallInterval.Visible = True + Else + nudDryPeriodRainPeriod.Visible = False + nudDryPeriodMaxRain.Visible = False + nudDryPeriodOverallInterval.Visible = False + lblDryPeriodRainPeriod.Visible = False + lblDryPeriodMaxRain.Visible = False + lblDryPeriodOverallInterval.Visible = False + End If + End Sub ' nud max and mins. From 8e3cd358f683dd621879ddce50e53a1ac02d8ac0 Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 25 Jan 2017 10:03:22 +0000 Subject: [PATCH 25/72] Sorted bugs --- instat/dlgStartofRains.Designer.vb | 242 ++++++++++++++++++++++------- instat/dlgStartofRains.resx | 238 ++++++++++++++-------------- instat/dlgStartofRains.vb | 174 +++++++++++---------- 3 files changed, 397 insertions(+), 257 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index 2244b370ae2..897f7c4f91f 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -1,28 +1,28 @@  -Partial Class dlgStartofRains - Inherits System.Windows.Forms.Form - - 'Form overrides dispose to clean up the component list. +Partial Class dlgStartofRains + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Required by the Windows Form Designer - Private components As System.ComponentModel.IContainer - - 'NOTE: The following procedure is required by the Windows Form Designer - 'It can be modified using the Windows Form Designer. - 'Do not modify it using the code editor. + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. Private Sub InitializeComponent() - Me.nudValue = New System.Windows.Forms.NumericUpDown() + Me.nudAmount = New System.Windows.Forms.NumericUpDown() Me.nudMinimum = New System.Windows.Forms.NumericUpDown() Me.lblRainfall = New System.Windows.Forms.Label() Me.grpConditionsForSatrtofRains = New System.Windows.Forms.GroupBox() @@ -55,7 +55,17 @@ Partial Class dlgStartofRains Me.ucrBase = New instat.ucrButtons() Me.ucrReceiverYear = New instat.ucrReceiverSingle() Me.lblYear = New System.Windows.Forms.Label() - CType(Me.nudValue, System.ComponentModel.ISupportInitialize).BeginInit() + Me.nudDPRainPeriod = New System.Windows.Forms.NumericUpDown() + Me.nudDPMaxRain = New System.Windows.Forms.NumericUpDown() + Me.lblDPLength = New System.Windows.Forms.Label() + Me.lblDPMaxRain = New System.Windows.Forms.Label() + Me.chkDryPeriod = New System.Windows.Forms.CheckBox() + Me.nudDPOverallInterval = New System.Windows.Forms.NumericUpDown() + Me.lblDPOverallInterval = New System.Windows.Forms.Label() + Me.rdoAmount = New System.Windows.Forms.RadioButton() + Me.rdoPercentile = New System.Windows.Forms.RadioButton() + Me.nudPercentile = New System.Windows.Forms.NumericUpDown() + CType(Me.nudAmount, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudMinimum, System.ComponentModel.ISupportInitialize).BeginInit() Me.grpConditionsForSatrtofRains.SuspendLayout() CType(Me.nudOutOfDays, System.ComponentModel.ISupportInitialize).BeginInit() @@ -66,17 +76,21 @@ Partial Class dlgStartofRains CType(Me.nudThreshold, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudFrom, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudTo, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudDPRainPeriod, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudDPMaxRain, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudDPOverallInterval, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudPercentile, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' - 'nudValue + 'nudAmount ' - Me.nudValue.Location = New System.Drawing.Point(201, 43) - Me.nudValue.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) - Me.nudValue.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.nudValue.Name = "nudValue" - Me.nudValue.Size = New System.Drawing.Size(47, 20) - Me.nudValue.TabIndex = 7 - Me.nudValue.Value = New Decimal(New Integer() {30, 0, 0, 0}) + Me.nudAmount.Location = New System.Drawing.Point(442, 46) + Me.nudAmount.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) + Me.nudAmount.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudAmount.Name = "nudAmount" + Me.nudAmount.Size = New System.Drawing.Size(47, 20) + Me.nudAmount.TabIndex = 7 + Me.nudAmount.Value = New Decimal(New Integer() {30, 0, 0, 0}) ' 'nudMinimum ' @@ -98,6 +112,16 @@ Partial Class dlgStartofRains ' 'grpConditionsForSatrtofRains ' + Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudPercentile) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.rdoPercentile) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.rdoAmount) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudDPOverallInterval) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblDPOverallInterval) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudDPRainPeriod) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudDPMaxRain) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblDPLength) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblDPMaxRain) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.chkDryPeriod) Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudOutOfDays) Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblWidth) Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudLengthofTime) @@ -112,10 +136,10 @@ Partial Class dlgStartofRains Me.grpConditionsForSatrtofRains.Controls.Add(Me.chkTotalRainfall) Me.grpConditionsForSatrtofRains.Controls.Add(Me.chkConsecutiveRainyDays) Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudMinimum) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudValue) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudAmount) Me.grpConditionsForSatrtofRains.Location = New System.Drawing.Point(9, 285) Me.grpConditionsForSatrtofRains.Name = "grpConditionsForSatrtofRains" - Me.grpConditionsForSatrtofRains.Size = New System.Drawing.Size(395, 95) + Me.grpConditionsForSatrtofRains.Size = New System.Drawing.Size(583, 144) Me.grpConditionsForSatrtofRains.TabIndex = 10 Me.grpConditionsForSatrtofRains.TabStop = False Me.grpConditionsForSatrtofRains.Text = "Conditions for Start of Rains" @@ -140,7 +164,7 @@ Partial Class dlgStartofRains ' 'nudLengthofTime ' - Me.nudLengthofTime.Location = New System.Drawing.Point(337, 68) + Me.nudLengthofTime.Location = New System.Drawing.Point(341, 90) Me.nudLengthofTime.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudLengthofTime.Name = "nudLengthofTime" Me.nudLengthofTime.Size = New System.Drawing.Size(52, 20) @@ -149,7 +173,7 @@ Partial Class dlgStartofRains ' 'nudMaximumDays ' - Me.nudMaximumDays.Location = New System.Drawing.Point(201, 67) + Me.nudMaximumDays.Location = New System.Drawing.Point(181, 90) Me.nudMaximumDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudMaximumDays.Name = "nudMaximumDays" Me.nudMaximumDays.Size = New System.Drawing.Size(47, 20) @@ -158,18 +182,18 @@ Partial Class dlgStartofRains ' 'nudOverDays ' - Me.nudOverDays.Location = New System.Drawing.Point(337, 44) + Me.nudOverDays.Location = New System.Drawing.Point(202, 42) Me.nudOverDays.Maximum = New Decimal(New Integer() {366, 0, 0, 0}) Me.nudOverDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudOverDays.Name = "nudOverDays" - Me.nudOverDays.Size = New System.Drawing.Size(52, 20) + Me.nudOverDays.Size = New System.Drawing.Size(46, 20) Me.nudOverDays.TabIndex = 9 Me.nudOverDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'lblLengthofTime ' Me.lblLengthofTime.AutoSize = True - Me.lblLengthofTime.Location = New System.Drawing.Point(254, 71) + Me.lblLengthofTime.Location = New System.Drawing.Point(254, 94) Me.lblLengthofTime.Name = "lblLengthofTime" Me.lblLengthofTime.Size = New System.Drawing.Size(81, 13) Me.lblLengthofTime.TabIndex = 13 @@ -178,7 +202,7 @@ Partial Class dlgStartofRains 'lblMaximumDays ' Me.lblMaximumDays.AutoSize = True - Me.lblMaximumDays.Location = New System.Drawing.Point(118, 70) + Me.lblMaximumDays.Location = New System.Drawing.Point(98, 93) Me.lblMaximumDays.Name = "lblMaximumDays" Me.lblMaximumDays.Size = New System.Drawing.Size(81, 13) Me.lblMaximumDays.TabIndex = 11 @@ -187,16 +211,16 @@ Partial Class dlgStartofRains 'lblVal ' Me.lblVal.AutoSize = True - Me.lblVal.Location = New System.Drawing.Point(162, 46) + Me.lblVal.Location = New System.Drawing.Point(269, 46) Me.lblVal.Name = "lblVal" - Me.lblVal.Size = New System.Drawing.Size(37, 13) + Me.lblVal.Size = New System.Drawing.Size(87, 13) Me.lblVal.TabIndex = 6 - Me.lblVal.Text = "Value:" + Me.lblVal.Text = "Rainfall Value By" ' 'lblOverDays ' Me.lblOverDays.AutoSize = True - Me.lblOverDays.Location = New System.Drawing.Point(275, 47) + Me.lblOverDays.Location = New System.Drawing.Point(140, 45) Me.lblOverDays.Name = "lblOverDays" Me.lblOverDays.Size = New System.Drawing.Size(60, 13) Me.lblOverDays.TabIndex = 8 @@ -215,7 +239,7 @@ Partial Class dlgStartofRains 'chkDrySpell ' Me.chkDrySpell.AutoSize = True - Me.chkDrySpell.Location = New System.Drawing.Point(7, 70) + Me.chkDrySpell.Location = New System.Drawing.Point(7, 93) Me.chkDrySpell.Name = "chkDrySpell" Me.chkDrySpell.Size = New System.Drawing.Size(68, 17) Me.chkDrySpell.TabIndex = 10 @@ -338,6 +362,7 @@ Partial Class dlgStartofRains ' 'ucrReceiverDate ' + Me.ucrReceiverDate.frmParent = Me Me.ucrReceiverDate.Location = New System.Drawing.Point(250, 56) Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverDate.Name = "ucrReceiverDate" @@ -347,6 +372,7 @@ Partial Class dlgStartofRains ' 'ucrReceiverDOY ' + Me.ucrReceiverDOY.frmParent = Me Me.ucrReceiverDOY.Location = New System.Drawing.Point(250, 182) Me.ucrReceiverDOY.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverDOY.Name = "ucrReceiverDOY" @@ -356,6 +382,7 @@ Partial Class dlgStartofRains ' 'ucrReceiverRainfall ' + Me.ucrReceiverRainfall.frmParent = Me Me.ucrReceiverRainfall.Location = New System.Drawing.Point(250, 98) Me.ucrReceiverRainfall.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverRainfall.Name = "ucrReceiverRainfall" @@ -375,13 +402,14 @@ Partial Class dlgStartofRains ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(9, 386) + Me.ucrBase.Location = New System.Drawing.Point(9, 435) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 11 ' 'ucrReceiverYear ' + Me.ucrReceiverYear.frmParent = Me Me.ucrReceiverYear.Location = New System.Drawing.Point(250, 140) Me.ucrReceiverYear.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverYear.Name = "ucrReceiverYear" @@ -398,11 +426,107 @@ Partial Class dlgStartofRains Me.lblYear.TabIndex = 5 Me.lblYear.Text = "Year:" ' + 'nudDPRainPeriod + ' + Me.nudDPRainPeriod.Location = New System.Drawing.Point(341, 117) + Me.nudDPRainPeriod.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudDPRainPeriod.Name = "nudDPRainPeriod" + Me.nudDPRainPeriod.Size = New System.Drawing.Size(52, 20) + Me.nudDPRainPeriod.TabIndex = 19 + Me.nudDPRainPeriod.Value = New Decimal(New Integer() {1, 0, 0, 0}) + ' + 'nudDPMaxRain + ' + Me.nudDPMaxRain.Location = New System.Drawing.Point(181, 117) + Me.nudDPMaxRain.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudDPMaxRain.Name = "nudDPMaxRain" + Me.nudDPMaxRain.Size = New System.Drawing.Size(47, 20) + Me.nudDPMaxRain.TabIndex = 17 + Me.nudDPMaxRain.Value = New Decimal(New Integer() {1, 0, 0, 0}) + ' + 'lblDPLength + ' + Me.lblDPLength.AutoSize = True + Me.lblDPLength.Location = New System.Drawing.Point(234, 121) + Me.lblDPLength.Name = "lblDPLength" + Me.lblDPLength.Size = New System.Drawing.Size(101, 13) + Me.lblDPLength.TabIndex = 18 + Me.lblDPLength.Text = "Rain Period Length:" + ' + 'lblDPMaxRain + ' + Me.lblDPMaxRain.AutoSize = True + Me.lblDPMaxRain.Location = New System.Drawing.Point(98, 120) + Me.lblDPMaxRain.Name = "lblDPMaxRain" + Me.lblDPMaxRain.Size = New System.Drawing.Size(79, 13) + Me.lblDPMaxRain.TabIndex = 16 + Me.lblDPMaxRain.Text = "Maximum Rain:" + ' + 'chkDryPeriod + ' + Me.chkDryPeriod.AutoSize = True + Me.chkDryPeriod.Location = New System.Drawing.Point(7, 120) + Me.chkDryPeriod.Name = "chkDryPeriod" + Me.chkDryPeriod.Size = New System.Drawing.Size(75, 17) + Me.chkDryPeriod.TabIndex = 15 + Me.chkDryPeriod.Text = "Dry Period" + Me.chkDryPeriod.UseVisualStyleBackColor = True + ' + 'nudDPOverallInterval + ' + Me.nudDPOverallInterval.Location = New System.Drawing.Point(525, 117) + Me.nudDPOverallInterval.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudDPOverallInterval.Name = "nudDPOverallInterval" + Me.nudDPOverallInterval.Size = New System.Drawing.Size(52, 20) + Me.nudDPOverallInterval.TabIndex = 21 + Me.nudDPOverallInterval.Value = New Decimal(New Integer() {1, 0, 0, 0}) + ' + 'lblDPOverallInterval + ' + Me.lblDPOverallInterval.AutoSize = True + Me.lblDPOverallInterval.Location = New System.Drawing.Point(406, 121) + Me.lblDPOverallInterval.Name = "lblDPOverallInterval" + Me.lblDPOverallInterval.Size = New System.Drawing.Size(117, 13) + Me.lblDPOverallInterval.TabIndex = 20 + Me.lblDPOverallInterval.Text = "Overall Interval Length:" + ' + 'rdoAmount + ' + Me.rdoAmount.AutoSize = True + Me.rdoAmount.Location = New System.Drawing.Point(364, 46) + Me.rdoAmount.Name = "rdoAmount" + Me.rdoAmount.Size = New System.Drawing.Size(61, 17) + Me.rdoAmount.TabIndex = 22 + Me.rdoAmount.TabStop = True + Me.rdoAmount.Text = "Amount" + Me.rdoAmount.UseVisualStyleBackColor = True + ' + 'rdoPercentile + ' + Me.rdoPercentile.AutoSize = True + Me.rdoPercentile.Location = New System.Drawing.Point(364, 69) + Me.rdoPercentile.Name = "rdoPercentile" + Me.rdoPercentile.Size = New System.Drawing.Size(72, 17) + Me.rdoPercentile.TabIndex = 23 + Me.rdoPercentile.TabStop = True + Me.rdoPercentile.Text = "Percentile" + Me.rdoPercentile.UseVisualStyleBackColor = True + ' + 'nudPercentile + ' + Me.nudPercentile.Location = New System.Drawing.Point(442, 69) + Me.nudPercentile.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) + Me.nudPercentile.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudPercentile.Name = "nudPercentile" + Me.nudPercentile.Size = New System.Drawing.Size(47, 20) + Me.nudPercentile.TabIndex = 24 + Me.nudPercentile.Value = New Decimal(New Integer() {30, 0, 0, 0}) + ' 'dlgStartofRains ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(414, 445) + Me.ClientSize = New System.Drawing.Size(604, 489) Me.Controls.Add(Me.ucrReceiverYear) Me.Controls.Add(Me.lblYear) Me.Controls.Add(Me.lblDate) @@ -422,7 +546,7 @@ Partial Class dlgStartofRains Me.ShowIcon = False Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Start of Rains" - CType(Me.nudValue, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudAmount, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.nudMinimum, System.ComponentModel.ISupportInitialize).EndInit() Me.grpConditionsForSatrtofRains.ResumeLayout(False) Me.grpConditionsForSatrtofRains.PerformLayout() @@ -435,14 +559,18 @@ Partial Class dlgStartofRains CType(Me.nudThreshold, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.nudFrom, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.nudTo, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudDPRainPeriod, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudDPMaxRain, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudDPOverallInterval, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudPercentile, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() - End Sub - - Friend WithEvents ucrBase As ucrButtons - Friend WithEvents nudValue As NumericUpDown - Friend WithEvents nudMinimum As NumericUpDown + End Sub + + Friend WithEvents ucrBase As ucrButtons + Friend WithEvents nudAmount As NumericUpDown + Friend WithEvents nudMinimum As NumericUpDown Friend WithEvents ucrSelectorForStartofRains As ucrSelectorByDataFrameAddRemove Friend WithEvents ucrReceiverRainfall As ucrReceiverSingle Friend WithEvents lblRainfall As Label @@ -473,4 +601,14 @@ Partial Class dlgStartofRains Friend WithEvents ucrReceiverDate As ucrReceiverSingle Friend WithEvents ucrReceiverYear As ucrReceiverSingle Friend WithEvents lblYear As Label -End Class + Friend WithEvents rdoPercentile As RadioButton + Friend WithEvents rdoAmount As RadioButton + Friend WithEvents nudDPOverallInterval As NumericUpDown + Friend WithEvents lblDPOverallInterval As Label + Friend WithEvents nudDPRainPeriod As NumericUpDown + Friend WithEvents nudDPMaxRain As NumericUpDown + Friend WithEvents lblDPLength As Label + Friend WithEvents lblDPMaxRain As Label + Friend WithEvents chkDryPeriod As CheckBox + Friend WithEvents nudPercentile As NumericUpDown +End Class diff --git a/instat/dlgStartofRains.resx b/instat/dlgStartofRains.resx index 1af7de150c9..29dcb1b3a35 100644 --- a/instat/dlgStartofRains.resx +++ b/instat/dlgStartofRains.resx @@ -1,120 +1,120 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index c97931ea8bd..b847c49ff44 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -70,8 +70,8 @@ Public Class dlgStartofRains clsCombinedList.SetRCommand("list") clsManipulationFirstDOYPerYear.SetRCommand("list") clsDryPeriodTenList.SetRCommand("list") - clsWetSpellList.SetRFunction("list") - clsWetSpell.SetRFunction("instat_calculation$new") + clsWetSpellList.SetRCommand("list") + clsWetSpell.SetRCommand("instat_calculation$new") clsWetSpell.SetAssignTo("Wet_Spell") @@ -87,8 +87,8 @@ Public Class dlgStartofRains nudPercentile.Minimum = 0 nudPercentile.Maximum = 1 nudPercentile.DecimalPlaces = 2 - nudPercentile.Increments = 0.1 - + nudPercentile.Increment = 0.1 + clsDPOverallInterval.SetRCommand("instat_calculation$new") clsDPOverallInterval.SetAssignTo("Overall_Interval") clsDPRain.SetRCommand("instat_calculation$new") @@ -108,7 +108,7 @@ Public Class dlgStartofRains chkDryPeriod.Checked = False CheckBoxesSetting() TestOKEnabled() - nudValue.Value = 20 + nudAmount.Value = 20 nudPercentile.Value = 0.8 nudMinimum.Value = 1 nudMaximumDays.Value = 10 @@ -119,9 +119,9 @@ Public Class dlgStartofRains nudFrom.Value = 1 nudTo.Value = 366 rdoAmount.Checked = True - nudDryPeriodMaxRain.Value = "40" - nudDryPeriodRainPeriod.Value = "30" - nudDryPeriodOverallInterval.Value = "45" + nudDPMaxRain.Value = "40" + nudDPRainPeriod.Value = "30" + nudDPOverallInterval.Value = "45" End Sub Private Sub ReopenDialog() @@ -129,7 +129,7 @@ Public Class dlgStartofRains End Sub Private Sub TestOKEnabled() - If Not ucrReceiverRainfall.IsEmpty AndAlso Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverDOY.IsEmpty AndAlso Not ucrReceiverYear.IsEmpty AndAlso nudThreshold.Text <> "" AndAlso nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso ((chkConsecutiveRainyDays.Checked AndAlso nudMinimum.Text <> "" AndAlso nudOutOfDays.Text <> "") OrElse Not chkConsecutiveRainyDays.Checked) AndAlso (((chkTotalRainfall.Checked AndAlso nudOverDays.Text <> "") AndAlso ((rdoAmount.Checked AndAlso nudValue.Text <> "") OrElse (rdoPercentile.Checked AndAlso nudPercentile.Text <> ""))) OrElse Not chkTotalRainfall.Checked) AndAlso ((chkDrySpell.Checked AndAlso nudMaximumDays.Text <> "" AndAlso nudLengthofTime.Text <> "") OrElse Not chkDrySpell.Checked) AndAlso ((chkDryPeriod.Checked AndAlso nudDryPeriodRainPeriod.Text <> "" AndAlso nudDryPeriodMaxRain.Text <> "" AndAlso nudDryPeriodOverallInterval.Text <> "") OrElse Not chkDryPeriod.Checked) Then + If Not ucrReceiverRainfall.IsEmpty AndAlso Not ucrReceiverDate.IsEmpty AndAlso Not ucrReceiverDOY.IsEmpty AndAlso Not ucrReceiverYear.IsEmpty AndAlso nudThreshold.Text <> "" AndAlso nudFrom.Text <> "" AndAlso nudTo.Text <> "" AndAlso ((chkConsecutiveRainyDays.Checked AndAlso nudMinimum.Text <> "" AndAlso nudOutOfDays.Text <> "") OrElse Not chkConsecutiveRainyDays.Checked) AndAlso (((chkTotalRainfall.Checked AndAlso nudOverDays.Text <> "") AndAlso ((rdoAmount.Checked AndAlso nudAmount.Text <> "") OrElse (rdoPercentile.Checked AndAlso nudPercentile.Text <> ""))) OrElse Not chkTotalRainfall.Checked) AndAlso ((chkDrySpell.Checked AndAlso nudMaximumDays.Text <> "" AndAlso nudLengthofTime.Text <> "") OrElse Not chkDrySpell.Checked) AndAlso ((chkDryPeriod.Checked AndAlso nudDPMaxRain.Text <> "" AndAlso nudDPRainPeriod.Text <> "" AndAlso nudDPOverallInterval.Text <> "") OrElse Not chkDryPeriod.Checked) Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -145,15 +145,15 @@ Public Class dlgStartofRains RainyDaysMethod() TestOKEnabled() End Sub - - Private Sub DryPeriod(sender As Object, e As EventArgs) Handles nudDryPeriodRainPeriod.TextChanged, nudDryPeriodInterval.TextChanged, nudDryPeriodMaxRain.TextChanged + + Private Sub DryPeriod(sender As Object, e As EventArgs) Handles nudDPRainPeriod.TextChanged, nudDPOverallInterval.TextChanged, nudDPMaxRain.TextChanged DryPeriodRainPeriod() DryPeriodAboveThreshold() DryPeriodOverallInterval() TestOKEnabled() End Sub - Private Sub grpConditionsForStartofRains_Enter(sender As Object, e As EventArgs) Handles nudValue.TextChanged, nudPercentile.TextChanged, nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged, nudOverDays.TextChanged, nudOutOfDays.TextChanged + Private Sub grpConditionsForStartofRains_Enter(sender As Object, e As EventArgs) Handles nudAmount.TextChanged, nudPercentile.TextChanged, nudMinimum.TextChanged, nudMaximumDays.TextChanged, nudLengthofTime.TextChanged, nudOverDays.TextChanged, nudOutOfDays.TextChanged RainyDaysMethod() DayFromAndToMethod() CombinedFilter() @@ -164,9 +164,9 @@ Public Class dlgStartofRains TestOKEnabled() End Sub - Private rdoAmountAndPercentile_Changed (sender As Object, e As EventArgs) Handles rdoAmount.CheckedChanged, rdoPercentile.CheckedChanged - CheckBoxesSetting() - CombinedFilter() + Private Sub rdoTotalRainfall_CheckedChanged(sender As Object, e As EventArgs) Handles rdoAmount.CheckedChanged, rdoPercentile.CheckedChanged + CheckBoxesSetting() + CombinedFilter() RollingSumMethod() WetSpell() TestOKEnabled() @@ -203,20 +203,20 @@ Public Class dlgStartofRains Private Sub CheckBoxesSetting() If chkTotalRainfall.Checked Then nudOverDays.Visible = True - lblVal.Visible = True ' need to move this around, change the text of it too. + lblVal.Visible = True lblOverDays.Visible = True If rdoAmount.Checked Then - nudValue.Visible = True + nudAmount.Visible = True nudPercentile.Visible = False ElseIf rdoPercentile.Checked Then - nudValue.Visible = False + nudAmount.Visible = False nudPercentile.Visible = True Else - nudValue.Visible = False + nudAmount.Visible = False nudPercentile.Visible = False End If Else - nudValue.Visible = False + nudAmount.Visible = False nudPercentile.Visible = False nudOverDays.Visible = False lblVal.Visible = False @@ -233,46 +233,46 @@ Public Class dlgStartofRains lblLengthofTime.Visible = False lblMaximumDays.Visible = False End If - If chkConsecutiveRainyDays.Checked Then - nudMinimum.Visible = True - nudOutOfDays.Visible = True - lblMinimum.Visible = True - lblWidth.Visible = True - Else - nudMinimum.Visible = False + If chkConsecutiveRainyDays.Checked Then + nudMinimum.Visible = True + nudOutOfDays.Visible = True + lblMinimum.Visible = True + lblWidth.Visible = True + Else + nudMinimum.Visible = False nudOutOfDays.Visible = False lblMinimum.Visible = False - lblWidth.Visible = False - End If - If chkDrySpell.Checked Then - nudDryPeriodRainPeriod.Visible = True - nudDryPeriodMaxRain.Visible = True - nudDryPeriodOverallInterval.Visible = True - lblDryPeriodRainPeriod.Visible = True - lblDryPeriodMaxRain.Visible = True - lblDryPeriodOverallInterval.Visible = True - Else - nudDryPeriodRainPeriod.Visible = False - nudDryPeriodMaxRain.Visible = False - nudDryPeriodOverallInterval.Visible = False - lblDryPeriodRainPeriod.Visible = False - lblDryPeriodMaxRain.Visible = False - lblDryPeriodOverallInterval.Visible = False - End If + lblWidth.Visible = False + End If + If chkDrySpell.Checked Then + nudDPRainPeriod.Visible = True + nudDPMaxRain.Visible = True + nudDPOverallInterval.Visible = True + lblDPLength.Visible = True + lblDPMaxRain.Visible = True + lblDPOverallInterval.Visible = True + Else + nudDPRainPeriod.Visible = False + nudDPMaxRain.Visible = False + nudDPOverallInterval.Visible = False + lblDPLength.Visible = False + lblDPMaxRain.Visible = False + lblDPOverallInterval.Visible = False + End If End Sub ' nud max and mins. Private Sub nudValues() - nudDryPeriodRainPeriod.Maximum = nudDryPeriodOverallInterval.Value - 1 - nudDryPeriodOverallInterval.Minimum = nudDryPeriodRainPeriod.Value + 1 - nudMinimum.Maximum = nudOutofDays.Value - 1 - nudOutofDays.Minimum = nudMinimum.Value + 1 - nudFrom.Maximum = nudTo.Value - 1 - nudTo.Minimum = nudFrom.Value + 1 - nudMaximumDays.Maximum = nudLengthOfTime.Value - 1 - nudLengthOfTime.Minimum = nudMaximumDays + 1 - End Sub + nudDPRainPeriod.Maximum = nudDPOverallInterval.Value - 1 + nudDPOverallInterval.Minimum = nudDPRainPeriod.Value + 1 + nudMinimum.Maximum = nudOutofDays.Value - 1 + nudOutOfDays.Minimum = nudMinimum.Value + 1 + nudFrom.Maximum = nudTo.Value - 1 + nudTo.Minimum = nudFrom.Value + 1 + nudMaximumDays.Maximum = nudLengthOfTime.Value - 1 + nudLengthofTime.Minimum = nudMaximumDays.Value + 1 + End Sub Private Sub AddKeyMethod() If Not ucrReceiverDate.IsEmpty Then @@ -331,20 +331,20 @@ Public Class dlgStartofRains Private Sub WetSpell() If rdoPercentile.checked Then clsWetSpell.AddParameter("type", chr(34) & "calculation" & chr(34)) - clsWetSpell.AddParameter("function_exp", chr(34) & "quantile(roll_rain_7_days, c(" nudPercentile.Value "), na.rm=T" - clsWetSpell.AddParameter("result_name", chr(34) & "wet_spell" & chr(34)) - clsWetSpell.AddParameter("sub_calculations", clsRFunctionParameter := clsWetSpellList) - clsWetSpellList.AddParameter("sub1", clsRFunctionParameter := clsRollingSum, bIncludeArgumentName = False) - clsWetSpell.AddParameter("save", "0") - Else - clsWetSpell.RemoveParameterByName("type") - clsWetSpell.RemoveParameterByName("function_exp") - clsWetSpell.RemoveParameterByName("result_name") - clsWetSpell.RemoveParameterByName("sub_calculations") - clsWetSpellList.RemoveParameterByName("sub1") - clsWetSpell.RemoveParameterByName("save") - End If - End Sub + clsWetSpell.AddParameter("function_exp", Chr(34) & "quantile(roll_rain_7_days, c(" & nudPercentile.Value & "), na.rm=T") + clsWetSpell.AddParameter("result_name", chr(34) & "wet_spell" & chr(34)) + clsWetSpell.AddParameter("sub_calculations", clsRFunctionParameter:=clsWetSpellList) + clsWetSpellList.AddParameter("sub1", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) + clsWetSpell.AddParameter("save", "0") + Else + clsWetSpell.RemoveParameterByName("type") + clsWetSpell.RemoveParameterByName("function_exp") + clsWetSpell.RemoveParameterByName("result_name") + clsWetSpell.RemoveParameterByName("sub_calculations") + clsWetSpellList.RemoveParameterByName("sub1") + clsWetSpell.RemoveParameterByName("save") + End If + End Sub Private Sub RollingOfRainDays() ' If rolling of rain days one is checked Then @@ -390,8 +390,8 @@ Public Class dlgStartofRains Private Sub DryPeriodRainPeriod() If Not ucrReceiverRainfall.IsEmpty Then clsDPRainInDays.AddParameter("type", chr(34) & "calculation" & chr(34)) - clsDPRainInDays.AddParameter("function_exp", Chr(34) & "rollapply(data = " & ucrReceiverRainfall.GetVariableNames(False) & " ,width = " & nud.DryPeriodRainPeriod & ", FUN = sum, na.rm = FALSE, align='left', fill=NA)" & Chr(34)) - clsDPRainInDays.AddParameter("result_name", chr(34) & "Rain_in_Days" & chr(34)) + clsDPRainInDays.AddParameter("function_exp", Chr(34) & "rollapply(data = " & ucrReceiverRainfall.GetVariableNames(False) & " ,width = " & nudDPRainPeriod.Value & ", FUN = sum, na.rm = FALSE, align='left', fill=NA)" & Chr(34)) + clsDPRainInDays.AddParameter("result_name", chr(34) & "Rain_in_Days" & chr(34)) clsDPRainInDays.AddParameter("calculated_from", "list(" & strCurrDataName & "=" & ucrReceiverRainfall.GetVariableNames & ")") clsDPRainInDays.AddParameter("save", "0") Else @@ -404,18 +404,18 @@ Public Class dlgStartofRains End Sub Private Sub DryPeriodAboveThreshold() - ' If this value is above 40mm, then give it a 0. Otherwise, give it a 1. (i.e., if there is a 20 day period of under 40mm of rain, it is "1") - - If ((Not ucrReceiverRainfall.IsEmpty) AndAlso (nudDryPeriodMaxRain <> "")) Then - clsDPRain.AddParameter("type", Chr(34) & "calculation" & Chr(34)) - clsDPRain.AddParameter("function_exp", Chr(34) & "match( Rain_in_Days <=" & nudDryPeriodMaxRain.Value & ", 1, nomatch = 0)" & Chr(34)) - clsDPRain.AddParameter("result_name", Chr(34) & "Above_Threshold" & Chr(34)) - clsDPRain.AddParameter("sub_calculations", clsRFunctionParameter:=clsDPRainList) - clsDPRainList.AddParameter("sub1", clsRFunctionParameter:=clsDPRainInDays, bIncludeArgumentName:=False) - clsDPRain.AddParameter("save", 0) + ' If this value is above 40mm, then give it a 0. Otherwise, give it a 1. (i.e., if there is a 20 day period of under 40mm of rain, it is "1") + + If ((Not ucrReceiverRainfall.IsEmpty) AndAlso (nudDPMaxRain.Value <> "")) Then + clsDPRain.AddParameter("type", Chr(34) & "calculation" & Chr(34)) + clsDPRain.AddParameter("function_exp", Chr(34) & "match( Rain_in_Days <=" & nudDPMaxRain.Value & ", 1, nomatch = 0)" & Chr(34)) + clsDPRain.AddParameter("result_name", Chr(34) & "Above_Threshold" & Chr(34)) + clsDPRain.AddParameter("sub_calculations", clsRFunctionParameter:=clsDPRainList) + clsDPRainList.AddParameter("sub1", clsRFunctionParameter:=clsDPRainInDays, bIncludeArgumentName:=False) + clsDPRain.AddParameter("save", 0) ' clsSubRainDays.AddParameter("sub1", clsRFunctionParameter:=clsRainyDays, bIncludeArgumentName:=False) - Else - clsDPRain.RemoveParameterByName("type") + Else + clsDPRain.RemoveParameterByName("type") clsDPRain.RemoveParameterByName("function_exp") clsDPRain.RemoveParameterByName("result_name") clsDPRain.RemoveParameterByName("sub_calculations") @@ -428,8 +428,8 @@ Public Class dlgStartofRains ' # Rolling sum of that ^ of a 45 day period (i.e., for the next 45 days, how many times does rainfall over 20 days not reach 40mm?) If Not ucrReceiverRainfall.IsEmpty Then clsDPOverallInterval.AddParameter("type", chr(34) & "calculation" & chr(34)) - clsDPOverallInterval("function_exp", Chr(34) & "rollapply(data = Above_Threshold ,width = (" & nud.DryPeriodInterval.Value & "-" & nudDryPeriodRainPeriod.Value & "+ 1), FUN = sum, na.rm = FALSE, align='left', fill=NA)" & Chr(34)) - clsDPOverallInterval.AddParameter("result_name", chr(34) & "DP_Overall_Interval_Rain" & chr(34)) + clsDPOverallInterval.AddParameter("function_exp", Chr(34) & "rollapply(data = Above_Threshold ,width = (" & nudDPOverallInterval.Value & "-" & nudDPRainPeriod.Value & "+ 1), FUN = sum, na.rm = FALSE, align='left', fill=NA)" & Chr(34)) + clsDPOverallInterval.AddParameter("result_name", chr(34) & "DP_Overall_Interval_Rain" & chr(34)) clsDPOverallInterval.AddParameter("sub_calculations", clsRFunctionParameter:=clsDPOverallIntervalList) clsDPOverallIntervalList.AddParameter("sub1", clsRFunctionParameter:=clsDPRain, bIncludeArgumentName:=False) clsDPOverallInterval.AddParameter("save", "2") @@ -471,8 +471,9 @@ Public Class dlgStartofRains clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <"& Chr(34) & nudMaximumDays.Value & Chr(34) & " & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) clsCombinedList.RemoveParameterByName("sub4") ElseIf rdoPercentile.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <"& Chr(34) & nudMaximumDays.Value & Chr(34) & " & roll_sum_Rain >wet_spell & Rain>0.85" & Chr(34))clsCombinedList.AddParameter(“sub4”, clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) - clsCombinedList.AddParameter("sub4", clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <" & Chr(34) & nudMaximumDays.Value & Chr(34) & " & roll_sum_Rain >wet_spell & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter(“sub4”, clsRFunctionParameter:=clsWetSpell, bIncludeArgumentName:=False) + clsCombinedList.AddParameter("sub4", clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) End If clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) @@ -578,5 +579,6 @@ Public Class dlgStartofRains Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk frmMain.clsRLink.RunScript(clsAddKey.ToScript, strComment:="Start of Rains: Defining Date column as key") End Sub - - End Class + + +End Class From dd4c31a76c3ac1265cde1fcf7a9e14f8993d7b2d Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 25 Jan 2017 11:51:16 +0000 Subject: [PATCH 26/72] Working Start of Rains --- instat/dlgStartofRains.Designer.vb | 550 ++++++++++++++++------------- instat/dlgStartofRains.vb | 257 +++++++------- 2 files changed, 423 insertions(+), 384 deletions(-) diff --git a/instat/dlgStartofRains.Designer.vb b/instat/dlgStartofRains.Designer.vb index 897f7c4f91f..fe8c82031c1 100644 --- a/instat/dlgStartofRains.Designer.vb +++ b/instat/dlgStartofRains.Designer.vb @@ -26,16 +26,30 @@ Partial Class dlgStartofRains Me.nudMinimum = New System.Windows.Forms.NumericUpDown() Me.lblRainfall = New System.Windows.Forms.Label() Me.grpConditionsForSatrtofRains = New System.Windows.Forms.GroupBox() - Me.nudOutOfDays = New System.Windows.Forms.NumericUpDown() - Me.lblWidth = New System.Windows.Forms.Label() - Me.nudLengthofTime = New System.Windows.Forms.NumericUpDown() - Me.nudMaximumDays = New System.Windows.Forms.NumericUpDown() + Me.pnlTotalRainfall = New System.Windows.Forms.Panel() + Me.lblOverDays = New System.Windows.Forms.Label() + Me.nudPercentile = New System.Windows.Forms.NumericUpDown() + Me.lblVal = New System.Windows.Forms.Label() Me.nudOverDays = New System.Windows.Forms.NumericUpDown() - Me.lblLengthofTime = New System.Windows.Forms.Label() + Me.rdoPercentile = New System.Windows.Forms.RadioButton() + Me.rdoAmount = New System.Windows.Forms.RadioButton() + Me.pnlDrySpell = New System.Windows.Forms.Panel() Me.lblMaximumDays = New System.Windows.Forms.Label() - Me.lblVal = New System.Windows.Forms.Label() - Me.lblOverDays = New System.Windows.Forms.Label() + Me.lblLengthofTime = New System.Windows.Forms.Label() + Me.nudMaximumDays = New System.Windows.Forms.NumericUpDown() + Me.nudLengthofTime = New System.Windows.Forms.NumericUpDown() + Me.pnlConsecutiveRainyDays = New System.Windows.Forms.Panel() Me.lblMinimum = New System.Windows.Forms.Label() + Me.lblWidth = New System.Windows.Forms.Label() + Me.nudOutOfDays = New System.Windows.Forms.NumericUpDown() + Me.pnlDryPeriod = New System.Windows.Forms.Panel() + Me.lblDPMaxRain = New System.Windows.Forms.Label() + Me.lblDPLength = New System.Windows.Forms.Label() + Me.nudDPMaxRain = New System.Windows.Forms.NumericUpDown() + Me.nudDPRainPeriod = New System.Windows.Forms.NumericUpDown() + Me.nudDPOverallInterval = New System.Windows.Forms.NumericUpDown() + Me.lblDPOverallInterval = New System.Windows.Forms.Label() + Me.chkDryPeriod = New System.Windows.Forms.CheckBox() Me.chkDrySpell = New System.Windows.Forms.CheckBox() Me.chkTotalRainfall = New System.Windows.Forms.CheckBox() Me.chkConsecutiveRainyDays = New System.Windows.Forms.CheckBox() @@ -48,63 +62,57 @@ Partial Class dlgStartofRains Me.lblTo = New System.Windows.Forms.Label() Me.lblDOY = New System.Windows.Forms.Label() Me.lblDate = New System.Windows.Forms.Label() + Me.lblYear = New System.Windows.Forms.Label() + Me.ucrReceiverYear = New instat.ucrReceiverSingle() Me.ucrReceiverDate = New instat.ucrReceiverSingle() Me.ucrReceiverDOY = New instat.ucrReceiverSingle() Me.ucrReceiverRainfall = New instat.ucrReceiverSingle() Me.ucrSelectorForStartofRains = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.ucrReceiverYear = New instat.ucrReceiverSingle() - Me.lblYear = New System.Windows.Forms.Label() - Me.nudDPRainPeriod = New System.Windows.Forms.NumericUpDown() - Me.nudDPMaxRain = New System.Windows.Forms.NumericUpDown() - Me.lblDPLength = New System.Windows.Forms.Label() - Me.lblDPMaxRain = New System.Windows.Forms.Label() - Me.chkDryPeriod = New System.Windows.Forms.CheckBox() - Me.nudDPOverallInterval = New System.Windows.Forms.NumericUpDown() - Me.lblDPOverallInterval = New System.Windows.Forms.Label() - Me.rdoAmount = New System.Windows.Forms.RadioButton() - Me.rdoPercentile = New System.Windows.Forms.RadioButton() - Me.nudPercentile = New System.Windows.Forms.NumericUpDown() CType(Me.nudAmount, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudMinimum, System.ComponentModel.ISupportInitialize).BeginInit() Me.grpConditionsForSatrtofRains.SuspendLayout() - CType(Me.nudOutOfDays, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.nudLengthofTime, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.nudMaximumDays, System.ComponentModel.ISupportInitialize).BeginInit() + Me.pnlTotalRainfall.SuspendLayout() + CType(Me.nudPercentile, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudOverDays, System.ComponentModel.ISupportInitialize).BeginInit() + Me.pnlDrySpell.SuspendLayout() + CType(Me.nudMaximumDays, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudLengthofTime, System.ComponentModel.ISupportInitialize).BeginInit() + Me.pnlConsecutiveRainyDays.SuspendLayout() + CType(Me.nudOutOfDays, System.ComponentModel.ISupportInitialize).BeginInit() + Me.pnlDryPeriod.SuspendLayout() + CType(Me.nudDPMaxRain, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudDPRainPeriod, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.nudDPOverallInterval, System.ComponentModel.ISupportInitialize).BeginInit() Me.grpRainParameters.SuspendLayout() CType(Me.nudThreshold, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudFrom, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.nudTo, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.nudDPRainPeriod, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.nudDPMaxRain, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.nudDPOverallInterval, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.nudPercentile, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'nudAmount ' - Me.nudAmount.Location = New System.Drawing.Point(442, 46) + Me.nudAmount.Location = New System.Drawing.Point(342, 4) Me.nudAmount.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) Me.nudAmount.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudAmount.Name = "nudAmount" - Me.nudAmount.Size = New System.Drawing.Size(47, 20) - Me.nudAmount.TabIndex = 7 + Me.nudAmount.Size = New System.Drawing.Size(52, 20) + Me.nudAmount.TabIndex = 4 Me.nudAmount.Value = New Decimal(New Integer() {30, 0, 0, 0}) ' 'nudMinimum ' - Me.nudMinimum.Location = New System.Drawing.Point(201, 19) + Me.nudMinimum.Location = New System.Drawing.Point(56, 8) Me.nudMinimum.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudMinimum.Name = "nudMinimum" Me.nudMinimum.Size = New System.Drawing.Size(47, 20) - Me.nudMinimum.TabIndex = 2 + Me.nudMinimum.TabIndex = 1 Me.nudMinimum.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' 'lblRainfall ' Me.lblRainfall.AutoSize = True - Me.lblRainfall.Location = New System.Drawing.Point(250, 83) + Me.lblRainfall.Location = New System.Drawing.Point(246, 70) Me.lblRainfall.Name = "lblRainfall" Me.lblRainfall.Size = New System.Drawing.Size(70, 13) Me.lblRainfall.TabIndex = 3 @@ -112,137 +120,265 @@ Partial Class dlgStartofRains ' 'grpConditionsForSatrtofRains ' - Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudPercentile) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.rdoPercentile) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.rdoAmount) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudDPOverallInterval) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblDPOverallInterval) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudDPRainPeriod) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudDPMaxRain) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblDPLength) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblDPMaxRain) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.pnlTotalRainfall) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.pnlDrySpell) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.pnlConsecutiveRainyDays) + Me.grpConditionsForSatrtofRains.Controls.Add(Me.pnlDryPeriod) Me.grpConditionsForSatrtofRains.Controls.Add(Me.chkDryPeriod) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudOutOfDays) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblWidth) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudLengthofTime) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudMaximumDays) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudOverDays) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblLengthofTime) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblMaximumDays) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblVal) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblOverDays) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.lblMinimum) Me.grpConditionsForSatrtofRains.Controls.Add(Me.chkDrySpell) Me.grpConditionsForSatrtofRains.Controls.Add(Me.chkTotalRainfall) Me.grpConditionsForSatrtofRains.Controls.Add(Me.chkConsecutiveRainyDays) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudMinimum) - Me.grpConditionsForSatrtofRains.Controls.Add(Me.nudAmount) - Me.grpConditionsForSatrtofRains.Location = New System.Drawing.Point(9, 285) + Me.grpConditionsForSatrtofRains.Location = New System.Drawing.Point(9, 238) Me.grpConditionsForSatrtofRains.Name = "grpConditionsForSatrtofRains" - Me.grpConditionsForSatrtofRains.Size = New System.Drawing.Size(583, 144) + Me.grpConditionsForSatrtofRains.Size = New System.Drawing.Size(579, 160) Me.grpConditionsForSatrtofRains.TabIndex = 10 Me.grpConditionsForSatrtofRains.TabStop = False Me.grpConditionsForSatrtofRains.Text = "Conditions for Start of Rains" ' - 'nudOutOfDays + 'pnlTotalRainfall ' - Me.nudOutOfDays.Location = New System.Drawing.Point(337, 20) - Me.nudOutOfDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.nudOutOfDays.Name = "nudOutOfDays" - Me.nudOutOfDays.Size = New System.Drawing.Size(52, 20) - Me.nudOutOfDays.TabIndex = 4 - Me.nudOutOfDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) + Me.pnlTotalRainfall.Controls.Add(Me.lblOverDays) + Me.pnlTotalRainfall.Controls.Add(Me.nudAmount) + Me.pnlTotalRainfall.Controls.Add(Me.nudPercentile) + Me.pnlTotalRainfall.Controls.Add(Me.lblVal) + Me.pnlTotalRainfall.Controls.Add(Me.nudOverDays) + Me.pnlTotalRainfall.Controls.Add(Me.rdoPercentile) + Me.pnlTotalRainfall.Controls.Add(Me.rdoAmount) + Me.pnlTotalRainfall.Location = New System.Drawing.Point(145, 45) + Me.pnlTotalRainfall.Name = "pnlTotalRainfall" + Me.pnlTotalRainfall.Size = New System.Drawing.Size(398, 49) + Me.pnlTotalRainfall.TabIndex = 3 ' - 'lblWidth + 'lblOverDays ' - Me.lblWidth.AutoSize = True - Me.lblWidth.Location = New System.Drawing.Point(269, 23) - Me.lblWidth.Name = "lblWidth" - Me.lblWidth.Size = New System.Drawing.Size(66, 13) - Me.lblWidth.TabIndex = 3 - Me.lblWidth.Text = "Out of Days:" + Me.lblOverDays.AutoSize = True + Me.lblOverDays.Location = New System.Drawing.Point(3, 4) + Me.lblOverDays.Name = "lblOverDays" + Me.lblOverDays.Size = New System.Drawing.Size(60, 13) + Me.lblOverDays.TabIndex = 0 + Me.lblOverDays.Tag = "" + Me.lblOverDays.Text = "Over Days:" ' - 'nudLengthofTime + 'nudPercentile ' - Me.nudLengthofTime.Location = New System.Drawing.Point(341, 90) - Me.nudLengthofTime.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.nudLengthofTime.Name = "nudLengthofTime" - Me.nudLengthofTime.Size = New System.Drawing.Size(52, 20) - Me.nudLengthofTime.TabIndex = 14 - Me.nudLengthofTime.Value = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudPercentile.Location = New System.Drawing.Point(342, 25) + Me.nudPercentile.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) + Me.nudPercentile.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudPercentile.Name = "nudPercentile" + Me.nudPercentile.Size = New System.Drawing.Size(52, 20) + Me.nudPercentile.TabIndex = 6 + Me.nudPercentile.Value = New Decimal(New Integer() {30, 0, 0, 0}) ' - 'nudMaximumDays + 'lblVal ' - Me.nudMaximumDays.Location = New System.Drawing.Point(181, 90) - Me.nudMaximumDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.nudMaximumDays.Name = "nudMaximumDays" - Me.nudMaximumDays.Size = New System.Drawing.Size(47, 20) - Me.nudMaximumDays.TabIndex = 12 - Me.nudMaximumDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) + Me.lblVal.AutoSize = True + Me.lblVal.Location = New System.Drawing.Point(128, 6) + Me.lblVal.Name = "lblVal" + Me.lblVal.Size = New System.Drawing.Size(136, 13) + Me.lblVal.TabIndex = 2 + Me.lblVal.Text = "Calculate Rainfall Value by:" ' 'nudOverDays ' - Me.nudOverDays.Location = New System.Drawing.Point(202, 42) + Me.nudOverDays.Location = New System.Drawing.Point(65, 1) Me.nudOverDays.Maximum = New Decimal(New Integer() {366, 0, 0, 0}) Me.nudOverDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudOverDays.Name = "nudOverDays" Me.nudOverDays.Size = New System.Drawing.Size(46, 20) - Me.nudOverDays.TabIndex = 9 + Me.nudOverDays.TabIndex = 1 Me.nudOverDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) ' - 'lblLengthofTime + 'rdoPercentile ' - Me.lblLengthofTime.AutoSize = True - Me.lblLengthofTime.Location = New System.Drawing.Point(254, 94) - Me.lblLengthofTime.Name = "lblLengthofTime" - Me.lblLengthofTime.Size = New System.Drawing.Size(81, 13) - Me.lblLengthofTime.TabIndex = 13 - Me.lblLengthofTime.Text = "Length of Time:" + Me.rdoPercentile.AutoSize = True + Me.rdoPercentile.Location = New System.Drawing.Point(265, 25) + Me.rdoPercentile.Name = "rdoPercentile" + Me.rdoPercentile.Size = New System.Drawing.Size(72, 17) + Me.rdoPercentile.TabIndex = 5 + Me.rdoPercentile.TabStop = True + Me.rdoPercentile.Text = "Percentile" + Me.rdoPercentile.UseVisualStyleBackColor = True + ' + 'rdoAmount + ' + Me.rdoAmount.AutoSize = True + Me.rdoAmount.Location = New System.Drawing.Point(265, 4) + Me.rdoAmount.Name = "rdoAmount" + Me.rdoAmount.Size = New System.Drawing.Size(61, 17) + Me.rdoAmount.TabIndex = 3 + Me.rdoAmount.TabStop = True + Me.rdoAmount.Text = "Amount" + Me.rdoAmount.UseVisualStyleBackColor = True + ' + 'pnlDrySpell + ' + Me.pnlDrySpell.Controls.Add(Me.lblMaximumDays) + Me.pnlDrySpell.Controls.Add(Me.lblLengthofTime) + Me.pnlDrySpell.Controls.Add(Me.nudMaximumDays) + Me.pnlDrySpell.Controls.Add(Me.nudLengthofTime) + Me.pnlDrySpell.Location = New System.Drawing.Point(96, 95) + Me.pnlDrySpell.Name = "pnlDrySpell" + Me.pnlDrySpell.Size = New System.Drawing.Size(302, 24) + Me.pnlDrySpell.TabIndex = 5 ' 'lblMaximumDays ' Me.lblMaximumDays.AutoSize = True - Me.lblMaximumDays.Location = New System.Drawing.Point(98, 93) + Me.lblMaximumDays.Location = New System.Drawing.Point(3, 5) Me.lblMaximumDays.Name = "lblMaximumDays" Me.lblMaximumDays.Size = New System.Drawing.Size(81, 13) - Me.lblMaximumDays.TabIndex = 11 + Me.lblMaximumDays.TabIndex = 0 Me.lblMaximumDays.Text = "Maximum Days:" ' - 'lblVal + 'lblLengthofTime ' - Me.lblVal.AutoSize = True - Me.lblVal.Location = New System.Drawing.Point(269, 46) - Me.lblVal.Name = "lblVal" - Me.lblVal.Size = New System.Drawing.Size(87, 13) - Me.lblVal.TabIndex = 6 - Me.lblVal.Text = "Rainfall Value By" + Me.lblLengthofTime.AutoSize = True + Me.lblLengthofTime.Location = New System.Drawing.Point(159, 6) + Me.lblLengthofTime.Name = "lblLengthofTime" + Me.lblLengthofTime.Size = New System.Drawing.Size(81, 13) + Me.lblLengthofTime.TabIndex = 2 + Me.lblLengthofTime.Text = "Length of Time:" ' - 'lblOverDays + 'nudMaximumDays ' - Me.lblOverDays.AutoSize = True - Me.lblOverDays.Location = New System.Drawing.Point(140, 45) - Me.lblOverDays.Name = "lblOverDays" - Me.lblOverDays.Size = New System.Drawing.Size(60, 13) - Me.lblOverDays.TabIndex = 8 - Me.lblOverDays.Tag = "" - Me.lblOverDays.Text = "Over Days:" + Me.nudMaximumDays.Location = New System.Drawing.Point(86, 2) + Me.nudMaximumDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudMaximumDays.Name = "nudMaximumDays" + Me.nudMaximumDays.Size = New System.Drawing.Size(47, 20) + Me.nudMaximumDays.TabIndex = 1 + Me.nudMaximumDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) + ' + 'nudLengthofTime + ' + Me.nudLengthofTime.Location = New System.Drawing.Point(246, 2) + Me.nudLengthofTime.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudLengthofTime.Name = "nudLengthofTime" + Me.nudLengthofTime.Size = New System.Drawing.Size(52, 20) + Me.nudLengthofTime.TabIndex = 3 + Me.nudLengthofTime.Value = New Decimal(New Integer() {1, 0, 0, 0}) + ' + 'pnlConsecutiveRainyDays + ' + Me.pnlConsecutiveRainyDays.Controls.Add(Me.lblMinimum) + Me.pnlConsecutiveRainyDays.Controls.Add(Me.nudMinimum) + Me.pnlConsecutiveRainyDays.Controls.Add(Me.lblWidth) + Me.pnlConsecutiveRainyDays.Controls.Add(Me.nudOutOfDays) + Me.pnlConsecutiveRainyDays.Location = New System.Drawing.Point(145, 10) + Me.pnlConsecutiveRainyDays.Name = "pnlConsecutiveRainyDays" + Me.pnlConsecutiveRainyDays.Size = New System.Drawing.Size(258, 32) + Me.pnlConsecutiveRainyDays.TabIndex = 1 ' 'lblMinimum ' Me.lblMinimum.AutoSize = True - Me.lblMinimum.Location = New System.Drawing.Point(149, 22) + Me.lblMinimum.Location = New System.Drawing.Point(4, 11) Me.lblMinimum.Name = "lblMinimum" Me.lblMinimum.Size = New System.Drawing.Size(51, 13) - Me.lblMinimum.TabIndex = 1 + Me.lblMinimum.TabIndex = 0 Me.lblMinimum.Text = "Minimum:" ' + 'lblWidth + ' + Me.lblWidth.AutoSize = True + Me.lblWidth.Location = New System.Drawing.Point(120, 11) + Me.lblWidth.Name = "lblWidth" + Me.lblWidth.Size = New System.Drawing.Size(66, 13) + Me.lblWidth.TabIndex = 2 + Me.lblWidth.Text = "Out of Days:" + ' + 'nudOutOfDays + ' + Me.nudOutOfDays.Location = New System.Drawing.Point(196, 9) + Me.nudOutOfDays.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudOutOfDays.Name = "nudOutOfDays" + Me.nudOutOfDays.Size = New System.Drawing.Size(52, 20) + Me.nudOutOfDays.TabIndex = 3 + Me.nudOutOfDays.Value = New Decimal(New Integer() {1, 0, 0, 0}) + ' + 'pnlDryPeriod + ' + Me.pnlDryPeriod.Controls.Add(Me.lblDPMaxRain) + Me.pnlDryPeriod.Controls.Add(Me.lblDPLength) + Me.pnlDryPeriod.Controls.Add(Me.nudDPMaxRain) + Me.pnlDryPeriod.Controls.Add(Me.nudDPRainPeriod) + Me.pnlDryPeriod.Controls.Add(Me.nudDPOverallInterval) + Me.pnlDryPeriod.Controls.Add(Me.lblDPOverallInterval) + Me.pnlDryPeriod.Location = New System.Drawing.Point(96, 120) + Me.pnlDryPeriod.Name = "pnlDryPeriod" + Me.pnlDryPeriod.Size = New System.Drawing.Size(480, 25) + Me.pnlDryPeriod.TabIndex = 7 + ' + 'lblDPMaxRain + ' + Me.lblDPMaxRain.AutoSize = True + Me.lblDPMaxRain.Location = New System.Drawing.Point(3, 6) + Me.lblDPMaxRain.Name = "lblDPMaxRain" + Me.lblDPMaxRain.Size = New System.Drawing.Size(79, 13) + Me.lblDPMaxRain.TabIndex = 1 + Me.lblDPMaxRain.Text = "Maximum Rain:" + ' + 'lblDPLength + ' + Me.lblDPLength.AutoSize = True + Me.lblDPLength.Location = New System.Drawing.Point(139, 7) + Me.lblDPLength.Name = "lblDPLength" + Me.lblDPLength.Size = New System.Drawing.Size(101, 13) + Me.lblDPLength.TabIndex = 3 + Me.lblDPLength.Text = "Rain Period Length:" + ' + 'nudDPMaxRain + ' + Me.nudDPMaxRain.Location = New System.Drawing.Point(86, 3) + Me.nudDPMaxRain.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudDPMaxRain.Name = "nudDPMaxRain" + Me.nudDPMaxRain.Size = New System.Drawing.Size(47, 20) + Me.nudDPMaxRain.TabIndex = 2 + Me.nudDPMaxRain.Value = New Decimal(New Integer() {1, 0, 0, 0}) + ' + 'nudDPRainPeriod + ' + Me.nudDPRainPeriod.Location = New System.Drawing.Point(246, 3) + Me.nudDPRainPeriod.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudDPRainPeriod.Name = "nudDPRainPeriod" + Me.nudDPRainPeriod.Size = New System.Drawing.Size(52, 20) + Me.nudDPRainPeriod.TabIndex = 4 + Me.nudDPRainPeriod.Value = New Decimal(New Integer() {1, 0, 0, 0}) + ' + 'nudDPOverallInterval + ' + Me.nudDPOverallInterval.Location = New System.Drawing.Point(422, 4) + Me.nudDPOverallInterval.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) + Me.nudDPOverallInterval.Name = "nudDPOverallInterval" + Me.nudDPOverallInterval.Size = New System.Drawing.Size(52, 20) + Me.nudDPOverallInterval.TabIndex = 0 + Me.nudDPOverallInterval.Value = New Decimal(New Integer() {1, 0, 0, 0}) + ' + 'lblDPOverallInterval + ' + Me.lblDPOverallInterval.AutoSize = True + Me.lblDPOverallInterval.Location = New System.Drawing.Point(304, 7) + Me.lblDPOverallInterval.Name = "lblDPOverallInterval" + Me.lblDPOverallInterval.Size = New System.Drawing.Size(117, 13) + Me.lblDPOverallInterval.TabIndex = 5 + Me.lblDPOverallInterval.Text = "Overall Interval Length:" + ' + 'chkDryPeriod + ' + Me.chkDryPeriod.AutoSize = True + Me.chkDryPeriod.Location = New System.Drawing.Point(7, 125) + Me.chkDryPeriod.Name = "chkDryPeriod" + Me.chkDryPeriod.Size = New System.Drawing.Size(75, 17) + Me.chkDryPeriod.TabIndex = 6 + Me.chkDryPeriod.Text = "Dry Period" + Me.chkDryPeriod.UseVisualStyleBackColor = True + ' 'chkDrySpell ' Me.chkDrySpell.AutoSize = True - Me.chkDrySpell.Location = New System.Drawing.Point(7, 93) + Me.chkDrySpell.Location = New System.Drawing.Point(7, 98) Me.chkDrySpell.Name = "chkDrySpell" Me.chkDrySpell.Size = New System.Drawing.Size(68, 17) - Me.chkDrySpell.TabIndex = 10 + Me.chkDrySpell.TabIndex = 4 Me.chkDrySpell.Text = "Dry Spell" Me.chkDrySpell.UseVisualStyleBackColor = True ' @@ -252,7 +388,7 @@ Partial Class dlgStartofRains Me.chkTotalRainfall.Location = New System.Drawing.Point(7, 45) Me.chkTotalRainfall.Name = "chkTotalRainfall" Me.chkTotalRainfall.Size = New System.Drawing.Size(88, 17) - Me.chkTotalRainfall.TabIndex = 5 + Me.chkTotalRainfall.TabIndex = 2 Me.chkTotalRainfall.Text = "Total Rainfall" Me.chkTotalRainfall.UseVisualStyleBackColor = True ' @@ -276,7 +412,7 @@ Partial Class dlgStartofRains Me.grpRainParameters.Controls.Add(Me.lblTo) Me.grpRainParameters.Location = New System.Drawing.Point(9, 192) Me.grpRainParameters.Name = "grpRainParameters" - Me.grpRainParameters.Size = New System.Drawing.Size(144, 87) + Me.grpRainParameters.Size = New System.Drawing.Size(380, 40) Me.grpRainParameters.TabIndex = 9 Me.grpRainParameters.TabStop = False ' @@ -284,7 +420,7 @@ Partial Class dlgStartofRains ' Me.nudThreshold.DecimalPlaces = 2 Me.nudThreshold.Increment = New Decimal(New Integer() {1, 0, 0, 65536}) - Me.nudThreshold.Location = New System.Drawing.Point(81, 11) + Me.nudThreshold.Location = New System.Drawing.Point(66, 11) Me.nudThreshold.Name = "nudThreshold" Me.nudThreshold.Size = New System.Drawing.Size(53, 20) Me.nudThreshold.TabIndex = 1 @@ -302,7 +438,7 @@ Partial Class dlgStartofRains ' 'nudFrom ' - Me.nudFrom.Location = New System.Drawing.Point(81, 35) + Me.nudFrom.Location = New System.Drawing.Point(188, 11) Me.nudFrom.Maximum = New Decimal(New Integer() {366, 0, 0, 0}) Me.nudFrom.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudFrom.Name = "nudFrom" @@ -316,7 +452,7 @@ Partial Class dlgStartofRains 'lblFrom ' Me.lblFrom.AutoSize = True - Me.lblFrom.Location = New System.Drawing.Point(7, 37) + Me.lblFrom.Location = New System.Drawing.Point(149, 13) Me.lblFrom.Name = "lblFrom" Me.lblFrom.Size = New System.Drawing.Size(33, 13) Me.lblFrom.TabIndex = 2 @@ -324,7 +460,7 @@ Partial Class dlgStartofRains ' 'nudTo ' - Me.nudTo.Location = New System.Drawing.Point(81, 61) + Me.nudTo.Location = New System.Drawing.Point(321, 10) Me.nudTo.Maximum = New Decimal(New Integer() {366, 0, 0, 0}) Me.nudTo.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) Me.nudTo.Name = "nudTo" @@ -335,7 +471,7 @@ Partial Class dlgStartofRains 'lblTo ' Me.lblTo.AutoSize = True - Me.lblTo.Location = New System.Drawing.Point(8, 63) + Me.lblTo.Location = New System.Drawing.Point(284, 13) Me.lblTo.Name = "lblTo" Me.lblTo.Size = New System.Drawing.Size(23, 13) Me.lblTo.TabIndex = 4 @@ -345,7 +481,7 @@ Partial Class dlgStartofRains 'lblDOY ' Me.lblDOY.AutoSize = True - Me.lblDOY.Location = New System.Drawing.Point(251, 167) + Me.lblDOY.Location = New System.Drawing.Point(247, 154) Me.lblDOY.Name = "lblDOY" Me.lblDOY.Size = New System.Drawing.Size(66, 13) Me.lblDOY.TabIndex = 7 @@ -354,16 +490,35 @@ Partial Class dlgStartofRains 'lblDate ' Me.lblDate.AutoSize = True - Me.lblDate.Location = New System.Drawing.Point(251, 41) + Me.lblDate.Location = New System.Drawing.Point(247, 28) Me.lblDate.Name = "lblDate" Me.lblDate.Size = New System.Drawing.Size(33, 13) Me.lblDate.TabIndex = 1 Me.lblDate.Text = "Date:" ' + 'lblYear + ' + Me.lblYear.AutoSize = True + Me.lblYear.Location = New System.Drawing.Point(248, 113) + Me.lblYear.Name = "lblYear" + Me.lblYear.Size = New System.Drawing.Size(32, 13) + Me.lblYear.TabIndex = 5 + Me.lblYear.Text = "Year:" + ' + 'ucrReceiverYear + ' + Me.ucrReceiverYear.frmParent = Me + Me.ucrReceiverYear.Location = New System.Drawing.Point(246, 128) + Me.ucrReceiverYear.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverYear.Name = "ucrReceiverYear" + Me.ucrReceiverYear.Selector = Nothing + Me.ucrReceiverYear.Size = New System.Drawing.Size(143, 20) + Me.ucrReceiverYear.TabIndex = 6 + ' 'ucrReceiverDate ' Me.ucrReceiverDate.frmParent = Me - Me.ucrReceiverDate.Location = New System.Drawing.Point(250, 56) + Me.ucrReceiverDate.Location = New System.Drawing.Point(246, 43) Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverDate.Name = "ucrReceiverDate" Me.ucrReceiverDate.Selector = Nothing @@ -373,7 +528,7 @@ Partial Class dlgStartofRains 'ucrReceiverDOY ' Me.ucrReceiverDOY.frmParent = Me - Me.ucrReceiverDOY.Location = New System.Drawing.Point(250, 182) + Me.ucrReceiverDOY.Location = New System.Drawing.Point(246, 169) Me.ucrReceiverDOY.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverDOY.Name = "ucrReceiverDOY" Me.ucrReceiverDOY.Selector = Nothing @@ -383,7 +538,7 @@ Partial Class dlgStartofRains 'ucrReceiverRainfall ' Me.ucrReceiverRainfall.frmParent = Me - Me.ucrReceiverRainfall.Location = New System.Drawing.Point(250, 98) + Me.ucrReceiverRainfall.Location = New System.Drawing.Point(246, 85) Me.ucrReceiverRainfall.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverRainfall.Name = "ucrReceiverRainfall" Me.ucrReceiverRainfall.Selector = Nothing @@ -402,131 +557,16 @@ Partial Class dlgStartofRains ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(9, 435) + Me.ucrBase.Location = New System.Drawing.Point(9, 404) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 11 ' - 'ucrReceiverYear - ' - Me.ucrReceiverYear.frmParent = Me - Me.ucrReceiverYear.Location = New System.Drawing.Point(250, 140) - Me.ucrReceiverYear.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverYear.Name = "ucrReceiverYear" - Me.ucrReceiverYear.Selector = Nothing - Me.ucrReceiverYear.Size = New System.Drawing.Size(143, 20) - Me.ucrReceiverYear.TabIndex = 6 - ' - 'lblYear - ' - Me.lblYear.AutoSize = True - Me.lblYear.Location = New System.Drawing.Point(251, 125) - Me.lblYear.Name = "lblYear" - Me.lblYear.Size = New System.Drawing.Size(32, 13) - Me.lblYear.TabIndex = 5 - Me.lblYear.Text = "Year:" - ' - 'nudDPRainPeriod - ' - Me.nudDPRainPeriod.Location = New System.Drawing.Point(341, 117) - Me.nudDPRainPeriod.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.nudDPRainPeriod.Name = "nudDPRainPeriod" - Me.nudDPRainPeriod.Size = New System.Drawing.Size(52, 20) - Me.nudDPRainPeriod.TabIndex = 19 - Me.nudDPRainPeriod.Value = New Decimal(New Integer() {1, 0, 0, 0}) - ' - 'nudDPMaxRain - ' - Me.nudDPMaxRain.Location = New System.Drawing.Point(181, 117) - Me.nudDPMaxRain.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.nudDPMaxRain.Name = "nudDPMaxRain" - Me.nudDPMaxRain.Size = New System.Drawing.Size(47, 20) - Me.nudDPMaxRain.TabIndex = 17 - Me.nudDPMaxRain.Value = New Decimal(New Integer() {1, 0, 0, 0}) - ' - 'lblDPLength - ' - Me.lblDPLength.AutoSize = True - Me.lblDPLength.Location = New System.Drawing.Point(234, 121) - Me.lblDPLength.Name = "lblDPLength" - Me.lblDPLength.Size = New System.Drawing.Size(101, 13) - Me.lblDPLength.TabIndex = 18 - Me.lblDPLength.Text = "Rain Period Length:" - ' - 'lblDPMaxRain - ' - Me.lblDPMaxRain.AutoSize = True - Me.lblDPMaxRain.Location = New System.Drawing.Point(98, 120) - Me.lblDPMaxRain.Name = "lblDPMaxRain" - Me.lblDPMaxRain.Size = New System.Drawing.Size(79, 13) - Me.lblDPMaxRain.TabIndex = 16 - Me.lblDPMaxRain.Text = "Maximum Rain:" - ' - 'chkDryPeriod - ' - Me.chkDryPeriod.AutoSize = True - Me.chkDryPeriod.Location = New System.Drawing.Point(7, 120) - Me.chkDryPeriod.Name = "chkDryPeriod" - Me.chkDryPeriod.Size = New System.Drawing.Size(75, 17) - Me.chkDryPeriod.TabIndex = 15 - Me.chkDryPeriod.Text = "Dry Period" - Me.chkDryPeriod.UseVisualStyleBackColor = True - ' - 'nudDPOverallInterval - ' - Me.nudDPOverallInterval.Location = New System.Drawing.Point(525, 117) - Me.nudDPOverallInterval.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.nudDPOverallInterval.Name = "nudDPOverallInterval" - Me.nudDPOverallInterval.Size = New System.Drawing.Size(52, 20) - Me.nudDPOverallInterval.TabIndex = 21 - Me.nudDPOverallInterval.Value = New Decimal(New Integer() {1, 0, 0, 0}) - ' - 'lblDPOverallInterval - ' - Me.lblDPOverallInterval.AutoSize = True - Me.lblDPOverallInterval.Location = New System.Drawing.Point(406, 121) - Me.lblDPOverallInterval.Name = "lblDPOverallInterval" - Me.lblDPOverallInterval.Size = New System.Drawing.Size(117, 13) - Me.lblDPOverallInterval.TabIndex = 20 - Me.lblDPOverallInterval.Text = "Overall Interval Length:" - ' - 'rdoAmount - ' - Me.rdoAmount.AutoSize = True - Me.rdoAmount.Location = New System.Drawing.Point(364, 46) - Me.rdoAmount.Name = "rdoAmount" - Me.rdoAmount.Size = New System.Drawing.Size(61, 17) - Me.rdoAmount.TabIndex = 22 - Me.rdoAmount.TabStop = True - Me.rdoAmount.Text = "Amount" - Me.rdoAmount.UseVisualStyleBackColor = True - ' - 'rdoPercentile - ' - Me.rdoPercentile.AutoSize = True - Me.rdoPercentile.Location = New System.Drawing.Point(364, 69) - Me.rdoPercentile.Name = "rdoPercentile" - Me.rdoPercentile.Size = New System.Drawing.Size(72, 17) - Me.rdoPercentile.TabIndex = 23 - Me.rdoPercentile.TabStop = True - Me.rdoPercentile.Text = "Percentile" - Me.rdoPercentile.UseVisualStyleBackColor = True - ' - 'nudPercentile - ' - Me.nudPercentile.Location = New System.Drawing.Point(442, 69) - Me.nudPercentile.Maximum = New Decimal(New Integer() {200, 0, 0, 0}) - Me.nudPercentile.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.nudPercentile.Name = "nudPercentile" - Me.nudPercentile.Size = New System.Drawing.Size(47, 20) - Me.nudPercentile.TabIndex = 24 - Me.nudPercentile.Value = New Decimal(New Integer() {30, 0, 0, 0}) - ' 'dlgStartofRains ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(604, 489) + Me.ClientSize = New System.Drawing.Size(594, 489) Me.Controls.Add(Me.ucrReceiverYear) Me.Controls.Add(Me.lblYear) Me.Controls.Add(Me.lblDate) @@ -550,19 +590,27 @@ Partial Class dlgStartofRains CType(Me.nudMinimum, System.ComponentModel.ISupportInitialize).EndInit() Me.grpConditionsForSatrtofRains.ResumeLayout(False) Me.grpConditionsForSatrtofRains.PerformLayout() - CType(Me.nudOutOfDays, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.nudLengthofTime, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.nudMaximumDays, System.ComponentModel.ISupportInitialize).EndInit() + Me.pnlTotalRainfall.ResumeLayout(False) + Me.pnlTotalRainfall.PerformLayout() + CType(Me.nudPercentile, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.nudOverDays, System.ComponentModel.ISupportInitialize).EndInit() + Me.pnlDrySpell.ResumeLayout(False) + Me.pnlDrySpell.PerformLayout() + CType(Me.nudMaximumDays, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudLengthofTime, System.ComponentModel.ISupportInitialize).EndInit() + Me.pnlConsecutiveRainyDays.ResumeLayout(False) + Me.pnlConsecutiveRainyDays.PerformLayout() + CType(Me.nudOutOfDays, System.ComponentModel.ISupportInitialize).EndInit() + Me.pnlDryPeriod.ResumeLayout(False) + Me.pnlDryPeriod.PerformLayout() + CType(Me.nudDPMaxRain, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudDPRainPeriod, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.nudDPOverallInterval, System.ComponentModel.ISupportInitialize).EndInit() Me.grpRainParameters.ResumeLayout(False) Me.grpRainParameters.PerformLayout() CType(Me.nudThreshold, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.nudFrom, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.nudTo, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.nudDPRainPeriod, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.nudDPMaxRain, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.nudDPOverallInterval, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.nudPercentile, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() @@ -611,4 +659,8 @@ Partial Class dlgStartofRains Friend WithEvents lblDPMaxRain As Label Friend WithEvents chkDryPeriod As CheckBox Friend WithEvents nudPercentile As NumericUpDown + Friend WithEvents pnlConsecutiveRainyDays As Panel + Friend WithEvents pnlDryPeriod As Panel + Friend WithEvents pnlDrySpell As Panel + Friend WithEvents pnlTotalRainfall As Panel End Class diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index b847c49ff44..869066e3970 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -98,6 +98,8 @@ Public Class dlgStartofRains clsDPOverallIntervalList.SetRCommand("list") clsDPRainList.SetRCommand("list") + + chkDryPeriod.Enabled = False End Sub Private Sub SetDefaults() @@ -116,12 +118,12 @@ Public Class dlgStartofRains nudOverDays.Value = 2 nudOutOfDays.Value = 2 nudThreshold.Value = 0.85 - nudFrom.Value = 1 - nudTo.Value = 366 rdoAmount.Checked = True nudDPMaxRain.Value = "40" nudDPRainPeriod.Value = "30" nudDPOverallInterval.Value = "45" + nudFrom.Value = 1 + nudTo.Value = 366 End Sub Private Sub ReopenDialog() @@ -143,6 +145,7 @@ Public Class dlgStartofRains Private Sub grpRainParameters_Enter(sender As Object, e As EventArgs) Handles nudFrom.TextChanged, nudTo.TextChanged, nudThreshold.TextChanged DayFromAndToMethod() RainyDaysMethod() + nudValues() TestOKEnabled() End Sub @@ -150,6 +153,7 @@ Public Class dlgStartofRains DryPeriodRainPeriod() DryPeriodAboveThreshold() DryPeriodOverallInterval() + nudValues() TestOKEnabled() End Sub @@ -161,6 +165,7 @@ Public Class dlgStartofRains DrySpell() RollingSumMethod() WetSpell() + nudValues() TestOKEnabled() End Sub @@ -172,13 +177,14 @@ Public Class dlgStartofRains TestOKEnabled() End Sub - Private Sub grpConditionsForStartofRains1_Enter(sender As Object, e As EventArgs) Handles chkConsecutiveRainyDays.CheckedChanged, chkTotalRainfall.CheckedChanged, chkDrySpell.CheckedChanged + Private Sub grpConditionsForStartofRains1_Enter(sender As Object, e As EventArgs) Handles chkConsecutiveRainyDays.CheckedChanged, chkTotalRainfall.CheckedChanged, chkDrySpell.CheckedChanged, chkDryPeriod.CheckedChanged CheckBoxesSetting() DrySpell() RainyDaysMethod() CombinedFilter() FirstDOYPerYear() TestOKEnabled() + nudValues() End Sub Private Sub ucrReceiverRainfall_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverRainfall.SelectionChanged @@ -202,9 +208,9 @@ Public Class dlgStartofRains Private Sub CheckBoxesSetting() If chkTotalRainfall.Checked Then - nudOverDays.Visible = True - lblVal.Visible = True - lblOverDays.Visible = True + pnlTotalRainfall.Visible = True + nudAmount.Visible = False + nudPercentile.Visible = False If rdoAmount.Checked Then nudAmount.Visible = True nudPercentile.Visible = False @@ -216,64 +222,44 @@ Public Class dlgStartofRains nudPercentile.Visible = False End If Else - nudAmount.Visible = False - nudPercentile.Visible = False - nudOverDays.Visible = False - lblVal.Visible = False - lblOverDays.Visible = False + pnlTotalRainfall.Visible = False End If If chkDrySpell.Checked Then - nudMaximumDays.Visible = True - nudLengthofTime.Visible = True - lblLengthofTime.Visible = True - lblMaximumDays.Visible = True + pnlDrySpell.Visible = True Else - nudMaximumDays.Visible = False - nudLengthofTime.Visible = False - lblLengthofTime.Visible = False - lblMaximumDays.Visible = False + pnlDrySpell.Visible = False End If If chkConsecutiveRainyDays.Checked Then - nudMinimum.Visible = True - nudOutOfDays.Visible = True - lblMinimum.Visible = True - lblWidth.Visible = True + pnlConsecutiveRainyDays.Visible = True Else - nudMinimum.Visible = False - nudOutOfDays.Visible = False - lblMinimum.Visible = False - lblWidth.Visible = False + pnlConsecutiveRainyDays.Visible = False End If - If chkDrySpell.Checked Then - nudDPRainPeriod.Visible = True - nudDPMaxRain.Visible = True - nudDPOverallInterval.Visible = True - lblDPLength.Visible = True - lblDPMaxRain.Visible = True - lblDPOverallInterval.Visible = True + If chkDryPeriod.Checked Then + pnlDryPeriod.Visible = True Else - nudDPRainPeriod.Visible = False - nudDPMaxRain.Visible = False - nudDPOverallInterval.Visible = False - lblDPLength.Visible = False - lblDPMaxRain.Visible = False - lblDPOverallInterval.Visible = False + pnlDryPeriod.Visible = False End If End Sub - - ' nud max and mins. - Private Sub nudValues() - nudDPRainPeriod.Maximum = nudDPOverallInterval.Value - 1 - nudDPOverallInterval.Minimum = nudDPRainPeriod.Value + 1 - nudMinimum.Maximum = nudOutofDays.Value - 1 - nudOutOfDays.Minimum = nudMinimum.Value + 1 - nudFrom.Maximum = nudTo.Value - 1 - nudTo.Minimum = nudFrom.Value + 1 - nudMaximumDays.Maximum = nudLengthOfTime.Value - 1 - nudLengthofTime.Minimum = nudMaximumDays.Value + 1 + + ' nud max and mins. + Private Sub nudValues() + ' nudFrom.Maximum = nudTo.Value - 1 + ' nudTo.Minimum = nudFrom.Value + 1 + If chkConsecutiveRainyDays.Checked Then + nudMinimum.Maximum = nudOutOfDays.Value - 1 + nudOutOfDays.Minimum = nudMinimum.Value + 1 + End If + If chkDrySpell.Checked Then + nudMaximumDays.Maximum = nudLengthofTime.Value - 1 + nudLengthofTime.Minimum = nudMaximumDays.Value + 1 + End If + If chkDryPeriod.Checked Then + nudDPRainPeriod.Maximum = nudDPOverallInterval.Value - 1 + nudDPOverallInterval.Minimum = nudDPRainPeriod.Value + 1 + End If End Sub - + Private Sub AddKeyMethod() If Not ucrReceiverDate.IsEmpty Then clsAddKey.AddParameter("col_name", ucrReceiverDate.GetVariableNames) @@ -331,7 +317,7 @@ Public Class dlgStartofRains Private Sub WetSpell() If rdoPercentile.checked Then clsWetSpell.AddParameter("type", chr(34) & "calculation" & chr(34)) - clsWetSpell.AddParameter("function_exp", Chr(34) & "quantile(roll_rain_7_days, c(" & nudPercentile.Value & "), na.rm=T") + clsWetSpell.AddParameter("function_exp", Chr(34) & "quantile(roll_sum_Rain, c(" & nudPercentile.Value & "), na.rm=T)" & Chr(34)) clsWetSpell.AddParameter("result_name", chr(34) & "wet_spell" & chr(34)) clsWetSpell.AddParameter("sub_calculations", clsRFunctionParameter:=clsWetSpellList) clsWetSpellList.AddParameter("sub1", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) @@ -385,8 +371,7 @@ Public Class dlgStartofRains clsDryPeriodTenList.RemoveParameterByName("sub1") End If End Sub - - + Private Sub DryPeriodRainPeriod() If Not ucrReceiverRainfall.IsEmpty Then clsDPRainInDays.AddParameter("type", chr(34) & "calculation" & chr(34)) @@ -405,8 +390,7 @@ Public Class dlgStartofRains Private Sub DryPeriodAboveThreshold() ' If this value is above 40mm, then give it a 0. Otherwise, give it a 1. (i.e., if there is a 20 day period of under 40mm of rain, it is "1") - - If ((Not ucrReceiverRainfall.IsEmpty) AndAlso (nudDPMaxRain.Value <> "")) Then + If chkDryPeriod.Checked Then clsDPRain.AddParameter("type", Chr(34) & "calculation" & Chr(34)) clsDPRain.AddParameter("function_exp", Chr(34) & "match( Rain_in_Days <=" & nudDPMaxRain.Value & ", 1, nomatch = 0)" & Chr(34)) clsDPRain.AddParameter("result_name", Chr(34) & "Above_Threshold" & Chr(34)) @@ -451,86 +435,85 @@ Public Class dlgStartofRains ' do six if statements for now If chkConsecutiveRainyDays.Checked AndAlso chkTotalRainfall.Checked AndAlso chkDrySpell.Checked Then - clsCombinedFilter.RemoveParameterByName("function_exp") - If rdoAmount.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell < "& Chr(34) & nudMaximumDays.Value & Chr(34) & "& Rolling_Rain_Days >=" & Chr(34) & nudMinimum.Value & Chr(34) & "roll_sum_Rain >20 & Rain>0.85" & Chr(34)) - clsCombinedList.RemoveParameterByName("sub4") - ElseIf rdoPercentile.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <"& Chr(34) & nudMaximumDays.Value & Chr(34) & "& Rolling_Rain_Days >= 1" & Chr(34) & nudMinimum.Value & Chr(34) & "roll_sum_Rain > wet_spell & Rain>0.85" & Chr(34)) - clsCombinedList.AddParameter("sub4", clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) - End If - clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) - clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) - clsCombinedList.AddParameter("sub2", clsRFunctionParameter := clsRollingRainDays, bIncludeArgumentName := False) - - - ElseIf chkTotalRainfall.Checked AndAlso chkDrySpell.Checked Then - clsCombinedFilter.RemoveParameterByName("function_exp") - - If rdoAmount.Checked then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <"& Chr(34) & nudMaximumDays.Value & Chr(34) & " & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) - clsCombinedList.RemoveParameterByName("sub4") - ElseIf rdoPercentile.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <" & Chr(34) & nudMaximumDays.Value & Chr(34) & " & roll_sum_Rain >wet_spell & Rain>0.85" & Chr(34)) + clsCombinedFilter.RemoveParameterByName("function_exp") + If rdoAmount.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell < " & nudMaximumDays.Value & "& Rolling_Rain_Days >=" & nudMinimum.Value & "& roll_sum_Rain >20 & Rain>0.85" & Chr(34)) + clsCombinedList.RemoveParameterByName("sub4") + ElseIf rdoPercentile.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <" & nudMaximumDays.Value & "& Rolling_Rain_Days >=" & nudMinimum.Value & "& roll_sum_Rain > wet_spell & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub4", clsRFunctionParameter:=clsWetSpell, bIncludeArgumentName:=False) + End If + clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) + clsCombinedList.AddParameter("sub2", clsRFunctionParameter:=clsRollingRainDays, bIncludeArgumentName:=False) + + + ElseIf chkTotalRainfall.Checked AndAlso chkDrySpell.Checked Then + clsCombinedFilter.RemoveParameterByName("function_exp") + + If rdoAmount.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <" & nudMaximumDays.Value & " & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) + clsCombinedList.RemoveParameterByName("sub4") + ElseIf rdoPercentile.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <" & nudMaximumDays.Value & " & roll_sum_Rain >wet_spell & Rain>0.85" & Chr(34)) clsCombinedList.AddParameter(“sub4”, clsRFunctionParameter:=clsWetSpell, bIncludeArgumentName:=False) - clsCombinedList.AddParameter("sub4", clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) - End If - clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) - clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) - clsCombinedList.RemoveParameterByName("sub2") - - - - ElseIf chkConsecutiveRainyDays.Checked AndAlso chkDrySpell.Checked Then - clsCombinedFilter.RemoveParameterByName("function_exp") - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <"& Chr(34) & nudMaximumDays.Value & Chr(34) & " & Rolling_Rain_Days >= " & Chr(34) & nudMinimum.Value & Chr(34) & " & Rain>0.85" & Chr(34)) - clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) - clsCombinedList.RemoveParameterByName("sub3") - clsCombinedList.AddParameter("sub2", clsRFunctionParameter := clsRollingRainDays, bIncludeArgumentName := False) - - - ElseIf chkConsecutiveRainyDays.Checked AndAlso chkTotalRainfall.Checked Then - clsCombinedFilter.RemoveParameterByName("function_exp") - If rdoAmount.checked then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= " & Chr(34) & nudMinimum.Value & Chr(34) & " & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) - clsCombinedList.RemoveParameterByName("sub4") - ElseIf rdoPercentile.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= " & Chr(34) & nudMinimum.Value & Chr(34) & " & roll_sum_Rain > wet_spell & Rain>0.85" & Chr(34)) - clsCombinedList.AddParameter("sub4", clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) - End If - clsCombinedList.RemoveParameterByName("sub1") - clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) - clsCombinedList.AddParameter("sub2", clsRFunctionParameter := clsRollingRainDays, bIncludeArgumentName := False) - - ElseIf chkConsecutiveRainyDays.Checked Then - clsCombinedFilter.RemoveParameterByName("function_exp") - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= " & Chr(34) & nudMinimum.Value & Chr(34) & " & Rain>0.85" & Chr(34)) - clsCombinedList.RemoveParameterByName("sub1") - clsCombinedList.RemoveParameterByName("sub3") - clsCombinedList.AddParameter("sub2", clsRFunctionParameter := clsRollingRainDays, bIncludeArgumentName := False) - - ElseIf chkTotalRainfall.Checked Then - clsCombinedFilter.RemoveParameterByName("function_exp") - If rdoAmount.Checked then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & " roll_sum_Rain >20 & Rain>0.85" & Chr(34)) - clsCombinedList.RemoveParameterByName("sub4") - ElseIf rdoPercentile.Checked Then - clsCombinedFilter.AddParameter("function_exp", Chr(34) & " roll_sum_Rain > wet_spell & Rain>0.85" & Chr(34)) - clsCombinedList.AddParameter("sub4", clsRFunctionParameter := clsWetSpell, bIncludeArgumentName := False) - End If - - clsCombinedList.RemoveParameterByName("sub1") - clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) - clsCombinedList.RemoveParameterByName("sub2") - - ElseIf chkDrySpell.Checked Then - clsCombinedFilter.RemoveParameterByName("function_exp") - clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <"& Chr(34) & nudMaximumDays.Value & Chr(34) & " & Rain>0.85" & Chr(34)) - clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) - clsCombinedList. RemoveParameterByName("sub3") - clsCombinedList. RemoveParameterByName("sub2") + clsCombinedList.AddParameter("sub4", clsRFunctionParameter:=clsWetSpell, bIncludeArgumentName:=False) + End If + clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) + clsCombinedList.RemoveParameterByName("sub2") - Else + + + ElseIf chkConsecutiveRainyDays.Checked AndAlso chkDrySpell.Checked Then + clsCombinedFilter.RemoveParameterByName("function_exp") + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <" & nudMaximumDays.Value & " & Rolling_Rain_Days >= " & Chr(34) & nudMinimum.Value & Chr(34) & " & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + clsCombinedList.RemoveParameterByName("sub3") + clsCombinedList.AddParameter("sub2", clsRFunctionParameter:=clsRollingRainDays, bIncludeArgumentName:=False) + + + ElseIf chkConsecutiveRainyDays.Checked AndAlso chkTotalRainfall.Checked Then + clsCombinedFilter.RemoveParameterByName("function_exp") + If rdoAmount.checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= " & nudMinimum.Value & " & roll_sum_Rain >20 & Rain>0.85" & Chr(34)) + clsCombinedList.RemoveParameterByName("sub4") + ElseIf rdoPercentile.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= " & nudMinimum.Value & " & roll_sum_Rain > wet_spell & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub4", clsRFunctionParameter:=clsWetSpell, bIncludeArgumentName:=False) + End If + clsCombinedList.RemoveParameterByName("sub1") + clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) + clsCombinedList.AddParameter("sub2", clsRFunctionParameter:=clsRollingRainDays, bIncludeArgumentName:=False) + + ElseIf chkConsecutiveRainyDays.Checked Then + clsCombinedFilter.RemoveParameterByName("function_exp") + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Rolling_Rain_Days >= " & nudMinimum.Value & " & Rain>0.85" & Chr(34)) + clsCombinedList.RemoveParameterByName("sub1") + clsCombinedList.RemoveParameterByName("sub3") + clsCombinedList.AddParameter("sub2", clsRFunctionParameter:=clsRollingRainDays, bIncludeArgumentName:=False) + + ElseIf chkTotalRainfall.Checked Then + clsCombinedFilter.RemoveParameterByName("function_exp") + If rdoAmount.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "roll_sum_Rain >20 & Rain>0.85" & Chr(34)) + clsCombinedList.RemoveParameterByName("sub4") + ElseIf rdoPercentile.Checked Then + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "roll_sum_Rain > wet_spell & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub4", clsRFunctionParameter:=clsWetSpell, bIncludeArgumentName:=False) + End If + + clsCombinedList.RemoveParameterByName("sub1") + clsCombinedList.AddParameter("sub3", clsRFunctionParameter:=clsRollingSum, bIncludeArgumentName:=False) + clsCombinedList.RemoveParameterByName("sub2") + + ElseIf chkDrySpell.Checked Then + clsCombinedFilter.RemoveParameterByName("function_exp") + clsCombinedFilter.AddParameter("function_exp", Chr(34) & "Dry_Spell <" & nudMaximumDays.Value & " & Rain>0.85" & Chr(34)) + clsCombinedList.AddParameter("sub1", clsRFunctionParameter:=clsDryPeriodTen, bIncludeArgumentName:=False) + clsCombinedList.RemoveParameterByName("sub3") + clsCombinedList.RemoveParameterByName("sub2") + Else clsCombinedFilter.RemoveParameterByName("function_exp") clsCombinedFilter.RemoveParameterByName("type") clsCombinedFilter.RemoveParameterByName("sub_calculations") @@ -539,6 +522,10 @@ Public Class dlgStartofRains clsCombinedList.RemoveParameterByName("sub3") clsCombinedList.RemoveParameterByName("sub4") End If + + ' If chkDryPeriod.Checked Then + ' clsCombinedFilter.RemoveParameterByName("function_exp") + ' clsCombinedFilter.AddParameter("function_exp", Chr(34) & "DP_Overall_Interval_Rain == 0 & Rain>0.85" & Chr(34)) End Sub Private Sub FirstDOYPerYear() From e87a325e8153a2e70997917c7910d1dd8843422b Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Wed, 25 Jan 2017 16:16:24 +0300 Subject: [PATCH 27/72] Adding get and remove keys funcions --- instat/dlgViewAndRemoveKeys.vb | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/instat/dlgViewAndRemoveKeys.vb b/instat/dlgViewAndRemoveKeys.vb index 9d4b90c2be7..a2a35871055 100644 --- a/instat/dlgViewAndRemoveKeys.vb +++ b/instat/dlgViewAndRemoveKeys.vb @@ -28,13 +28,15 @@ Public Class dlgViewAndRemoveKeys End Sub Private Sub InitialiseDialog() - ucrSelectorKeys = ucrReceiverSelectedKey.Selector + ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$get_keys") + ucrSelectorKeys.SetItemType("key") + ucrReceiverSelectedKey.Selector = ucrSelectorKeys ucrReceiverSelectedKey.SetMeAsReceiver() ucrBase.iHelpTopicID = 505 End Sub Private Sub TestOKEnabled() - If ucrReceiverSelectedKey.IsEmpty Then + If Not ucrReceiverSelectedKey.IsEmpty Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -42,10 +44,16 @@ Public Class dlgViewAndRemoveKeys End Sub Private Sub SetDefaults() + ucrSelectorKeys.Reset() chkRemoveKey.Checked = False End Sub Private Sub ucrReceiverSelectedKey_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverSelectedKey.SelectionChanged + If Not ucrReceiverSelectedKey.IsEmpty Then + ucrBase.clsRsyntax.AddParameter("key_name", ucrReceiverSelectedKey.GetVariableNames()) + Else + ucrBase.clsRsyntax.RemoveParameter("key_name") + End If TestOKEnabled() End Sub @@ -53,4 +61,16 @@ Public Class dlgViewAndRemoveKeys SetDefaults() TestOKEnabled() End Sub + + Private Sub chkRemoveKey_CheckedChanged(sender As Object, e As EventArgs) Handles chkRemoveKey.CheckedChanged + If chkRemoveKey.Checked Then + ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$remove_key") + Else + ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$get_keys") + End If + End Sub + + Private Sub ucrSelectorKeys_DataFrameChanged() Handles ucrSelectorKeys.DataFrameChanged + ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSelectorKeys.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) + End Sub End Class \ No newline at end of file From 47c47c819afba4c36837f692b711164845f7eb80 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Wed, 25 Jan 2017 16:19:32 +0300 Subject: [PATCH 28/72] removing get_key function --- instat/dlgViewAndRemoveKeys.vb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/instat/dlgViewAndRemoveKeys.vb b/instat/dlgViewAndRemoveKeys.vb index a2a35871055..e8aceccffe3 100644 --- a/instat/dlgViewAndRemoveKeys.vb +++ b/instat/dlgViewAndRemoveKeys.vb @@ -28,7 +28,7 @@ Public Class dlgViewAndRemoveKeys End Sub Private Sub InitialiseDialog() - ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$get_keys") + ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$remove_key") ucrSelectorKeys.SetItemType("key") ucrReceiverSelectedKey.Selector = ucrSelectorKeys ucrReceiverSelectedKey.SetMeAsReceiver() @@ -63,11 +63,7 @@ Public Class dlgViewAndRemoveKeys End Sub Private Sub chkRemoveKey_CheckedChanged(sender As Object, e As EventArgs) Handles chkRemoveKey.CheckedChanged - If chkRemoveKey.Checked Then - ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$remove_key") - Else - ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$get_keys") - End If + TestOKEnabled() End Sub Private Sub ucrSelectorKeys_DataFrameChanged() Handles ucrSelectorKeys.DataFrameChanged From a63825a3e270fc0e98913629105f39c069642e99 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Wed, 25 Jan 2017 16:41:15 +0300 Subject: [PATCH 29/72] Test OK enabled --- instat/dlgViewAndRemoveKeys.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgViewAndRemoveKeys.vb b/instat/dlgViewAndRemoveKeys.vb index e8aceccffe3..63e524dae3c 100644 --- a/instat/dlgViewAndRemoveKeys.vb +++ b/instat/dlgViewAndRemoveKeys.vb @@ -36,7 +36,7 @@ Public Class dlgViewAndRemoveKeys End Sub Private Sub TestOKEnabled() - If Not ucrReceiverSelectedKey.IsEmpty Then + If Not ucrReceiverSelectedKey.IsEmpty AndAlso chkRemoveKey.Checked Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) From b64624523b1458853d7063f4f0213638232a03d6 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Wed, 25 Jan 2017 17:37:21 +0300 Subject: [PATCH 30/72] Revert "Test OK enabled" This reverts commit a63825a3e270fc0e98913629105f39c069642e99. --- instat/dlgViewAndRemoveKeys.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgViewAndRemoveKeys.vb b/instat/dlgViewAndRemoveKeys.vb index 63e524dae3c..e8aceccffe3 100644 --- a/instat/dlgViewAndRemoveKeys.vb +++ b/instat/dlgViewAndRemoveKeys.vb @@ -36,7 +36,7 @@ Public Class dlgViewAndRemoveKeys End Sub Private Sub TestOKEnabled() - If Not ucrReceiverSelectedKey.IsEmpty AndAlso chkRemoveKey.Checked Then + If Not ucrReceiverSelectedKey.IsEmpty Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) From afe1807b81b1b5095f5b172893eb642a30bd2105 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Wed, 25 Jan 2017 17:37:39 +0300 Subject: [PATCH 31/72] Revert "removing get_key function" This reverts commit 47c47c819afba4c36837f692b711164845f7eb80. --- instat/dlgViewAndRemoveKeys.vb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/instat/dlgViewAndRemoveKeys.vb b/instat/dlgViewAndRemoveKeys.vb index e8aceccffe3..a2a35871055 100644 --- a/instat/dlgViewAndRemoveKeys.vb +++ b/instat/dlgViewAndRemoveKeys.vb @@ -28,7 +28,7 @@ Public Class dlgViewAndRemoveKeys End Sub Private Sub InitialiseDialog() - ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$remove_key") + ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$get_keys") ucrSelectorKeys.SetItemType("key") ucrReceiverSelectedKey.Selector = ucrSelectorKeys ucrReceiverSelectedKey.SetMeAsReceiver() @@ -63,7 +63,11 @@ Public Class dlgViewAndRemoveKeys End Sub Private Sub chkRemoveKey_CheckedChanged(sender As Object, e As EventArgs) Handles chkRemoveKey.CheckedChanged - TestOKEnabled() + If chkRemoveKey.Checked Then + ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$remove_key") + Else + ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$get_keys") + End If End Sub Private Sub ucrSelectorKeys_DataFrameChanged() Handles ucrSelectorKeys.DataFrameChanged From 96dc6738aaf4360b760923f1cd939f9a31067704 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Wed, 25 Jan 2017 17:37:54 +0300 Subject: [PATCH 32/72] Revert "Adding get and remove keys funcions" This reverts commit e87a325e8153a2e70997917c7910d1dd8843422b. --- instat/dlgViewAndRemoveKeys.vb | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/instat/dlgViewAndRemoveKeys.vb b/instat/dlgViewAndRemoveKeys.vb index a2a35871055..9d4b90c2be7 100644 --- a/instat/dlgViewAndRemoveKeys.vb +++ b/instat/dlgViewAndRemoveKeys.vb @@ -28,15 +28,13 @@ Public Class dlgViewAndRemoveKeys End Sub Private Sub InitialiseDialog() - ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$get_keys") - ucrSelectorKeys.SetItemType("key") - ucrReceiverSelectedKey.Selector = ucrSelectorKeys + ucrSelectorKeys = ucrReceiverSelectedKey.Selector ucrReceiverSelectedKey.SetMeAsReceiver() ucrBase.iHelpTopicID = 505 End Sub Private Sub TestOKEnabled() - If Not ucrReceiverSelectedKey.IsEmpty Then + If ucrReceiverSelectedKey.IsEmpty Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -44,16 +42,10 @@ Public Class dlgViewAndRemoveKeys End Sub Private Sub SetDefaults() - ucrSelectorKeys.Reset() chkRemoveKey.Checked = False End Sub Private Sub ucrReceiverSelectedKey_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverSelectedKey.SelectionChanged - If Not ucrReceiverSelectedKey.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("key_name", ucrReceiverSelectedKey.GetVariableNames()) - Else - ucrBase.clsRsyntax.RemoveParameter("key_name") - End If TestOKEnabled() End Sub @@ -61,16 +53,4 @@ Public Class dlgViewAndRemoveKeys SetDefaults() TestOKEnabled() End Sub - - Private Sub chkRemoveKey_CheckedChanged(sender As Object, e As EventArgs) Handles chkRemoveKey.CheckedChanged - If chkRemoveKey.Checked Then - ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$remove_key") - Else - ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$get_keys") - End If - End Sub - - Private Sub ucrSelectorKeys_DataFrameChanged() Handles ucrSelectorKeys.DataFrameChanged - ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSelectorKeys.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) - End Sub End Class \ No newline at end of file From 7b99f259199b65bc4fe1c90379f6114933eeae1a Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Thu, 26 Jan 2017 09:12:40 +0300 Subject: [PATCH 33/72] Updating the inventory plot --- instat/dlgInventoryPlot.vb | 18 +++++++----------- instat/ucrNud.vb | 9 +++++++++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index 96eb101e2e2..92cfb97d42c 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -79,6 +79,12 @@ Public Class dlgInventoryPlot ucrSaveInventoryPlot.SetDataFrameSelector(ucrInventoryPlotSelector.ucrAvailableDataFrames) clsDefaultRFunction.AddParameter(ucrInventoryPlotSelector.GetParameter(), 0) + + ucrNudThreashold.Minimum = 0.85 + ucrNudThreashold.Increment = 0.01 + ucrNudThreashold.DecimalPlaces = 2 + ucrNudThreashold.Minimum = 0.85 + End Sub Private Sub TestOkEnabled() @@ -91,16 +97,7 @@ Public Class dlgInventoryPlot Private Sub SetDefaults() ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultRFunction.Clone()) SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) - - ucrNudThreashold.Value = 0.85 - ucrNudThreashold.Minimum = 0.85 - 'ucrNudThreashold.nudUpDown.Increment = 0.01 - 'ucrNudThreashold.nudUpDown.DecimalPlaces = 2 - 'ucrNudThreashold.nudUpDown.Minimum = 0.85 - - clsDefaultRFunction.AddParameter("threshold", ucrNudThreashold.Value) - ucrChkAddRecodetoData.Checked = False - ucrChkFlipCoordinates.Checked = False + clsDefaultRFunction.AddParameter("threshold", "0.85") ucrSaveInventoryPlot.Reset() ucrInventoryPlotSelector.Reset() @@ -133,6 +130,5 @@ Public Class dlgInventoryPlot Private Sub AllControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInventoryPlotSelector.ControlContentsChanged, ucrChkFlipCoordinates.ControlContentsChanged, ucrChkAddRecodetoData.ControlContentsChanged, ucrYearReceiver.ControlContentsChanged, ucrColourReceiver.ControlContentsChanged, ucrFacetsReceiver.ControlContentsChanged, ucrDayOfYearReceiver.ControlContentsChanged, ucrNudThreashold.ControlContentsChanged TestOkEnabled() - UpdateRCode(Me, clsDefaultRFunction) End Sub End Class \ No newline at end of file diff --git a/instat/ucrNud.vb b/instat/ucrNud.vb index 26351e6813a..c6dce3552aa 100644 --- a/instat/ucrNud.vb +++ b/instat/ucrNud.vb @@ -114,6 +114,15 @@ Public Class ucrNud End Set End Property + Public Property DecimalPlaces As Decimal + Get + Return nudUpDown.DecimalPlaces + End Get + Set(dDecimalPlaces As Decimal) + nudUpDown.DecimalPlaces = dDecimalPlaces + End Set + End Property + From 9f29d285d0eb0f7c64e5be90e16d79dfeafc05f2 Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Thu, 26 Jan 2017 17:00:53 +0300 Subject: [PATCH 34/72] Finally updated Inventory plot --- instat/dlgInventoryPlot.designer.vb | 142 ++++++++++++++-------------- instat/dlgInventoryPlot.vb | 46 ++++----- 2 files changed, 91 insertions(+), 97 deletions(-) diff --git a/instat/dlgInventoryPlot.designer.vb b/instat/dlgInventoryPlot.designer.vb index 2130b18ce83..ede3afb98d5 100644 --- a/instat/dlgInventoryPlot.designer.vb +++ b/instat/dlgInventoryPlot.designer.vb @@ -27,18 +27,18 @@ Partial Class dlgInventoryPlot Me.lblColourBand = New System.Windows.Forms.Label() Me.lblDoY = New System.Windows.Forms.Label() Me.cmdOptions = New System.Windows.Forms.Button() + Me.lblThreshold = New System.Windows.Forms.Label() + Me.lblFacet = New System.Windows.Forms.Label() + Me.ucrSaveGraph = New instat.ucrSave() + Me.ucrChkFlipCoordinates = New instat.ucrCheck() + Me.ucrChkAddRecodetoData = New instat.ucrCheck() + Me.ucrNudThreashold = New instat.ucrNud() + Me.ucrFacetsReceiver = New instat.ucrReceiverSingle() Me.ucrColourReceiver = New instat.ucrReceiverSingle() Me.ucrDayOfYearReceiver = New instat.ucrReceiverSingle() Me.ucrYearReceiver = New instat.ucrReceiverSingle() - Me.ucrSaveInventoryPlot = New instat.ucrSaveGraph() Me.ucrInventoryPlotSelector = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.lblThreshold = New System.Windows.Forms.Label() - Me.ucrFacetsReceiver = New instat.ucrReceiverSingle() - Me.lblFacet = New System.Windows.Forms.Label() - Me.ucrNudThreashold = New instat.ucrNud() - Me.ucrChkAddRecodetoData = New instat.ucrCheck() - Me.ucrChkFlipCoordinates = New instat.ucrCheck() Me.SuspendLayout() ' 'lblYear @@ -86,6 +86,69 @@ Partial Class dlgInventoryPlot Me.cmdOptions.Text = "Options" Me.cmdOptions.UseVisualStyleBackColor = True ' + 'lblThreshold + ' + Me.lblThreshold.AutoSize = True + Me.lblThreshold.Location = New System.Drawing.Point(292, 165) + Me.lblThreshold.Name = "lblThreshold" + Me.lblThreshold.Size = New System.Drawing.Size(54, 13) + Me.lblThreshold.TabIndex = 27 + Me.lblThreshold.Text = "Threshold" + ' + 'lblFacet + ' + Me.lblFacet.AutoSize = True + Me.lblFacet.Location = New System.Drawing.Point(295, 189) + Me.lblFacet.Name = "lblFacet" + Me.lblFacet.Size = New System.Drawing.Size(49, 13) + Me.lblFacet.TabIndex = 29 + Me.lblFacet.Text = "Facet By" + ' + 'ucrSaveGraph + ' + Me.ucrSaveGraph.Location = New System.Drawing.Point(12, 253) + Me.ucrSaveGraph.Name = "ucrSaveGraph" + Me.ucrSaveGraph.Size = New System.Drawing.Size(277, 24) + Me.ucrSaveGraph.TabIndex = 33 + ' + 'ucrChkFlipCoordinates + ' + Me.ucrChkFlipCoordinates.Checked = False + Me.ucrChkFlipCoordinates.Location = New System.Drawing.Point(292, 263) + Me.ucrChkFlipCoordinates.Name = "ucrChkFlipCoordinates" + Me.ucrChkFlipCoordinates.Size = New System.Drawing.Size(100, 20) + Me.ucrChkFlipCoordinates.TabIndex = 32 + ' + 'ucrChkAddRecodetoData + ' + Me.ucrChkAddRecodetoData.Checked = False + Me.ucrChkAddRecodetoData.Location = New System.Drawing.Point(292, 237) + Me.ucrChkAddRecodetoData.Name = "ucrChkAddRecodetoData" + Me.ucrChkAddRecodetoData.Size = New System.Drawing.Size(100, 20) + Me.ucrChkAddRecodetoData.TabIndex = 31 + ' + 'ucrNudThreashold + ' + Me.ucrNudThreashold.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudThreashold.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudThreashold.Location = New System.Drawing.Point(362, 165) + Me.ucrNudThreashold.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudThreashold.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudThreashold.Name = "ucrNudThreashold" + Me.ucrNudThreashold.Size = New System.Drawing.Size(50, 20) + Me.ucrNudThreashold.TabIndex = 30 + Me.ucrNudThreashold.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrFacetsReceiver + ' + Me.ucrFacetsReceiver.frmParent = Me + Me.ucrFacetsReceiver.Location = New System.Drawing.Point(292, 204) + Me.ucrFacetsReceiver.Margin = New System.Windows.Forms.Padding(0) + Me.ucrFacetsReceiver.Name = "ucrFacetsReceiver" + Me.ucrFacetsReceiver.Selector = Nothing + Me.ucrFacetsReceiver.Size = New System.Drawing.Size(120, 20) + Me.ucrFacetsReceiver.TabIndex = 28 + ' 'ucrColourReceiver ' Me.ucrColourReceiver.frmParent = Me @@ -116,13 +179,6 @@ Partial Class dlgInventoryPlot Me.ucrYearReceiver.Size = New System.Drawing.Size(120, 20) Me.ucrYearReceiver.TabIndex = 15 ' - 'ucrSaveInventoryPlot - ' - Me.ucrSaveInventoryPlot.Location = New System.Drawing.Point(12, 238) - Me.ucrSaveInventoryPlot.Name = "ucrSaveInventoryPlot" - Me.ucrSaveInventoryPlot.Size = New System.Drawing.Size(265, 20) - Me.ucrSaveInventoryPlot.TabIndex = 14 - ' 'ucrInventoryPlotSelector ' Me.ucrInventoryPlotSelector.bShowHiddenColumns = False @@ -140,65 +196,12 @@ Partial Class dlgInventoryPlot Me.ucrBase.Size = New System.Drawing.Size(410, 53) Me.ucrBase.TabIndex = 12 ' - 'lblThreshold - ' - Me.lblThreshold.AutoSize = True - Me.lblThreshold.Location = New System.Drawing.Point(292, 165) - Me.lblThreshold.Name = "lblThreshold" - Me.lblThreshold.Size = New System.Drawing.Size(54, 13) - Me.lblThreshold.TabIndex = 27 - Me.lblThreshold.Text = "Threshold" - ' - 'ucrFacetsReceiver - ' - Me.ucrFacetsReceiver.frmParent = Me - Me.ucrFacetsReceiver.Location = New System.Drawing.Point(292, 204) - Me.ucrFacetsReceiver.Margin = New System.Windows.Forms.Padding(0) - Me.ucrFacetsReceiver.Name = "ucrFacetsReceiver" - Me.ucrFacetsReceiver.Selector = Nothing - Me.ucrFacetsReceiver.Size = New System.Drawing.Size(120, 20) - Me.ucrFacetsReceiver.TabIndex = 28 - ' - 'lblFacet - ' - Me.lblFacet.AutoSize = True - Me.lblFacet.Location = New System.Drawing.Point(295, 189) - Me.lblFacet.Name = "lblFacet" - Me.lblFacet.Size = New System.Drawing.Size(49, 13) - Me.lblFacet.TabIndex = 29 - Me.lblFacet.Text = "Facet By" - ' - 'ucrNudThreashold - ' - Me.ucrNudThreashold.Location = New System.Drawing.Point(362, 165) - Me.ucrNudThreashold.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudThreashold.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudThreashold.Name = "ucrNudThreashold" - Me.ucrNudThreashold.Size = New System.Drawing.Size(50, 20) - Me.ucrNudThreashold.TabIndex = 30 - Me.ucrNudThreashold.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'ucrChkAddRecodetoData - ' - Me.ucrChkAddRecodetoData.Checked = False - Me.ucrChkAddRecodetoData.Location = New System.Drawing.Point(292, 237) - Me.ucrChkAddRecodetoData.Name = "ucrChkAddRecodetoData" - Me.ucrChkAddRecodetoData.Size = New System.Drawing.Size(100, 20) - Me.ucrChkAddRecodetoData.TabIndex = 31 - ' - 'ucrChkFlipCoordinates - ' - Me.ucrChkFlipCoordinates.Checked = False - Me.ucrChkFlipCoordinates.Location = New System.Drawing.Point(292, 263) - Me.ucrChkFlipCoordinates.Name = "ucrChkFlipCoordinates" - Me.ucrChkFlipCoordinates.Size = New System.Drawing.Size(100, 20) - Me.ucrChkFlipCoordinates.TabIndex = 32 - ' 'dlgInventoryPlot ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(431, 337) + Me.Controls.Add(Me.ucrSaveGraph) Me.Controls.Add(Me.ucrChkFlipCoordinates) Me.Controls.Add(Me.ucrChkAddRecodetoData) Me.Controls.Add(Me.ucrNudThreashold) @@ -213,7 +216,6 @@ Partial Class dlgInventoryPlot Me.Controls.Add(Me.ucrDayOfYearReceiver) Me.Controls.Add(Me.lblYear) Me.Controls.Add(Me.ucrYearReceiver) - Me.Controls.Add(Me.ucrSaveInventoryPlot) Me.Controls.Add(Me.ucrInventoryPlotSelector) Me.Controls.Add(Me.ucrBase) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow @@ -229,7 +231,6 @@ Partial Class dlgInventoryPlot End Sub Friend WithEvents ucrBase As ucrButtons Friend WithEvents ucrInventoryPlotSelector As ucrSelectorByDataFrameAddRemove - Friend WithEvents ucrSaveInventoryPlot As ucrSaveGraph Friend WithEvents ucrYearReceiver As ucrReceiverSingle Friend WithEvents lblYear As Label Friend WithEvents ucrDayOfYearReceiver As ucrReceiverSingle @@ -244,4 +245,5 @@ Partial Class dlgInventoryPlot Friend WithEvents ucrChkFlipCoordinates As ucrCheck Friend WithEvents ucrChkAddRecodetoData As ucrCheck Friend WithEvents ucrNudThreashold As ucrNud + Friend WithEvents ucrSaveGraph As ucrSave End Class diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index 92cfb97d42c..3324de4c91f 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -66,29 +66,38 @@ Public Class dlgInventoryPlot ucrChkFlipCoordinates.SetText("Flip Coordinates") - ucrChkAddRecodetoData.SetParameter(New RParameter("coord_flip")) - ucrChkAddRecodetoData.SetValuesCheckedAndUnchecked("TRUE", "FALSE") - ucrChkAddRecodetoData.SetDefault("FALSE") + ucrChkFlipCoordinates.SetParameter(New RParameter("coord_flip")) + ucrChkFlipCoordinates.SetValuesCheckedAndUnchecked("TRUE", "FALSE") + ucrChkFlipCoordinates.SetDefault("FALSE") + + ucrSave.SetPrefix("Inventory") + ucrSave.SetSaveTypeAsGraph() + ucrSave.SetDataFrameSelector(ucrInventoryPlotSelector.ucrAvailableDataFrames) + ucrSave.SetCheckBoxText("Save Graph") + ucrSave.SetIsComboBox() + ucrSave.SetAssignToIfUncheckedValue("last_graph") ucrNudThreashold.SetParameter(New RParameter("threshold")) + clsDefaultRFunction.AddParameter("threshold", "0.85") + ucrNudThreashold.bAddRemoveParameter = False ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False ucrBase.iHelpTopicID = 359 ucrBase.clsRsyntax.iCallType = 3 - ucrSaveInventoryPlot.SetDataFrameSelector(ucrInventoryPlotSelector.ucrAvailableDataFrames) + ucrSave.SetDataFrameSelector(ucrInventoryPlotSelector.ucrAvailableDataFrames) clsDefaultRFunction.AddParameter(ucrInventoryPlotSelector.GetParameter(), 0) ucrNudThreashold.Minimum = 0.85 ucrNudThreashold.Increment = 0.01 ucrNudThreashold.DecimalPlaces = 2 - ucrNudThreashold.Minimum = 0.85 + End Sub Private Sub TestOkEnabled() - If (Not ucrYearReceiver.IsEmpty AndAlso Not ucrDayOfYearReceiver.IsEmpty AndAlso Not ucrColourReceiver.IsEmpty) OrElse (ucrSaveInventoryPlot.chkSaveGraph.Checked AndAlso Not ucrSaveInventoryPlot.ucrInputGraphName.IsEmpty) Then + If (Not ucrYearReceiver.IsEmpty AndAlso Not ucrDayOfYearReceiver.IsEmpty AndAlso Not ucrColourReceiver.IsEmpty) AndAlso ucrSave.IsComplete() Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -97,38 +106,21 @@ Public Class dlgInventoryPlot Private Sub SetDefaults() ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultRFunction.Clone()) SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) - clsDefaultRFunction.AddParameter("threshold", "0.85") - - ucrSaveInventoryPlot.Reset() ucrInventoryPlotSelector.Reset() ucrYearReceiver.SetMeAsReceiver() - ucrSaveInventoryPlot.strPrefix = "InventoryPlot" - TestOkEnabled() End Sub - - Private Sub ucrSaveInventoryPlot_GraphNameChanged() Handles ucrSaveInventoryPlot.GraphNameChanged, ucrSaveInventoryPlot.SaveGraphCheckedChanged - If ucrSaveInventoryPlot.bSaveGraph Then - ucrBase.clsRsyntax.SetAssignTo(ucrSaveInventoryPlot.strGraphName, strTempDataframe:=ucrInventoryPlotSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:=ucrSaveInventoryPlot.strGraphName) - Else - ucrBase.clsRsyntax.SetAssignTo("last_graph", strTempDataframe:=ucrInventoryPlotSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") - End If - End Sub - Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click - sdgPlots.SetRSyntax(ucrBase.clsRsyntax) - sdgPlots.ShowDialog() - End Sub - - Private Sub ucrSaveInventoryPlot_ContentsChanged() Handles ucrSaveInventoryPlot.ContentsChanged - TestOkEnabled() + 'there needs to be work on sdgplots before this could be linked + 'sdgPlots.SetRSyntax(ucrBase.clsRsyntax) + 'sdgPlots.ShowDialog() End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() End Sub - Private Sub AllControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInventoryPlotSelector.ControlContentsChanged, ucrChkFlipCoordinates.ControlContentsChanged, ucrChkAddRecodetoData.ControlContentsChanged, ucrYearReceiver.ControlContentsChanged, ucrColourReceiver.ControlContentsChanged, ucrFacetsReceiver.ControlContentsChanged, ucrDayOfYearReceiver.ControlContentsChanged, ucrNudThreashold.ControlContentsChanged + Private Sub AllControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrYearReceiver.ControlContentsChanged, ucrColourReceiver.ControlContentsChanged, ucrDayOfYearReceiver.ControlContentsChanged, ucrSave.ControlContentsChanged, ucrSaveGraph.ControlContentsChanged TestOkEnabled() End Sub End Class \ No newline at end of file From d7549b88dfdf48f6861c57630575f36ac6c8f8cd Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Thu, 26 Jan 2017 17:07:21 +0300 Subject: [PATCH 35/72] renaming ucrSave to ucrSaveGraph --- instat/dlgInventoryPlot.vb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index 3324de4c91f..4a9355b6f27 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -70,12 +70,12 @@ Public Class dlgInventoryPlot ucrChkFlipCoordinates.SetValuesCheckedAndUnchecked("TRUE", "FALSE") ucrChkFlipCoordinates.SetDefault("FALSE") - ucrSave.SetPrefix("Inventory") - ucrSave.SetSaveTypeAsGraph() - ucrSave.SetDataFrameSelector(ucrInventoryPlotSelector.ucrAvailableDataFrames) - ucrSave.SetCheckBoxText("Save Graph") - ucrSave.SetIsComboBox() - ucrSave.SetAssignToIfUncheckedValue("last_graph") + ucrSaveGraph.SetPrefix("Inventory") + ucrSaveGraph.SetSaveTypeAsGraph() + ucrSaveGraph.SetDataFrameSelector(ucrInventoryPlotSelector.ucrAvailableDataFrames) + ucrSaveGraph.SetCheckBoxText("Save Graph") + ucrSaveGraph.SetIsComboBox() + ucrSaveGraph.SetAssignToIfUncheckedValue("last_graph") ucrNudThreashold.SetParameter(New RParameter("threshold")) clsDefaultRFunction.AddParameter("threshold", "0.85") @@ -85,7 +85,7 @@ Public Class dlgInventoryPlot ucrBase.iHelpTopicID = 359 ucrBase.clsRsyntax.iCallType = 3 - ucrSave.SetDataFrameSelector(ucrInventoryPlotSelector.ucrAvailableDataFrames) + ucrSaveGraph.SetDataFrameSelector(ucrInventoryPlotSelector.ucrAvailableDataFrames) clsDefaultRFunction.AddParameter(ucrInventoryPlotSelector.GetParameter(), 0) @@ -97,7 +97,7 @@ Public Class dlgInventoryPlot End Sub Private Sub TestOkEnabled() - If (Not ucrYearReceiver.IsEmpty AndAlso Not ucrDayOfYearReceiver.IsEmpty AndAlso Not ucrColourReceiver.IsEmpty) AndAlso ucrSave.IsComplete() Then + If (Not ucrYearReceiver.IsEmpty AndAlso Not ucrDayOfYearReceiver.IsEmpty AndAlso Not ucrColourReceiver.IsEmpty) AndAlso ucrSaveGraph.IsComplete() Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -120,7 +120,7 @@ Public Class dlgInventoryPlot SetDefaults() End Sub - Private Sub AllControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrYearReceiver.ControlContentsChanged, ucrColourReceiver.ControlContentsChanged, ucrDayOfYearReceiver.ControlContentsChanged, ucrSave.ControlContentsChanged, ucrSaveGraph.ControlContentsChanged + Private Sub AllControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrYearReceiver.ControlContentsChanged, ucrColourReceiver.ControlContentsChanged, ucrDayOfYearReceiver.ControlContentsChanged, ucrSaveGraph.ControlContentsChanged TestOkEnabled() End Sub End Class \ No newline at end of file From 0db6c2422a1ba94c2fad224272f399d200910b80 Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Thu, 26 Jan 2017 17:17:47 +0300 Subject: [PATCH 36/72] Restructuring code --- instat/dlgInventoryPlot.vb | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index 4a9355b6f27..c76c80a828f 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -29,13 +29,15 @@ Public Class dlgInventoryPlot Private Sub InitialiseDialog() clsDefaultRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$make_inventory_plot") + ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False + ucrBase.iHelpTopicID = 359 + ucrBase.clsRsyntax.iCallType = 3 ucrYearReceiver.Selector = ucrInventoryPlotSelector ucrColourReceiver.Selector = ucrInventoryPlotSelector ucrDayOfYearReceiver.Selector = ucrInventoryPlotSelector ucrFacetsReceiver.Selector = ucrInventoryPlotSelector - ucrYearReceiver.Selector = ucrInventoryPlotSelector ucrYearReceiver.SetMeAsReceiver() ucrYearReceiver.SetParameter(New RParameter("year")) @@ -55,7 +57,6 @@ Public Class dlgInventoryPlot ucrFacetsReceiver.SetParameter(New RParameter("facets")) ucrFacetsReceiver.SetParameterIsString() - ucrInventoryPlotSelector.SetParameter(New RParameter("data_name")) ucrInventoryPlotSelector.SetParameterIsString() @@ -64,7 +65,6 @@ Public Class dlgInventoryPlot ucrChkAddRecodetoData.SetValuesCheckedAndUnchecked("TRUE", "FALSE") ucrChkAddRecodetoData.SetDefault("FALSE") - ucrChkFlipCoordinates.SetText("Flip Coordinates") ucrChkFlipCoordinates.SetParameter(New RParameter("coord_flip")) ucrChkFlipCoordinates.SetValuesCheckedAndUnchecked("TRUE", "FALSE") @@ -78,22 +78,13 @@ Public Class dlgInventoryPlot ucrSaveGraph.SetAssignToIfUncheckedValue("last_graph") ucrNudThreashold.SetParameter(New RParameter("threshold")) - clsDefaultRFunction.AddParameter("threshold", "0.85") - ucrNudThreashold.bAddRemoveParameter = False - - ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False - ucrBase.iHelpTopicID = 359 - ucrBase.clsRsyntax.iCallType = 3 - - ucrSaveGraph.SetDataFrameSelector(ucrInventoryPlotSelector.ucrAvailableDataFrames) - clsDefaultRFunction.AddParameter(ucrInventoryPlotSelector.GetParameter(), 0) - - ucrNudThreashold.Minimum = 0.85 ucrNudThreashold.Increment = 0.01 ucrNudThreashold.DecimalPlaces = 2 + ucrNudThreashold.bAddRemoveParameter = False - + clsDefaultRFunction.AddParameter(ucrInventoryPlotSelector.GetParameter(), 0) + clsDefaultRFunction.AddParameter("threshold", "0.85") End Sub Private Sub TestOkEnabled() @@ -105,8 +96,8 @@ Public Class dlgInventoryPlot End Sub Private Sub SetDefaults() ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultRFunction.Clone()) - SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) ucrInventoryPlotSelector.Reset() + SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) ucrYearReceiver.SetMeAsReceiver() TestOkEnabled() End Sub From 0defb93a90e87eaad744f03a65884590d7773c43 Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Fri, 27 Jan 2017 09:15:55 +0300 Subject: [PATCH 37/72] Moving the clsdefaultRFunction --- instat/dlgInventoryPlot.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index c76c80a828f..c50e2cdb5f2 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -28,7 +28,6 @@ Public Class dlgInventoryPlot End Sub Private Sub InitialiseDialog() - clsDefaultRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$make_inventory_plot") ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False ucrBase.iHelpTopicID = 359 ucrBase.clsRsyntax.iCallType = 3 @@ -83,6 +82,7 @@ Public Class dlgInventoryPlot ucrNudThreashold.DecimalPlaces = 2 ucrNudThreashold.bAddRemoveParameter = False + clsDefaultRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$make_inventory_plot") clsDefaultRFunction.AddParameter(ucrInventoryPlotSelector.GetParameter(), 0) clsDefaultRFunction.AddParameter("threshold", "0.85") End Sub From f45b3c0361ddaa2d52a97845308cf9be6c1f7d4c Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Fri, 27 Jan 2017 14:33:49 +0300 Subject: [PATCH 38/72] Adding default for the threshold --- instat/dlgInventoryPlot.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index c50e2cdb5f2..adc0216a296 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -80,7 +80,7 @@ Public Class dlgInventoryPlot ucrNudThreashold.Minimum = 0.85 ucrNudThreashold.Increment = 0.01 ucrNudThreashold.DecimalPlaces = 2 - ucrNudThreashold.bAddRemoveParameter = False + ucrNudThreashold.SetDefault("0.85") clsDefaultRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$make_inventory_plot") clsDefaultRFunction.AddParameter(ucrInventoryPlotSelector.GetParameter(), 0) From 1fbe94c81eae73c5e6acb9d9c79ad4c18c09444f Mon Sep 17 00:00:00 2001 From: Danny Parsons Date: Fri, 27 Jan 2017 14:05:24 +0000 Subject: [PATCH 39/72] adding functionality to set parameter order --- instat/clsRCodeStructure.vb | 17 +++++++---------- instat/clsRFunction.vb | 5 +++-- instat/clsROperator.vb | 4 ++-- instat/clsRParameter.vb | 5 +++-- instat/dlgColourbyProperty.vb | 36 +++++++++++++++++------------------ instat/dlgInventoryPlot.vb | 2 +- instat/dlgOneVariableGraph.vb | 4 ++-- instat/ucrCore.vb | 3 +-- 8 files changed, 37 insertions(+), 39 deletions(-) diff --git a/instat/clsRCodeStructure.vb b/instat/clsRCodeStructure.vb index 34600eb25ee..fa73333a9e7 100644 --- a/instat/clsRCodeStructure.vb +++ b/instat/clsRCodeStructure.vb @@ -201,7 +201,8 @@ Public Class RCodeStructure clsParam.SetArgument(clsROperatorParameter) End If clsParam.bIncludeArgumentName = bIncludeArgumentName - AddParameter(clsParam, iPosition) + clsParam.Position = iPosition + AddParameter(clsParam) End Sub 'TODO This should be call AddParameter but need to make it unambiguous with above @@ -213,20 +214,16 @@ Public Class RCodeStructure End If End Sub - Public Overridable Sub AddParameter(clsNewParam As RParameter, Optional iPosition As Integer = -1) + Public Overridable Sub AddParameter(clsNewParam As RParameter) Dim i As Integer = -1 Dim strTempArgumentName As String = clsNewParam.strArgumentName - clsNewParam.Position = iPosition - If clsNewParam.strArgumentName Is Nothing Then - Dim x = 1 - End If If clsParameters IsNot Nothing Then If clsNewParam.strArgumentName IsNot Nothing Then 'Dim match As Predicate(Of RParameter) = Function(x) x.strArgumentName.Equals(clsParam.strArgumentName) i = clsParameters.FindIndex(Function(x) x.strArgumentName.Equals(strTempArgumentName)) End If If i = -1 Then - ShiftParametersPositions(iPosition) 'Checking if there is room in the parameter's positions to add a parameter with position = iPosition + ShiftParametersPositions(clsNewParam.Position) 'Checking if there is room in the parameter's positions to add a parameter with position = iPosition clsParameters.Add(clsNewParam) Else If clsNewParam.bIsString AndAlso clsNewParam.strArgumentValue IsNot Nothing Then @@ -236,12 +233,12 @@ Public Class RCodeStructure Else 'message End If - If clsParameters(i).Position <> iPosition Then + If clsParameters(i).Position <> clsNewParam.Position Then 'In case the position needs to be changed, there might exist another parameter with the new position in the list 'The parameter i is then temporarily set to unordered until the Shift in positions has been operated within the clsParameters (if necessary). clsParameters(i).Position = -1 - If iPosition <> -1 Then - ShiftParametersPositions(iPosition) + If clsNewParam.Position <> -1 Then + ShiftParametersPositions(clsNewParam.Position) clsParameters(i).Position = clsNewParam.Position End If End If diff --git a/instat/clsRFunction.vb b/instat/clsRFunction.vb index 06d4031e681..5e28313af7a 100644 --- a/instat/clsRFunction.vb +++ b/instat/clsRFunction.vb @@ -50,8 +50,9 @@ Public Class RFunction Public Overrides Sub AddParameter(Optional strParameterName As String = "", Optional strParameterValue As String = "", Optional clsRFunctionParameter As RFunction = Nothing, Optional clsROperatorParameter As ROperator = Nothing, Optional bIncludeArgumentName As Boolean = True, Optional iPosition As Integer = -1) MyBase.AddParameter(strParameterName, strParameterValue, clsRFunctionParameter, clsROperatorParameter, bIncludeArgumentName, iPosition) End Sub - Public Overrides Sub AddParameter(clsParam As RParameter, Optional iPosition As Integer = -1) - MyBase.AddParameter(clsParam, iPosition) + + Public Overrides Sub AddParameter(clsParam As RParameter) + MyBase.AddParameter(clsParam) End Sub Public Overrides Function GetParameter(strName As String) As RParameter diff --git a/instat/clsROperator.vb b/instat/clsROperator.vb index 050e7c9fd1a..0bd7cf02aa7 100644 --- a/instat/clsROperator.vb +++ b/instat/clsROperator.vb @@ -48,9 +48,9 @@ Public Class ROperator End Function - Public Overrides Sub AddParameter(clsParam As RParameter, Optional iPosition As Integer = -1) + Public Overrides Sub AddParameter(clsParam As RParameter) clsParam.bIncludeArgumentName = False 'We don't want to allow names in operator parameters... - MyBase.AddParameter(clsParam, iPosition) + MyBase.AddParameter(clsParam) End Sub Public Overrides Function GetParameter(strName As String) As RParameter diff --git a/instat/clsRParameter.vb b/instat/clsRParameter.vb index 9d2c6bb2fab..909827e0030 100644 --- a/instat/clsRParameter.vb +++ b/instat/clsRParameter.vb @@ -26,15 +26,16 @@ Public Class RParameter Public bIsString As Boolean = False 'iPosition determines the position this parameter should take among other parameters of an Operator or Function. If iPosition is 0, then it is part of the unordered parameters that are added after the ordered ones. 'Note, it is allowed to have gaps in the positions: parameters with positions a 0, b 2, c 5, d 3, e 0 will be sorted as b d c (a e). See CompareParametersPosition in clsRCodeStructure. - Private iPosition As Integer = 0 + Private iPosition As Integer = -1 'See strArgumentName Public bIncludeArgumentName As Boolean = True Public Sub New() End Sub - Public Sub New(strParameterName As String) + Public Sub New(strParameterName As String, Optional iNewPosition As Integer = -1) SetArgumentName(strParameterName) + Position = iNewPosition End Sub ''Public Event PositionChanged() diff --git a/instat/dlgColourbyProperty.vb b/instat/dlgColourbyProperty.vb index 8020b1fa3d5..3bcf77fb2c7 100644 --- a/instat/dlgColourbyProperty.vb +++ b/instat/dlgColourbyProperty.vb @@ -42,15 +42,15 @@ Public Class dlgColourbyProperty Private Sub SetDefaults() ucrSelectorColourByMetadata.Reset() SetOrRemoveColours() - chkRemoveColours.Checked = False + 'chkRemoveColours.Checked = False End Sub Private Sub TestOKEnabled() - If Not ucrReceiverMetadataProperty.IsEmpty OrElse chkRemoveColours.Checked Then - ucrBase.OKEnabled(True) - Else - ucrBase.OKEnabled(False) - End If + 'If Not ucrReceiverMetadataProperty.IsEmpty OrElse chkRemoveColours.Checked Then + ' ucrBase.OKEnabled(True) + 'Else + ' ucrBase.OKEnabled(False) + 'End If End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset @@ -72,21 +72,21 @@ Public Class dlgColourbyProperty TestOKEnabled() End Sub - Private Sub chkRemoveColours_CheckedChanged(sender As Object, e As EventArgs) Handles chkRemoveColours.CheckedChanged + Private Sub chkRemoveColours_CheckedChanged(sender As Object, e As EventArgs) 'Handles chkRemoveColours.CheckedChanged SetOrRemoveColours() End Sub Private Sub SetOrRemoveColours() - If chkRemoveColours.Checked Then - ucrSelectorColourByMetadata.Reset() - ucrSelectorColourByMetadata.SetCurrentReceiver(Nothing) - ucrReceiverMetadataProperty.Enabled = False - ucrBase.clsRsyntax.SetBaseRFunction(clsRemoveColoursFunction) - Else - ucrBase.clsRsyntax.SetBaseRFunction(clsSetColoursFunction) - ucrReceiverMetadataProperty.Enabled = True - ucrReceiverMetadataProperty.SetMeAsReceiver() - End If - TestOKEnabled() + 'If chkRemoveColours.Checked Then + ' ucrSelectorColourByMetadata.Reset() + ' ucrSelectorColourByMetadata.SetCurrentReceiver(Nothing) + ' ucrReceiverMetadataProperty.Enabled = False + ' ucrBase.clsRsyntax.SetBaseRFunction(clsRemoveColoursFunction) + 'Else + ' ucrBase.clsRsyntax.SetBaseRFunction(clsSetColoursFunction) + ' ucrReceiverMetadataProperty.Enabled = True + ' ucrReceiverMetadataProperty.SetMeAsReceiver() + 'End If + 'TestOKEnabled() End Sub End Class \ No newline at end of file diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index 2c1d45910a6..b77e3dca3f4 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -77,7 +77,7 @@ Public Class dlgInventoryPlot ucrBase.clsRsyntax.iCallType = 3 ucrSaveInventoryPlot.SetDataFrameSelector(ucrInventoryPlotSelector.ucrAvailableDataFrames) - clsDefaultRFunction.AddParameter(ucrInventoryPlotSelector.GetParameter(), 0) + clsDefaultRFunction.AddParameter(ucrInventoryPlotSelector.GetParameter()) End Sub diff --git a/instat/dlgOneVariableGraph.vb b/instat/dlgOneVariableGraph.vb index 4ab92af80bd..6e629bacbd3 100644 --- a/instat/dlgOneVariableGraph.vb +++ b/instat/dlgOneVariableGraph.vb @@ -56,10 +56,10 @@ Public Class dlgOneVariableGraph ucrReceiverOneVarGraph.Selector = ucrSelectorOneVarGraph ucrReceiverOneVarGraph.SetMeAsReceiver() - ucrReceiverOneVarGraph.SetParameter(New RParameter("columns")) + ucrReceiverOneVarGraph.SetParameter(New RParameter("columns", 1)) ucrReceiverOneVarGraph.SetParameterIsString() - ucrSelectorOneVarGraph.SetParameter(New RParameter("data_name")) + ucrSelectorOneVarGraph.SetParameter(New RParameter("data_name", 0)) ucrSelectorOneVarGraph.SetParameterIsString() ucrChkFlip.SetText("Flip Coordinates") diff --git a/instat/ucrCore.vb b/instat/ucrCore.vb index cd6998db07c..07259a94491 100644 --- a/instat/ucrCore.vb +++ b/instat/ucrCore.vb @@ -20,7 +20,6 @@ Public Class ucrCore 'Function or Operator that this control's parameter is added/removed from Protected clsRCode As New RCodeStructure - Protected iParameterPosition As Integer = -1 'Parameter that this control manages 'Either by editing its value or adding/removing it from an RCodeStructure Protected clsParameter As RParameter @@ -203,7 +202,7 @@ Public Class ucrCore Public Overridable Sub AddOrRemoveParameter(bAdd As Boolean) If clsRCode IsNot Nothing AndAlso clsParameter IsNot Nothing Then If bAdd Then - clsRCode.AddParameter(clsParameter, iParameterPosition) + clsRCode.AddParameter(clsParameter) Else clsRCode.RemoveParameter(clsParameter) End If From 9ffb98cac08d23e1cd2e6ab8ad54c767947a3f4d Mon Sep 17 00:00:00 2001 From: Lily Date: Fri, 27 Jan 2017 14:59:12 +0000 Subject: [PATCH 40/72] File New --- instat/dlgFileNew.Designer.vb | 109 ++++++++++++++++---------------- instat/dlgFileNew.vb | 116 ++++++++++++++++++---------------- 2 files changed, 116 insertions(+), 109 deletions(-) diff --git a/instat/dlgFileNew.Designer.vb b/instat/dlgFileNew.Designer.vb index d9d4adff819..8c3de370acc 100644 --- a/instat/dlgFileNew.Designer.vb +++ b/instat/dlgFileNew.Designer.vb @@ -1,9 +1,9 @@ - _ + Partial Class dlgFileNew Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. - _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then @@ -20,17 +20,15 @@ Partial Class dlgFileNew 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. - _ + Private Sub InitializeComponent() Me.lblRows = New System.Windows.Forms.Label() Me.lblColumns = New System.Windows.Forms.Label() - Me.lblName = New System.Windows.Forms.Label() Me.ucrBase = New instat.ucrButtons() - Me.ucrName = New instat.ucrInputComboBox() - Me.nudRows = New System.Windows.Forms.NumericUpDown() - Me.nudColumns = New System.Windows.Forms.NumericUpDown() - CType(Me.nudRows, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.nudColumns, System.ComponentModel.ISupportInitialize).BeginInit() + Me.ucrNudRows = New instat.ucrNud() + Me.ucrNudCols = New instat.ucrNud() + Me.lblNewDataFrameName = New System.Windows.Forms.Label() + Me.ucrInputDataFrameName = New instat.ucrInputTextBox() Me.SuspendLayout() ' 'lblRows @@ -51,15 +49,6 @@ Partial Class dlgFileNew Me.lblColumns.TabIndex = 2 Me.lblColumns.Text = "Columns:" ' - 'lblName - ' - Me.lblName.AutoSize = True - Me.lblName.Location = New System.Drawing.Point(7, 78) - Me.lblName.Name = "lblName" - Me.lblName.Size = New System.Drawing.Size(94, 13) - Me.lblName.TabIndex = 4 - Me.lblName.Text = "New Sheet Name:" - ' 'ucrBase ' Me.ucrBase.Location = New System.Drawing.Point(10, 103) @@ -67,43 +56,55 @@ Partial Class dlgFileNew Me.ucrBase.Size = New System.Drawing.Size(399, 48) Me.ucrBase.TabIndex = 6 ' - 'ucrName - ' - Me.ucrName.IsReadOnly = False - Me.ucrName.Location = New System.Drawing.Point(107, 75) - Me.ucrName.Name = "ucrName" - Me.ucrName.Size = New System.Drawing.Size(137, 21) - Me.ucrName.TabIndex = 7 - ' - 'nudRows - ' - Me.nudRows.Location = New System.Drawing.Point(75, 12) - Me.nudRows.Maximum = New Decimal(New Integer() {32767, 0, 0, 0}) - Me.nudRows.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.nudRows.Name = "nudRows" - Me.nudRows.Size = New System.Drawing.Size(47, 20) - Me.nudRows.TabIndex = 8 - Me.nudRows.Value = New Decimal(New Integer() {1, 0, 0, 0}) - ' - 'nudColumns - ' - Me.nudColumns.Location = New System.Drawing.Point(75, 41) - Me.nudColumns.Maximum = New Decimal(New Integer() {32767, 0, 0, 0}) - Me.nudColumns.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.nudColumns.Name = "nudColumns" - Me.nudColumns.Size = New System.Drawing.Size(47, 20) - Me.nudColumns.TabIndex = 9 - Me.nudColumns.Value = New Decimal(New Integer() {1, 0, 0, 0}) + 'ucrNudRows + ' + Me.ucrNudRows.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudRows.Location = New System.Drawing.Point(73, 12) + Me.ucrNudRows.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudRows.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudRows.Name = "ucrNudRows" + Me.ucrNudRows.Size = New System.Drawing.Size(50, 20) + Me.ucrNudRows.TabIndex = 10 + Me.ucrNudRows.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudCols + ' + Me.ucrNudCols.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudCols.Location = New System.Drawing.Point(73, 40) + Me.ucrNudCols.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudCols.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudCols.Name = "ucrNudCols" + Me.ucrNudCols.Size = New System.Drawing.Size(50, 20) + Me.ucrNudCols.TabIndex = 11 + Me.ucrNudCols.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'lblNewDataFrameName + ' + Me.lblNewDataFrameName.AutoSize = True + Me.lblNewDataFrameName.Location = New System.Drawing.Point(10, 73) + Me.lblNewDataFrameName.Name = "lblNewDataFrameName" + Me.lblNewDataFrameName.Size = New System.Drawing.Size(121, 13) + Me.lblNewDataFrameName.TabIndex = 13 + Me.lblNewDataFrameName.Text = "New Data Frame Name:" + ' + 'ucrInputDataFrameName + ' + Me.ucrInputDataFrameName.IsMultiline = False + Me.ucrInputDataFrameName.IsReadOnly = False + Me.ucrInputDataFrameName.Location = New System.Drawing.Point(137, 70) + Me.ucrInputDataFrameName.Name = "ucrInputDataFrameName" + Me.ucrInputDataFrameName.Size = New System.Drawing.Size(137, 21) + Me.ucrInputDataFrameName.TabIndex = 14 ' 'dlgFileNew ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(418, 162) - Me.Controls.Add(Me.nudColumns) - Me.Controls.Add(Me.nudRows) - Me.Controls.Add(Me.ucrName) - Me.Controls.Add(Me.lblName) + Me.Controls.Add(Me.ucrInputDataFrameName) + Me.Controls.Add(Me.lblNewDataFrameName) + Me.Controls.Add(Me.ucrNudCols) + Me.Controls.Add(Me.ucrNudRows) Me.Controls.Add(Me.lblColumns) Me.Controls.Add(Me.lblRows) Me.Controls.Add(Me.ucrBase) @@ -113,18 +114,16 @@ Partial Class dlgFileNew Me.Name = "dlgFileNew" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "New File" - CType(Me.nudRows, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.nudColumns, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents ucrBase As ucrButtons - Friend WithEvents lblName As Label Friend WithEvents lblColumns As Label Friend WithEvents lblRows As Label - Friend WithEvents ucrName As ucrInputComboBox - Friend WithEvents nudRows As NumericUpDown - Friend WithEvents nudColumns As NumericUpDown + Friend WithEvents ucrNudRows As ucrNud + Friend WithEvents ucrNudCols As ucrNud + Friend WithEvents lblNewDataFrameName As Label + Friend WithEvents ucrInputDataFrameName As ucrInputTextBox End Class diff --git a/instat/dlgFileNew.vb b/instat/dlgFileNew.vb index 338b76fd265..3f7e58817bb 100644 --- a/instat/dlgFileNew.vb +++ b/instat/dlgFileNew.vb @@ -1,24 +1,25 @@ -' Instat-R -' Copyright (C) 2015 -' -' 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 k -' along with this program. If not, see . +' Instat-R +' Copyright (C) 2015 +' +' 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 k +' along with this program. If not, see . +Imports instat Imports instat.Translations Imports RDotNet Public Class dlgFileNew - Public clsMatrix As New RFunction Public strDefaultSheetPrefix As String = "Sheet" + Private clsOverallFunction, clsMatrixDefaultFunction, clsMatrixFunction As New RFunction Public bFirstLoad As Boolean = True Private Sub dlgFileNew_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -35,54 +36,61 @@ Public Class dlgFileNew TestOKEnabled() End Sub - Private Sub InitialiseDialog() - ucrBase.iHelpTopicID = 6 - clsMatrix.SetRCommand("matrix") - clsMatrix.AddParameter("data", "NA") - ucrBase.clsRsyntax.SetFunction("data.frame") - ucrBase.clsRsyntax.AddParameter("data", clsRFunctionParameter:=clsMatrix) - nudRows.Maximum = Integer.MaxValue - nudRows.Minimum = 1 - nudColumns.Maximum = Integer.MaxValue - nudColumns.Minimum = 1 - 'ucrName.SetDefaultTypeAsDataFrame() This can be added in when the code is written - ucrName.SetValidationTypeAsRVariable() + Private Sub InitialiseDialog() + ucrBase.iHelpTopicID = 6 + + 'nudRows + ucrNudRows.SetParameter(New RParameter("nrow")) + ucrNudRows.SetMinMax(1, Integer.MaxValue) + + 'nudCols + ucrNudCols.SetParameter(New RParameter("ncol")) + ucrNudCols.SetMinMax(1, Integer.MaxValue) + + ' ucrNewSheetName + ucrInputDataFrameName.SetValidationTypeAsRVariable() + ucrInputDataFrameName.SetDefaultTypeAsDataFrame() + ucrInputDataFrameName.SetName(strName:=frmMain.clsRLink.GetDefaultDataFrameName(strDefaultSheetPrefix)) + + ' Default R + clsOverallFunction.SetRCommand("data.frame") + clsOverallFunction.AddParameter("data", clsRFunctionParameter:=clsMatrixFunction) + clsOverallFunction.SetAssignTo(ucrInputDataFrameName.GetText(), strTempDataframe:=ucrInputDataFrameName.GetText()) + + 'matrix(nrow = 10, ncol = 2, Data = NA) + clsMatrixDefaultFunction.SetRCommand("matrix") + clsMatrixDefaultFunction.AddParameter("data", "NA") + clsMatrixDefaultFunction.AddParameter("ncol", 2) + clsMatrixDefaultFunction.AddParameter("nrow", 10) + End Sub Private Sub ReopenDialog() - ucrName.SetName(strName:=frmMain.clsRLink.GetDefaultDataFrameName(strDefaultSheetPrefix)) + 'ucrName.SetName(strName:=frmMain.clsRLink.GetDefaultDataFrameName(strDefaultSheetPrefix)) End Sub - Private Sub SetDefaults() - nudRows.Value = 10 - nudColumns.Value = 2 - ucrName.SetName(strName:=frmMain.clsRLink.GetDefaultDataFrameName(strDefaultSheetPrefix)) + Private Sub SetDefaults() + ucrInputDataFrameName.SetName(strName:=frmMain.clsRLink.GetDefaultDataFrameName(strDefaultSheetPrefix)) + ucrBase.clsRsyntax.SetBaseRFunction(clsOverallFunction.Clone()) + SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) + clsMatrixFunction = clsMatrixDefaultFunction.Clone() + TestOKEnabled() End Sub - Private Sub nudColumns_TextChanged(sender As Object, e As EventArgs) Handles nudColumns.TextChanged - clsMatrix.AddParameter("ncol", nudColumns.Value.ToString()) - TestOKEnabled() - End Sub - Private Sub nudRows_TextChanged(sender As Object, e As EventArgs) Handles nudRows.TextChanged - clsMatrix.AddParameter("nrow", nudRows.Value.ToString()) - TestOKEnabled() - End Sub - - Private Sub TestOKEnabled() - If Not ucrName.IsEmpty AndAlso nudColumns.Text <> "" AndAlso nudRows.Text <> "" Then - ucrBase.OKEnabled(True) - Else - ucrBase.OKEnabled(False) - End If + Private Sub TestOKEnabled() + ' If Not ucrInputDataFrameName.IsEmpty AndAlso ucrNudCols.Text <> "" AndAlso ucrNudRows.Text <> "" Then + ' ucrBase.OKEnabled(True) + ' Else + ' ucrBase.OKEnabled(False) + ' End If End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() - End Sub - - Private Sub ucrName_NameChanged() Handles ucrName.NameChanged - ucrBase.clsRsyntax.SetAssignTo(ucrName.GetText(), strTempDataframe:=ucrName.GetText()) - TestOKEnabled() - End Sub + End Sub + + Private Sub ucrInputDataFrameName_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInputDataFrameName.ControlContentsChanged, ucrNudRows.ControlContentsChanged, ucrNudCols.ControlContentsChanged + TestOKEnabled() + End Sub End Class \ No newline at end of file From b92cfa98a9855c546dc2ba30c1b70179d8839c23 Mon Sep 17 00:00:00 2001 From: Lily Date: Fri, 27 Jan 2017 15:04:12 +0000 Subject: [PATCH 41/72] testOKenabled --- instat/dlgFileNew.vb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/instat/dlgFileNew.vb b/instat/dlgFileNew.vb index 3f7e58817bb..7f4f629ff55 100644 --- a/instat/dlgFileNew.vb +++ b/instat/dlgFileNew.vb @@ -77,13 +77,12 @@ Public Class dlgFileNew TestOKEnabled() End Sub - Private Sub TestOKEnabled() - ' If Not ucrInputDataFrameName.IsEmpty AndAlso ucrNudCols.Text <> "" AndAlso ucrNudRows.Text <> "" Then - ' ucrBase.OKEnabled(True) - ' Else - ' ucrBase.OKEnabled(False) - ' End If + If Not ucrInputDataFrameName.IsEmpty AndAlso ucrNudCols.GetText <> "" AndAlso ucrNudRows.GetText <> "" Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset @@ -93,4 +92,7 @@ Public Class dlgFileNew Private Sub ucrInputDataFrameName_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInputDataFrameName.ControlContentsChanged, ucrNudRows.ControlContentsChanged, ucrNudCols.ControlContentsChanged TestOKEnabled() End Sub + + + End Class \ No newline at end of file From d972ecf2d930f2d0542e0c2aa4612c21b62f22b7 Mon Sep 17 00:00:00 2001 From: Lily Date: Fri, 27 Jan 2017 16:06:23 +0000 Subject: [PATCH 42/72] Changes so far --- instat/dlgFileNew.Designer.vb | 30 ++++++++---------------------- instat/dlgFileNew.vb | 32 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 38 deletions(-) diff --git a/instat/dlgFileNew.Designer.vb b/instat/dlgFileNew.Designer.vb index 8c3de370acc..25d3d542aab 100644 --- a/instat/dlgFileNew.Designer.vb +++ b/instat/dlgFileNew.Designer.vb @@ -27,8 +27,7 @@ Partial Class dlgFileNew Me.ucrBase = New instat.ucrButtons() Me.ucrNudRows = New instat.ucrNud() Me.ucrNudCols = New instat.ucrNud() - Me.lblNewDataFrameName = New System.Windows.Forms.Label() - Me.ucrInputDataFrameName = New instat.ucrInputTextBox() + Me.ucrNewDFName = New instat.ucrSave() Me.SuspendLayout() ' 'lblRows @@ -78,31 +77,19 @@ Partial Class dlgFileNew Me.ucrNudCols.TabIndex = 11 Me.ucrNudCols.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' - 'lblNewDataFrameName + 'ucrNewDFName ' - Me.lblNewDataFrameName.AutoSize = True - Me.lblNewDataFrameName.Location = New System.Drawing.Point(10, 73) - Me.lblNewDataFrameName.Name = "lblNewDataFrameName" - Me.lblNewDataFrameName.Size = New System.Drawing.Size(121, 13) - Me.lblNewDataFrameName.TabIndex = 13 - Me.lblNewDataFrameName.Text = "New Data Frame Name:" - ' - 'ucrInputDataFrameName - ' - Me.ucrInputDataFrameName.IsMultiline = False - Me.ucrInputDataFrameName.IsReadOnly = False - Me.ucrInputDataFrameName.Location = New System.Drawing.Point(137, 70) - Me.ucrInputDataFrameName.Name = "ucrInputDataFrameName" - Me.ucrInputDataFrameName.Size = New System.Drawing.Size(137, 21) - Me.ucrInputDataFrameName.TabIndex = 14 + Me.ucrNewDFName.Location = New System.Drawing.Point(10, 73) + Me.ucrNewDFName.Name = "ucrNewDFName" + Me.ucrNewDFName.Size = New System.Drawing.Size(300, 24) + Me.ucrNewDFName.TabIndex = 12 ' 'dlgFileNew ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(418, 162) - Me.Controls.Add(Me.ucrInputDataFrameName) - Me.Controls.Add(Me.lblNewDataFrameName) + Me.Controls.Add(Me.ucrNewDFName) Me.Controls.Add(Me.ucrNudCols) Me.Controls.Add(Me.ucrNudRows) Me.Controls.Add(Me.lblColumns) @@ -124,6 +111,5 @@ Partial Class dlgFileNew Friend WithEvents lblRows As Label Friend WithEvents ucrNudRows As ucrNud Friend WithEvents ucrNudCols As ucrNud - Friend WithEvents lblNewDataFrameName As Label - Friend WithEvents ucrInputDataFrameName As ucrInputTextBox + Friend WithEvents ucrNewDFName As ucrSave End Class diff --git a/instat/dlgFileNew.vb b/instat/dlgFileNew.vb index 7f4f629ff55..fb23e1d4779 100644 --- a/instat/dlgFileNew.vb +++ b/instat/dlgFileNew.vb @@ -48,14 +48,16 @@ Public Class dlgFileNew ucrNudCols.SetMinMax(1, Integer.MaxValue) ' ucrNewSheetName - ucrInputDataFrameName.SetValidationTypeAsRVariable() - ucrInputDataFrameName.SetDefaultTypeAsDataFrame() - ucrInputDataFrameName.SetName(strName:=frmMain.clsRLink.GetDefaultDataFrameName(strDefaultSheetPrefix)) + ucrNewDFName.SetIsTextBox() + ucrNewDFName.SetSaveTypeAsColumn() + ucrNewDFName.SetAssignToBooleans(bTempAssignToIsPrefix:=True) + 'ucrNewDFName.Set(strName:=frmMain.clsRLink.GetDefaultDataFrameName(strDefaultSheetPrefix)) + ucrNewDFName.SetLabelText("New Data Frame Name:") ' Default R clsOverallFunction.SetRCommand("data.frame") clsOverallFunction.AddParameter("data", clsRFunctionParameter:=clsMatrixFunction) - clsOverallFunction.SetAssignTo(ucrInputDataFrameName.GetText(), strTempDataframe:=ucrInputDataFrameName.GetText()) + clsOverallFunction.SetAssignTo(ucrNewDFName.GetText(), strTempDataframe:=ucrNewDFName.GetText()) 'matrix(nrow = 10, ncol = 2, Data = NA) clsMatrixDefaultFunction.SetRCommand("matrix") @@ -70,29 +72,27 @@ Public Class dlgFileNew End Sub Private Sub SetDefaults() - ucrInputDataFrameName.SetName(strName:=frmMain.clsRLink.GetDefaultDataFrameName(strDefaultSheetPrefix)) - ucrBase.clsRsyntax.SetBaseRFunction(clsOverallFunction.Clone()) - SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) + ' ucrBase.clsRsyntax.SetBaseRFunction(clsOverallFunction.Clone()) + clsMatrixFunction = clsMatrixDefaultFunction.Clone() + SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) + SetRCode(Me, clsMatrixFunction, True) TestOKEnabled() End Sub Private Sub TestOKEnabled() - If Not ucrInputDataFrameName.IsEmpty AndAlso ucrNudCols.GetText <> "" AndAlso ucrNudRows.GetText <> "" Then - ucrBase.OKEnabled(True) - Else - ucrBase.OKEnabled(False) - End If + ' If ucrNewDFName.IsComplete AndAlso ucrNudCols.GetText <> "" AndAlso ucrNudRows.GetText <> "" Then + ' ucrBase.OKEnabled(True) + ' Else + ' ucrBase.OKEnabled(False) + ' End If End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() End Sub - Private Sub ucrInputDataFrameName_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInputDataFrameName.ControlContentsChanged, ucrNudRows.ControlContentsChanged, ucrNudCols.ControlContentsChanged + Private Sub ucrInputDataFrameName_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrNudRows.ControlContentsChanged, ucrNudCols.ControlContentsChanged TestOKEnabled() End Sub - - - End Class \ No newline at end of file From d1182b8398bb7c9849037df508b5295ad5fd9568 Mon Sep 17 00:00:00 2001 From: Lily Date: Fri, 27 Jan 2017 16:16:44 +0000 Subject: [PATCH 43/72] Update for now --- instat/dlgFileNew.vb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/instat/dlgFileNew.vb b/instat/dlgFileNew.vb index fb23e1d4779..04244b46694 100644 --- a/instat/dlgFileNew.vb +++ b/instat/dlgFileNew.vb @@ -49,9 +49,8 @@ Public Class dlgFileNew ' ucrNewSheetName ucrNewDFName.SetIsTextBox() - ucrNewDFName.SetSaveTypeAsColumn() + ucrNewDFName.SetSaveTypeAsDataFrame() ucrNewDFName.SetAssignToBooleans(bTempAssignToIsPrefix:=True) - 'ucrNewDFName.Set(strName:=frmMain.clsRLink.GetDefaultDataFrameName(strDefaultSheetPrefix)) ucrNewDFName.SetLabelText("New Data Frame Name:") ' Default R @@ -68,12 +67,10 @@ Public Class dlgFileNew End Sub Private Sub ReopenDialog() - 'ucrName.SetName(strName:=frmMain.clsRLink.GetDefaultDataFrameName(strDefaultSheetPrefix)) End Sub Private Sub SetDefaults() - ' ucrBase.clsRsyntax.SetBaseRFunction(clsOverallFunction.Clone()) - + ucrBase.clsRsyntax.SetBaseRFunction(clsOverallFunction.Clone()) clsMatrixFunction = clsMatrixDefaultFunction.Clone() SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) SetRCode(Me, clsMatrixFunction, True) From fb8e7a0ca1dcaa57ff96d5330bd78853a5d6f13d Mon Sep 17 00:00:00 2001 From: Lily Date: Fri, 27 Jan 2017 16:21:24 +0000 Subject: [PATCH 44/72] . --- instat/dlgFileNew.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgFileNew.vb b/instat/dlgFileNew.vb index 04244b46694..c8c45264b55 100644 --- a/instat/dlgFileNew.vb +++ b/instat/dlgFileNew.vb @@ -70,7 +70,7 @@ Public Class dlgFileNew End Sub Private Sub SetDefaults() - ucrBase.clsRsyntax.SetBaseRFunction(clsOverallFunction.Clone()) + ucrBase.clsRsyntax.SetBaseRFunction(clsOverallFunction) clsMatrixFunction = clsMatrixDefaultFunction.Clone() SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) SetRCode(Me, clsMatrixFunction, True) From 82dcd50b9fd16ac99c65fb2b368e1d9261542b50 Mon Sep 17 00:00:00 2001 From: Lily Date: Fri, 27 Jan 2017 16:28:19 +0000 Subject: [PATCH 45/72] . --- instat/dlgFileNew.vb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instat/dlgFileNew.vb b/instat/dlgFileNew.vb index c8c45264b55..59989bd3f1c 100644 --- a/instat/dlgFileNew.vb +++ b/instat/dlgFileNew.vb @@ -55,7 +55,7 @@ Public Class dlgFileNew ' Default R clsOverallFunction.SetRCommand("data.frame") - clsOverallFunction.AddParameter("data", clsRFunctionParameter:=clsMatrixFunction) + clsOverallFunction.AddParameter("data", clsRFunctionParameter:=clsMatrixDefaultFunction) clsOverallFunction.SetAssignTo(ucrNewDFName.GetText(), strTempDataframe:=ucrNewDFName.GetText()) 'matrix(nrow = 10, ncol = 2, Data = NA) @@ -64,6 +64,7 @@ Public Class dlgFileNew clsMatrixDefaultFunction.AddParameter("ncol", 2) clsMatrixDefaultFunction.AddParameter("nrow", 10) + 'data.frame(data=()) End Sub Private Sub ReopenDialog() From 85c769eb56149808809a460c7105f24634ed593d Mon Sep 17 00:00:00 2001 From: Lily Date: Fri, 27 Jan 2017 16:35:44 +0000 Subject: [PATCH 46/72] Bug Fixes --- instat/dlgFileNew.vb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/instat/dlgFileNew.vb b/instat/dlgFileNew.vb index 59989bd3f1c..6c031c25124 100644 --- a/instat/dlgFileNew.vb +++ b/instat/dlgFileNew.vb @@ -56,18 +56,23 @@ Public Class dlgFileNew ' Default R clsOverallFunction.SetRCommand("data.frame") clsOverallFunction.AddParameter("data", clsRFunctionParameter:=clsMatrixDefaultFunction) - clsOverallFunction.SetAssignTo(ucrNewDFName.GetText(), strTempDataframe:=ucrNewDFName.GetText()) + 'clsOverallFunction.SetAssignTo(ucrNewDFName.GetText(), strTempDataframe:=ucrNewDFName.GetText()) + clsOverallFunction.SetAssignTo(strTemp:="Sheet", strTempDataframe:="Sheet", bAssignToIsPrefix:=True) + 'clsDefaultFunction.SetAssignTo(strTemp:="Split", strTempDataframe:=ucrSelectorSplitTextColumn.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempColumn:="Split", bAssignToIsPrefix:=True) + 'matrix(nrow = 10, ncol = 2, Data = NA) clsMatrixDefaultFunction.SetRCommand("matrix") clsMatrixDefaultFunction.AddParameter("data", "NA") clsMatrixDefaultFunction.AddParameter("ncol", 2) clsMatrixDefaultFunction.AddParameter("nrow", 10) + End Sub - 'data.frame(data=()) - End Sub + + 'data.frame(data=matrix(nrow=10, ncol=2, data=NA)) Private Sub ReopenDialog() + End Sub Private Sub SetDefaults() From 85fab5ca2ef3a1ac59ee7eb685728bf0e47db684 Mon Sep 17 00:00:00 2001 From: Lily Date: Sun, 29 Jan 2017 10:29:37 +0000 Subject: [PATCH 47/72] Changes --- instat/dlgFileNew.vb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/instat/dlgFileNew.vb b/instat/dlgFileNew.vb index 6c031c25124..11437211869 100644 --- a/instat/dlgFileNew.vb +++ b/instat/dlgFileNew.vb @@ -56,10 +56,7 @@ Public Class dlgFileNew ' Default R clsOverallFunction.SetRCommand("data.frame") clsOverallFunction.AddParameter("data", clsRFunctionParameter:=clsMatrixDefaultFunction) - 'clsOverallFunction.SetAssignTo(ucrNewDFName.GetText(), strTempDataframe:=ucrNewDFName.GetText()) clsOverallFunction.SetAssignTo(strTemp:="Sheet", strTempDataframe:="Sheet", bAssignToIsPrefix:=True) - 'clsDefaultFunction.SetAssignTo(strTemp:="Split", strTempDataframe:=ucrSelectorSplitTextColumn.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempColumn:="Split", bAssignToIsPrefix:=True) - 'matrix(nrow = 10, ncol = 2, Data = NA) clsMatrixDefaultFunction.SetRCommand("matrix") @@ -67,9 +64,6 @@ Public Class dlgFileNew clsMatrixDefaultFunction.AddParameter("ncol", 2) clsMatrixDefaultFunction.AddParameter("nrow", 10) End Sub - - - 'data.frame(data=matrix(nrow=10, ncol=2, data=NA)) Private Sub ReopenDialog() From 4ce0c227d1a19da5602a340ac32d3ed90b4a509b Mon Sep 17 00:00:00 2001 From: Lily Date: Sun, 29 Jan 2017 11:17:00 +0000 Subject: [PATCH 48/72] Cleaned up code --- instat/dlgFileNew.vb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/instat/dlgFileNew.vb b/instat/dlgFileNew.vb index 11437211869..18608768396 100644 --- a/instat/dlgFileNew.vb +++ b/instat/dlgFileNew.vb @@ -18,7 +18,6 @@ Imports instat.Translations Imports RDotNet Public Class dlgFileNew - Public strDefaultSheetPrefix As String = "Sheet" Private clsOverallFunction, clsMatrixDefaultFunction, clsMatrixFunction As New RFunction Public bFirstLoad As Boolean = True @@ -65,8 +64,10 @@ Public Class dlgFileNew clsMatrixDefaultFunction.AddParameter("nrow", 10) End Sub - Private Sub ReopenDialog() + ' updating controls doesn't update the function + ' Sheet name is not on the dialog. + Private Sub ReopenDialog() End Sub Private Sub SetDefaults() @@ -78,18 +79,18 @@ Public Class dlgFileNew End Sub Private Sub TestOKEnabled() - ' If ucrNewDFName.IsComplete AndAlso ucrNudCols.GetText <> "" AndAlso ucrNudRows.GetText <> "" Then - ' ucrBase.OKEnabled(True) - ' Else - ' ucrBase.OKEnabled(False) - ' End If + If ucrNewDFName.IsComplete AndAlso ucrNudCols.GetText <> "" AndAlso ucrNudRows.GetText <> "" Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() End Sub - Private Sub ucrInputDataFrameName_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrNudRows.ControlContentsChanged, ucrNudCols.ControlContentsChanged + Private Sub ucrInputDataFrameName_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrNudRows.ControlContentsChanged, ucrNudCols.ControlContentsChanged, ucrNewDFName.ControlContentsChanged TestOKEnabled() End Sub End Class \ No newline at end of file From 8fa9c3ff7f429876d26bc37b8d57e50a7bb09447 Mon Sep 17 00:00:00 2001 From: Lily Date: Sun, 29 Jan 2017 11:31:22 +0000 Subject: [PATCH 49/72] . --- instat/dlgFileNew.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgFileNew.vb b/instat/dlgFileNew.vb index 18608768396..b5ab6318a63 100644 --- a/instat/dlgFileNew.vb +++ b/instat/dlgFileNew.vb @@ -74,7 +74,7 @@ Public Class dlgFileNew ucrBase.clsRsyntax.SetBaseRFunction(clsOverallFunction) clsMatrixFunction = clsMatrixDefaultFunction.Clone() SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) - SetRCode(Me, clsMatrixFunction, True) + SetRCode(Me, clsMatrixDefaultFunction, True) TestOKEnabled() End Sub From 0511176a1c095b1b8df2e0d540d29810fe22130b Mon Sep 17 00:00:00 2001 From: Lily Date: Sun, 29 Jan 2017 14:53:09 +0000 Subject: [PATCH 50/72] Tab Order --- instat/dlgFileNew.Designer.vb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/instat/dlgFileNew.Designer.vb b/instat/dlgFileNew.Designer.vb index 25d3d542aab..64e82ac9d39 100644 --- a/instat/dlgFileNew.Designer.vb +++ b/instat/dlgFileNew.Designer.vb @@ -53,7 +53,7 @@ Partial Class dlgFileNew Me.ucrBase.Location = New System.Drawing.Point(10, 103) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(399, 48) - Me.ucrBase.TabIndex = 6 + Me.ucrBase.TabIndex = 5 ' 'ucrNudRows ' @@ -63,7 +63,7 @@ Partial Class dlgFileNew Me.ucrNudRows.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudRows.Name = "ucrNudRows" Me.ucrNudRows.Size = New System.Drawing.Size(50, 20) - Me.ucrNudRows.TabIndex = 10 + Me.ucrNudRows.TabIndex = 1 Me.ucrNudRows.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' 'ucrNudCols @@ -74,7 +74,7 @@ Partial Class dlgFileNew Me.ucrNudCols.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudCols.Name = "ucrNudCols" Me.ucrNudCols.Size = New System.Drawing.Size(50, 20) - Me.ucrNudCols.TabIndex = 11 + Me.ucrNudCols.TabIndex = 3 Me.ucrNudCols.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' 'ucrNewDFName @@ -82,7 +82,7 @@ Partial Class dlgFileNew Me.ucrNewDFName.Location = New System.Drawing.Point(10, 73) Me.ucrNewDFName.Name = "ucrNewDFName" Me.ucrNewDFName.Size = New System.Drawing.Size(300, 24) - Me.ucrNewDFName.TabIndex = 12 + Me.ucrNewDFName.TabIndex = 4 ' 'dlgFileNew ' From 3f8cf5d9d84226e4748cc9865f445680ad4aa4d3 Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Mon, 30 Jan 2017 08:57:08 +0300 Subject: [PATCH 51/72] Resetting save graph control --- instat/dlgInventoryPlot.vb | 1 + 1 file changed, 1 insertion(+) diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index adc0216a296..4bd3b905bf4 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -97,6 +97,7 @@ Public Class dlgInventoryPlot Private Sub SetDefaults() ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultRFunction.Clone()) ucrInventoryPlotSelector.Reset() + ucrSaveGraph.Reset() SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) ucrYearReceiver.SetMeAsReceiver() TestOkEnabled() From c7d544a12e720af5fcec17fbc4ad5e345c272e00 Mon Sep 17 00:00:00 2001 From: Lily Date: Mon, 30 Jan 2017 10:17:09 +0000 Subject: [PATCH 52/72] updated --- instat/dlgFileNew.vb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/instat/dlgFileNew.vb b/instat/dlgFileNew.vb index b5ab6318a63..68e6433d6d9 100644 --- a/instat/dlgFileNew.vb +++ b/instat/dlgFileNew.vb @@ -51,11 +51,11 @@ Public Class dlgFileNew ucrNewDFName.SetSaveTypeAsDataFrame() ucrNewDFName.SetAssignToBooleans(bTempAssignToIsPrefix:=True) ucrNewDFName.SetLabelText("New Data Frame Name:") + ucrNewDFName.SetPrefix("data") ' Default R clsOverallFunction.SetRCommand("data.frame") - clsOverallFunction.AddParameter("data", clsRFunctionParameter:=clsMatrixDefaultFunction) - clsOverallFunction.SetAssignTo(strTemp:="Sheet", strTempDataframe:="Sheet", bAssignToIsPrefix:=True) + ' clsOverallFunction.SetAssignTo(strTemp:="Sheet", strTempDataframe:="Sheet", bAssignToIsPrefix:=True) 'matrix(nrow = 10, ncol = 2, Data = NA) clsMatrixDefaultFunction.SetRCommand("matrix") @@ -73,8 +73,10 @@ Public Class dlgFileNew Private Sub SetDefaults() ucrBase.clsRsyntax.SetBaseRFunction(clsOverallFunction) clsMatrixFunction = clsMatrixDefaultFunction.Clone() - SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) - SetRCode(Me, clsMatrixDefaultFunction, True) + clsOverallFunction.AddParameter("data", clsRFunctionParameter:=clsMatrixFunction) + ucrNudCols.SetRCode(clsMatrixFunction) + ucrNudRows.SetRCode(clsMatrixFunction) + ucrNewDFName.SetRCode(clsOverallFunction) TestOKEnabled() End Sub From 13fdd722bdc41c1a3f0ee3e7f4bf6526c697b0d2 Mon Sep 17 00:00:00 2001 From: Lily Date: Mon, 30 Jan 2017 10:30:35 +0000 Subject: [PATCH 53/72] update --- instat/dlgFileNew.vb | 2 +- instat/ucrSave.vb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/dlgFileNew.vb b/instat/dlgFileNew.vb index 68e6433d6d9..63e6a94f6ad 100644 --- a/instat/dlgFileNew.vb +++ b/instat/dlgFileNew.vb @@ -55,7 +55,6 @@ Public Class dlgFileNew ' Default R clsOverallFunction.SetRCommand("data.frame") - ' clsOverallFunction.SetAssignTo(strTemp:="Sheet", strTempDataframe:="Sheet", bAssignToIsPrefix:=True) 'matrix(nrow = 10, ncol = 2, Data = NA) clsMatrixDefaultFunction.SetRCommand("matrix") @@ -77,6 +76,7 @@ Public Class dlgFileNew ucrNudCols.SetRCode(clsMatrixFunction) ucrNudRows.SetRCode(clsMatrixFunction) ucrNewDFName.SetRCode(clsOverallFunction) + ucrNewDFName.Reset() TestOKEnabled() End Sub diff --git a/instat/ucrSave.vb b/instat/ucrSave.vb index c989302c9ee..5e0738bc527 100644 --- a/instat/ucrSave.vb +++ b/instat/ucrSave.vb @@ -225,7 +225,7 @@ Public Class ucrSave Case "column" clsRCode.SetAssignTo(strTemp:=strSaveName, strTempDataframe:=strDataName, strTempColumn:=strSaveName, bAssignToIsPrefix:=bAssignToIsPrefix, bAssignToColumnWithoutNames:=bAssignToColumnWithoutNames, bInsertColumnBefore:=bInsertColumnBefore) Case "dataframe" - clsRCode.SetAssignTo(strTemp:=strSaveName, strTempDataframe:=strDataName, bAssignToIsPrefix:=bAssignToIsPrefix) + clsRCode.SetAssignTo(strTemp:=strSaveName, strTempDataframe:=strSaveName, bAssignToIsPrefix:=bAssignToIsPrefix) Case "graph" clsRCode.SetAssignTo(strTemp:=strSaveName, strTempDataframe:=strDataName, strTempGraph:=strSaveName, bAssignToIsPrefix:=bAssignToIsPrefix) Case "model" From 2ba0393f129fa92448ff3c4d43c2f6ae7cf3f69a Mon Sep 17 00:00:00 2001 From: Lily Date: Mon, 30 Jan 2017 12:50:12 +0000 Subject: [PATCH 54/72] deleted line --- instat/dlgFileNew.vb | 1 - 1 file changed, 1 deletion(-) diff --git a/instat/dlgFileNew.vb b/instat/dlgFileNew.vb index 63e6a94f6ad..9c103dc2164 100644 --- a/instat/dlgFileNew.vb +++ b/instat/dlgFileNew.vb @@ -49,7 +49,6 @@ Public Class dlgFileNew ' ucrNewSheetName ucrNewDFName.SetIsTextBox() ucrNewDFName.SetSaveTypeAsDataFrame() - ucrNewDFName.SetAssignToBooleans(bTempAssignToIsPrefix:=True) ucrNewDFName.SetLabelText("New Data Frame Name:") ucrNewDFName.SetPrefix("data") From f5fead90c7f5c75d6b62ad3019a399acfbe1d7df Mon Sep 17 00:00:00 2001 From: Danny Parsons Date: Mon, 30 Jan 2017 12:54:23 +0000 Subject: [PATCH 55/72] created condition class --- instat/clsCondition.vb | 32 ++++++++++++++++++++++++++++++++ instat/instat.vbproj | 1 + 2 files changed, 33 insertions(+) create mode 100644 instat/clsCondition.vb diff --git a/instat/clsCondition.vb b/instat/clsCondition.vb new file mode 100644 index 00000000000..9d2188caff5 --- /dev/null +++ b/instat/clsCondition.vb @@ -0,0 +1,32 @@ +Public Class Condition + Private strType As String = "ParameterValue" + Private strParameterName As String = "" + Private lstValues As List(Of String) = New List(Of String) + + Public Sub SetParameterPresentName(strParamName As String) + strType = "ParameterPresent" + strParameterName = strParamName + End Sub + + Public Sub SetParameterValues(strParamName As String, lstParamValues As List(Of String)) + strType = "ParameterValue" + strParameterName = strParamName + lstValues = lstParamValues + End Sub + + Public Sub SetParameterValues(strParamName As String, strParamValues As String) + strType = "ParameterValue" + strParameterName = strParamName + lstValues = New List(Of String)({strParamValues}) + End Sub + + Public Sub SetFunctionName(strFuncName As String) + strType = "FunctionName" + lstValues = New List(Of String)({strFuncName}) + End Sub + + Public Sub SetFunctionNamesMultiple(lstFuncNames As List(Of String)) + strType = "FunctionName" + lstValues = lstFuncNames + End Sub +End Class diff --git a/instat/instat.vbproj b/instat/instat.vbproj index 44f21ff083a..cecb793a427 100644 --- a/instat/instat.vbproj +++ b/instat/instat.vbproj @@ -147,6 +147,7 @@ + dlgAddComment.vb From cbefe41e04c3c7b39222c8721e8907f620f80e79 Mon Sep 17 00:00:00 2001 From: Lily Date: Mon, 30 Jan 2017 17:25:14 +0000 Subject: [PATCH 56/72] dlgAppend --- instat/dlgAppend.Designer.vb | 93 +++++++++++++++------------------ instat/dlgAppend.vb | 99 +++++++++++++++++------------------- 2 files changed, 87 insertions(+), 105 deletions(-) diff --git a/instat/dlgAppend.Designer.vb b/instat/dlgAppend.Designer.vb index b6daf37c214..761bae927c2 100644 --- a/instat/dlgAppend.Designer.vb +++ b/instat/dlgAppend.Designer.vb @@ -1,9 +1,9 @@ - _ + Partial Class dlgAppend Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. - _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then @@ -20,18 +20,17 @@ Partial Class dlgAppend 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. - _ + Private Sub InitializeComponent() Me.lblAppendToDataframe = New System.Windows.Forms.Label() Me.lblDataframes = New System.Windows.Forms.Label() - Me.lblIDColNAme = New System.Windows.Forms.Label() - Me.chkIncludeIDColumn = New System.Windows.Forms.CheckBox() - Me.lblNewDataframeName = New System.Windows.Forms.Label() - Me.ucrInputNewDataframeName = New instat.ucrInputTextBox() + Me.lblIDColName = New System.Windows.Forms.Label() Me.ucrInputIDColName = New instat.ucrInputTextBox() Me.ucrReceiverAppendDataframe = New instat.ucrReceiverMultiple() Me.ucrSelectorDataframes = New instat.ucrSelectorAddRemove() Me.ucrBase = New instat.ucrButtons() + Me.ucrSaveGraph = New instat.ucrSave() + Me.ucrChkIncludeIDColumn = New instat.ucrCheck() Me.SuspendLayout() ' 'lblAppendToDataframe @@ -52,52 +51,27 @@ Partial Class dlgAppend Me.lblDataframes.TabIndex = 4 Me.lblDataframes.Text = "Data Frames:" ' - 'lblIDColNAme + 'lblIDColName ' - Me.lblIDColNAme.AutoSize = True - Me.lblIDColNAme.Location = New System.Drawing.Point(128, 266) - Me.lblIDColNAme.Name = "lblIDColNAme" - Me.lblIDColNAme.Size = New System.Drawing.Size(90, 13) - Me.lblIDColNAme.TabIndex = 3 - Me.lblIDColNAme.Text = "ID Column Name:" - ' - 'chkIncludeIDColumn - ' - Me.chkIncludeIDColumn.AutoSize = True - Me.chkIncludeIDColumn.Location = New System.Drawing.Point(10, 265) - Me.chkIncludeIDColumn.Name = "chkIncludeIDColumn" - Me.chkIncludeIDColumn.Size = New System.Drawing.Size(113, 17) - Me.chkIncludeIDColumn.TabIndex = 5 - Me.chkIncludeIDColumn.Text = "Include ID Column" - Me.chkIncludeIDColumn.UseVisualStyleBackColor = True - ' - 'lblNewDataframeName - ' - Me.lblNewDataframeName.AutoSize = True - Me.lblNewDataframeName.Location = New System.Drawing.Point(8, 236) - Me.lblNewDataframeName.Name = "lblNewDataframeName" - Me.lblNewDataframeName.Size = New System.Drawing.Size(121, 13) - Me.lblNewDataframeName.TabIndex = 7 - Me.lblNewDataframeName.Text = "New Data Frame Name:" - ' - 'ucrInputNewDataframeName - ' - Me.ucrInputNewDataframeName.IsReadOnly = False - Me.ucrInputNewDataframeName.Location = New System.Drawing.Point(132, 233) - Me.ucrInputNewDataframeName.Name = "ucrInputNewDataframeName" - Me.ucrInputNewDataframeName.Size = New System.Drawing.Size(234, 21) - Me.ucrInputNewDataframeName.TabIndex = 8 + Me.lblIDColName.AutoSize = True + Me.lblIDColName.Location = New System.Drawing.Point(132, 246) + Me.lblIDColName.Name = "lblIDColName" + Me.lblIDColName.Size = New System.Drawing.Size(90, 13) + Me.lblIDColName.TabIndex = 3 + Me.lblIDColName.Text = "ID Column Name:" ' 'ucrInputIDColName ' + Me.ucrInputIDColName.IsMultiline = False Me.ucrInputIDColName.IsReadOnly = False - Me.ucrInputIDColName.Location = New System.Drawing.Point(219, 263) + Me.ucrInputIDColName.Location = New System.Drawing.Point(221, 243) Me.ucrInputIDColName.Name = "ucrInputIDColName" Me.ucrInputIDColName.Size = New System.Drawing.Size(147, 21) Me.ucrInputIDColName.TabIndex = 6 ' 'ucrReceiverAppendDataframe ' + Me.ucrReceiverAppendDataframe.frmParent = Me Me.ucrReceiverAppendDataframe.Location = New System.Drawing.Point(246, 53) Me.ucrReceiverAppendDataframe.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverAppendDataframe.Name = "ucrReceiverAppendDataframe" @@ -116,22 +90,36 @@ Partial Class dlgAppend ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(10, 290) + Me.ucrBase.Location = New System.Drawing.Point(10, 269) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(400, 52) Me.ucrBase.TabIndex = 0 ' + 'ucrSaveGraph + ' + Me.ucrSaveGraph.Location = New System.Drawing.Point(10, 217) + Me.ucrSaveGraph.Name = "ucrSaveGraph" + Me.ucrSaveGraph.Size = New System.Drawing.Size(305, 24) + Me.ucrSaveGraph.TabIndex = 12 + ' + 'ucrChkIncludeIDColumn + ' + Me.ucrChkIncludeIDColumn.Checked = False + Me.ucrChkIncludeIDColumn.Location = New System.Drawing.Point(10, 243) + Me.ucrChkIncludeIDColumn.Name = "ucrChkIncludeIDColumn" + Me.ucrChkIncludeIDColumn.Size = New System.Drawing.Size(116, 20) + Me.ucrChkIncludeIDColumn.TabIndex = 13 + ' 'dlgAppend ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(415, 346) - Me.Controls.Add(Me.ucrInputNewDataframeName) - Me.Controls.Add(Me.lblNewDataframeName) + Me.ClientSize = New System.Drawing.Size(415, 328) + Me.Controls.Add(Me.ucrChkIncludeIDColumn) + Me.Controls.Add(Me.ucrSaveGraph) Me.Controls.Add(Me.ucrInputIDColName) - Me.Controls.Add(Me.chkIncludeIDColumn) Me.Controls.Add(Me.lblDataframes) - Me.Controls.Add(Me.lblIDColNAme) + Me.Controls.Add(Me.lblIDColName) Me.Controls.Add(Me.lblAppendToDataframe) Me.Controls.Add(Me.ucrReceiverAppendDataframe) Me.Controls.Add(Me.ucrSelectorDataframes) @@ -153,9 +141,8 @@ Partial Class dlgAppend Friend WithEvents ucrReceiverAppendDataframe As ucrReceiverMultiple Friend WithEvents lblAppendToDataframe As Label Friend WithEvents lblDataframes As Label - Friend WithEvents lblIDColNAme As Label - Friend WithEvents chkIncludeIDColumn As CheckBox + Friend WithEvents lblIDColName As Label Friend WithEvents ucrInputIDColName As ucrInputTextBox - Friend WithEvents lblNewDataframeName As Label - Friend WithEvents ucrInputNewDataframeName As ucrInputTextBox -End Class + Friend WithEvents ucrSaveGraph As ucrSave + Friend WithEvents ucrChkIncludeIDColumn As ucrCheck +End Class \ No newline at end of file diff --git a/instat/dlgAppend.vb b/instat/dlgAppend.vb index 494aa05eeeb..bee949cc4b2 100644 --- a/instat/dlgAppend.vb +++ b/instat/dlgAppend.vb @@ -13,35 +13,70 @@ ' ' You should have received a copy of the GNU General Public License k ' along with this program. If not, see . +Imports instat Imports instat.Translations Public Class dlgAppend Public bFirstLoad As Boolean = True + Private clsBindRows, clsDefaultBindRows As New RFunction Private Sub dlgAppend_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) If bFirstLoad Then InitialiseDialog() - SetDefaults() + SetDefaults() bFirstLoad = False - Else - ReopenDialog() - End If + Else + ReopenDialog() + End If TestOKEnabled() End Sub Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 465 + + ' ucrReceiver + ucrReceiverAppendDataframe.SetParameter(New RParameter("x", 0)) + ucrReceiverAppendDataframe.GetParameter().bIncludeArgumentName = False + ucrReceiverAppendDataframe.SetParameterIsRFunction() ucrReceiverAppendDataframe.Selector = ucrSelectorDataframes ucrReceiverAppendDataframe.SetMeAsReceiver() - ucrBase.clsRsyntax.SetFunction("bind_rows") ucrReceiverAppendDataframe.SetItemType("dataframe") - ucrInputIDColName.SetValidationTypeAsRVariable() - ucrInputNewDataframeName.SetValidationTypeAsRVariable() + + 'clsRFunctionParameter:=ucrReceiverAppendDataframe.GetVariables, bIncludeArgumentName:=False) + + ' ucrSave + ucrSaveGraph.SetIsTextBox() + ucrSaveGraph.SetSaveTypeAsDataFrame() + ucrSaveGraph.SetLabelText("New Data Frame Name:") + + + 'chkID + SetParameter({ucrChkIncludeIDColumn, ucrInputIDColName}, New RParameter(".id", 1)) + ucrChkIncludeIDColumn.SetText("Include ID Column") + ucrChkIncludeIDColumn.bChangeParameterValue = False + ucrChkIncludeIDColumn.AddToLinkedControls(ucrLinked:=ucrInputIDColName, objValues:={True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrInputIDColName.bAddRemoveParameter = False + ucrInputIDColName.SetLabel(lblIDColName) + + + 'Default Function + clsDefaultBindRows.SetRCommand("bind_rows") + clsDefaultBindRows.AddParameter(".id", Chr(34) & "id" & Chr(34)) + clsDefaultBindRows.SetAssignTo(strTemp:="Append", strTempDataframe:="Append") + End Sub + + Private Sub SetDefaults() + clsBindRows = clsDefaultBindRows.Clone() + ucrBase.clsRsyntax.SetBaseRFunction(clsBindRows) + ucrSelectorDataframes.Reset() + ucrSaveGraph.Reset() + SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) + TestOKEnabled() End Sub Private Sub TestOKEnabled() - If Not ucrReceiverAppendDataframe.IsEmpty AndAlso Not ucrInputNewDataframeName.IsEmpty Then - If chkIncludeIDColumn.Checked AndAlso ucrInputIDColName.IsEmpty Then + If Not ucrReceiverAppendDataframe.IsEmpty AndAlso ucrSaveGraph.IsComplete() Then + If ucrChkIncludeIDColumn.Checked AndAlso ucrInputIDColName.IsEmpty Then ucrBase.OKEnabled(False) Else ucrBase.OKEnabled(True) @@ -51,54 +86,14 @@ Public Class dlgAppend End If End Sub - Private Sub SetDefaults() - ucrSelectorDataframes.Reset() - ucrInputIDColName.SetName("id") - ucrInputNewDataframeName.SetName("Append") - chkIncludeIDColumn.Checked = False - TestOKEnabled() - End Sub - - Private Sub ReopenDialog() End Sub - Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset - SetDefaults() - End Sub - - Private Sub ucrReceiverAppendDataframe_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverAppendDataframe.SelectionChanged - If ucrReceiverAppendDataframe.IsEmpty = False Then - ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverAppendDataframe.GetVariables, bIncludeArgumentName:=False) - Else - ucrBase.clsRsyntax.RemoveParameter("x") - End If - TestOKEnabled() - End Sub - - Private Sub chkIncludeIDColumn_CheckedChanged(sender As Object, e As EventArgs) Handles chkIncludeIDColumn.CheckedChanged - IncludeIDColumn() - End Sub - - Private Sub ucrInputIDColName_NameChanged() Handles ucrInputIDColName.NameChanged - IncludeIDColumn() - End Sub - - Private Sub IncludeIDColumn() - If chkIncludeIDColumn.Checked Then - ucrBase.clsRsyntax.AddParameter(".id", Chr(34) & ucrInputIDColName.GetText & Chr(34)) - ucrInputIDColName.Visible = True - lblIDColNAme.Visible = True - Else - ucrBase.clsRsyntax.RemoveParameter(".id") - ucrInputIDColName.Visible = False - lblIDColNAme.Visible = False - End If - TestOKEnabled() + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + SetDefaults() End Sub - Private Sub ucrInputNewDataframeName_NameChanged() Handles ucrInputNewDataframeName.NameChanged - ucrBase.clsRsyntax.SetAssignTo(ucrInputNewDataframeName.GetText(), strTempDataframe:=ucrInputNewDataframeName.GetText()) + Private Sub ucrReceiverAppendDataframe_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverAppendDataframe.ControlContentsChanged, ucrSaveGraph.ControlContentsChanged, ucrChkIncludeIDColumn.ControlContentsChanged, ucrInputIDColName.ControlContentsChanged TestOKEnabled() End Sub From 0995066786f19e9aa453c5cac06bb3fe4d7f27f0 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 31 Jan 2017 11:03:06 +0300 Subject: [PATCH 57/72] Set up parameters --- instat/dlgInfill.vb | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/instat/dlgInfill.vb b/instat/dlgInfill.vb index 3e63382fd1e..d7a8bd61eb7 100644 --- a/instat/dlgInfill.vb +++ b/instat/dlgInfill.vb @@ -26,12 +26,27 @@ Public Class dlgInfill TestOkEnabled() End Sub - Private Sub InitialiseDialog() - ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$infill_missing_dates") - ucrReceiverDate.Selector = ucrInfillSelector - ucrReceiverFactors.Selector = ucrInfillSelector - ucrReceiverFactors.SetIncludedDataTypes({"factor"}) - 'ucrBase.iHelpTopicID + Private Sub InitialiseDialog() + 'Task: Help ID for this dialogue need to be added. + ' ucrBase.iHelpTopicID= + clsDefaultFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$infill_missing_dates") + + 'Set receiver + ucrReceiverDate.Selector = ucrInfillSelector + ucrReceiverDate.SetMeAsReceiver() + ucrReceiverDate.SetParameter(New RParameter("date_name", 1)) + ucrReceiverDate.SetParameterIsString() + + 'Set ucrreceiver factors + ucrReceiverFactors.SetIncludedDataTypes({"factor"}) + ucrReceiverFactors.Selector = ucrInfillSelector + ucrReceiverFactors.SetParameter(New RParameter("factors", 2)) + ucrReceiverFactors.SetParameterIsString() + + 'Set data frame parameter + ucrInfillSelector.SetParameter(New RParameter("data_name", 0)) + ucrInfillSelector.SetParameterIsString() + End Sub Private Sub SetDefaults() From 348bbaf0b9a5937f1d5f08cb7ffa84aab80c3e0b Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 31 Jan 2017 11:05:45 +0300 Subject: [PATCH 58/72] more edits --- instat/dlgInfill.vb | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/instat/dlgInfill.vb b/instat/dlgInfill.vb index d7a8bd61eb7..6362cbb8a5d 100644 --- a/instat/dlgInfill.vb +++ b/instat/dlgInfill.vb @@ -16,6 +16,7 @@ Imports instat.Translations Public Class dlgInfill Private bFirstLoad As Boolean = True + Private clsDefaultFunction As New RFunction Private Sub dlgInfill_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then InitialiseDialog() @@ -50,8 +51,10 @@ Public Class dlgInfill End Sub Private Sub SetDefaults() - ucrInfillSelector.Reset() - ucrReceiverDate.SetMeAsReceiver() + ' Set default RFunction as the base function + ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultFunction.Clone()) + ucrInfillSelector.Reset() + SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) TestOkEnabled() End Sub Private Sub TestOkEnabled() @@ -64,26 +67,30 @@ Public Class dlgInfill Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() + TestOkEnabled() End Sub - Private Sub ucrInfillSelector_DataFrameChanged() Handles ucrInfillSelector.DataFrameChanged - ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & ucrInfillSelector.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) - End Sub + 'Private Sub ucrInfillSelector_DataFrameChanged() Handles ucrInfillSelector.DataFrameChanged + ' ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & ucrInfillSelector.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) + 'End Sub - Private Sub ucrReceiverDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDate.SelectionChanged - If Not ucrReceiverDate.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("date_name", ucrReceiverDate.GetVariableNames()) - Else - ucrBase.clsRsyntax.RemoveParameter("date_name") - End If - TestOkEnabled() - End Sub + 'Private Sub ucrReceiverDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDate.SelectionChanged + ' If Not ucrReceiverDate.IsEmpty Then + ' ucrBase.clsRsyntax.AddParameter("date_name", ucrReceiverDate.GetVariableNames()) + ' Else + ' ucrBase.clsRsyntax.RemoveParameter("date_name") + ' End If + ' TestOkEnabled() + 'End Sub - Private Sub ucrReceiverFactors_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverFactors.SelectionChanged - If Not ucrReceiverDate.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("factors", ucrReceiverFactors.GetVariableNames()) - Else - ucrBase.clsRsyntax.RemoveParameter("factors") - End If + 'Private Sub ucrReceiverFactors_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverFactors.SelectionChanged + ' If Not ucrReceiverDate.IsEmpty Then + ' ucrBase.clsRsyntax.AddParameter("factors", ucrReceiverFactors.GetVariableNames()) + ' Else + ' ucrBase.clsRsyntax.RemoveParameter("factors") + ' End If + 'End Sub + Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFactors.ControlContentsChanged, ucrReceiverDate.ControlContentsChanged + TestOkEnabled() End Sub End Class \ No newline at end of file From 250d9258b945bc178e13976c4b359a5a6d0cfa06 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 31 Jan 2017 11:06:42 +0300 Subject: [PATCH 59/72] Fixing TestOK Enabled --- instat/dlgInfill.vb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/instat/dlgInfill.vb b/instat/dlgInfill.vb index 6362cbb8a5d..930d2edc3bf 100644 --- a/instat/dlgInfill.vb +++ b/instat/dlgInfill.vb @@ -58,10 +58,10 @@ Public Class dlgInfill TestOkEnabled() End Sub Private Sub TestOkEnabled() - If ucrReceiverDate.IsEmpty Then - ucrBase.OKEnabled(False) - Else - ucrBase.OKEnabled(True) + If Not (ucrReceiverDate.IsEmpty) OrElse Not (ucrReceiverFactors.IsEmpty) Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) End If End Sub From 90c0a87705e46454b537ab63c654fa9b7689df4c Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 31 Jan 2017 11:07:27 +0300 Subject: [PATCH 60/72] tyding up the code --- instat/dlgInfill.vb | 109 ++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 65 deletions(-) diff --git a/instat/dlgInfill.vb b/instat/dlgInfill.vb index 930d2edc3bf..4466c6c4e9d 100644 --- a/instat/dlgInfill.vb +++ b/instat/dlgInfill.vb @@ -1,32 +1,32 @@ -' Instat-R -' Copyright (C) 2015 -' -' 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 k -' along with this program. If not, see . -Imports instat.Translations -Public Class dlgInfill - Private bFirstLoad As Boolean = True - Private clsDefaultFunction As New RFunction - Private Sub dlgInfill_Load(sender As Object, e As EventArgs) Handles MyBase.Load - If bFirstLoad Then - InitialiseDialog() - SetDefaults() - bFirstLoad = False - End If - autoTranslate(Me) - TestOkEnabled() - End Sub - +' Instat-R +' Copyright (C) 2015 +' +' 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 k +' along with this program. If not, see . +Imports instat.Translations +Public Class dlgInfill + Private bFirstLoad As Boolean = True + Private clsDefaultFunction As New RFunction + Private Sub dlgInfill_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstLoad Then + InitialiseDialog() + SetDefaults() + bFirstLoad = False + End If + autoTranslate(Me) + TestOkEnabled() + End Sub + Private Sub InitialiseDialog() 'Task: Help ID for this dialogue need to be added. ' ucrBase.iHelpTopicID= @@ -47,50 +47,29 @@ Public Class dlgInfill 'Set data frame parameter ucrInfillSelector.SetParameter(New RParameter("data_name", 0)) ucrInfillSelector.SetParameterIsString() - - End Sub - - Private Sub SetDefaults() + + End Sub + + Private Sub SetDefaults() ' Set default RFunction as the base function ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultFunction.Clone()) ucrInfillSelector.Reset() SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) - TestOkEnabled() - End Sub - Private Sub TestOkEnabled() + TestOkEnabled() + End Sub + Private Sub TestOkEnabled() If Not (ucrReceiverDate.IsEmpty) OrElse Not (ucrReceiverFactors.IsEmpty) Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) - End If - End Sub - - Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset - SetDefaults() - TestOkEnabled() - End Sub - - 'Private Sub ucrInfillSelector_DataFrameChanged() Handles ucrInfillSelector.DataFrameChanged - ' ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & ucrInfillSelector.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) - 'End Sub - - 'Private Sub ucrReceiverDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverDate.SelectionChanged - ' If Not ucrReceiverDate.IsEmpty Then - ' ucrBase.clsRsyntax.AddParameter("date_name", ucrReceiverDate.GetVariableNames()) - ' Else - ' ucrBase.clsRsyntax.RemoveParameter("date_name") - ' End If - ' TestOkEnabled() - 'End Sub - - 'Private Sub ucrReceiverFactors_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverFactors.SelectionChanged - ' If Not ucrReceiverDate.IsEmpty Then - ' ucrBase.clsRsyntax.AddParameter("factors", ucrReceiverFactors.GetVariableNames()) - ' Else - ' ucrBase.clsRsyntax.RemoveParameter("factors") - ' End If - 'End Sub + End If + End Sub + + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + SetDefaults() + End Sub + Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFactors.ControlContentsChanged, ucrReceiverDate.ControlContentsChanged TestOkEnabled() - End Sub + End Sub End Class \ No newline at end of file From 0e0591d555c1dc64bac4e7fbd38d649331643e6a Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 31 Jan 2017 11:08:00 +0300 Subject: [PATCH 61/72] Order of tabs --- instat/dlgInfill.Designer.vb | 166 ++++++++++++++++++----------------- 1 file changed, 84 insertions(+), 82 deletions(-) diff --git a/instat/dlgInfill.Designer.vb b/instat/dlgInfill.Designer.vb index b800af749a3..a7208ba8f29 100644 --- a/instat/dlgInfill.Designer.vb +++ b/instat/dlgInfill.Designer.vb @@ -22,88 +22,90 @@ Partial Class dlgInfill 'Do not modify it using the code editor. _ Private Sub InitializeComponent() - Me.ucrBase = New instat.ucrButtons() - Me.ucrInfillSelector = New instat.ucrSelectorByDataFrameAddRemove() - Me.ucrReceiverDate = New instat.ucrReceiverSingle() - Me.ucrReceiverFactors = New instat.ucrReceiverMultiple() - Me.lblDate = New System.Windows.Forms.Label() - Me.lblFactors = New System.Windows.Forms.Label() - Me.SuspendLayout() - ' - 'ucrBase - ' - Me.ucrBase.Location = New System.Drawing.Point(9, 209) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(410, 52) - Me.ucrBase.TabIndex = 0 - ' - 'ucrInfillSelector - ' - Me.ucrInfillSelector.bShowHiddenColumns = False - Me.ucrInfillSelector.bUseCurrentFilter = True - Me.ucrInfillSelector.Location = New System.Drawing.Point(9, 9) - Me.ucrInfillSelector.Margin = New System.Windows.Forms.Padding(0) - Me.ucrInfillSelector.Name = "ucrInfillSelector" - Me.ucrInfillSelector.Size = New System.Drawing.Size(210, 180) - Me.ucrInfillSelector.TabIndex = 1 - ' - 'ucrReceiverDate - ' - Me.ucrReceiverDate.Location = New System.Drawing.Point(278, 37) - Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverDate.Name = "ucrReceiverDate" - Me.ucrReceiverDate.Selector = Nothing - Me.ucrReceiverDate.Size = New System.Drawing.Size(120, 20) - Me.ucrReceiverDate.TabIndex = 2 - ' - 'ucrReceiverFactors - ' - Me.ucrReceiverFactors.Location = New System.Drawing.Point(278, 90) - Me.ucrReceiverFactors.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverFactors.Name = "ucrReceiverFactors" - Me.ucrReceiverFactors.Selector = Nothing - Me.ucrReceiverFactors.Size = New System.Drawing.Size(120, 100) - Me.ucrReceiverFactors.TabIndex = 3 - ' - 'lblDate - ' - Me.lblDate.AutoSize = True - Me.lblDate.Location = New System.Drawing.Point(275, 13) - Me.lblDate.Name = "lblDate" - Me.lblDate.Size = New System.Drawing.Size(30, 13) - Me.lblDate.TabIndex = 4 - Me.lblDate.Text = "Date" - ' - 'lblFactors - ' - Me.lblFactors.AutoSize = True - Me.lblFactors.Location = New System.Drawing.Point(278, 73) - Me.lblFactors.Name = "lblFactors" - Me.lblFactors.Size = New System.Drawing.Size(42, 13) - Me.lblFactors.TabIndex = 5 - Me.lblFactors.Text = "Factors" - ' - 'dlgInfill - ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(415, 270) - Me.Controls.Add(Me.lblFactors) - Me.Controls.Add(Me.lblDate) - Me.Controls.Add(Me.ucrReceiverFactors) - Me.Controls.Add(Me.ucrReceiverDate) - Me.Controls.Add(Me.ucrInfillSelector) - Me.Controls.Add(Me.ucrBase) - Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow - Me.MaximizeBox = False - Me.MinimizeBox = False - Me.Name = "dlgInfill" - Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Tag = "Infill" - Me.Text = "Infill" - Me.ResumeLayout(False) - Me.PerformLayout() - + Me.ucrBase = New instat.ucrButtons() + Me.ucrInfillSelector = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrReceiverDate = New instat.ucrReceiverSingle() + Me.ucrReceiverFactors = New instat.ucrReceiverMultiple() + Me.lblDate = New System.Windows.Forms.Label() + Me.lblFactors = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'ucrBase + ' + Me.ucrBase.Location = New System.Drawing.Point(9, 209) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(410, 52) + Me.ucrBase.TabIndex = 5 + ' + 'ucrInfillSelector + ' + Me.ucrInfillSelector.bShowHiddenColumns = False + Me.ucrInfillSelector.bUseCurrentFilter = True + Me.ucrInfillSelector.Location = New System.Drawing.Point(9, 9) + Me.ucrInfillSelector.Margin = New System.Windows.Forms.Padding(0) + Me.ucrInfillSelector.Name = "ucrInfillSelector" + Me.ucrInfillSelector.Size = New System.Drawing.Size(210, 180) + Me.ucrInfillSelector.TabIndex = 0 + ' + 'ucrReceiverDate + ' + Me.ucrReceiverDate.frmParent = Me + Me.ucrReceiverDate.Location = New System.Drawing.Point(278, 37) + Me.ucrReceiverDate.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverDate.Name = "ucrReceiverDate" + Me.ucrReceiverDate.Selector = Nothing + Me.ucrReceiverDate.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverDate.TabIndex = 2 + ' + 'ucrReceiverFactors + ' + Me.ucrReceiverFactors.frmParent = Me + Me.ucrReceiverFactors.Location = New System.Drawing.Point(278, 90) + Me.ucrReceiverFactors.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverFactors.Name = "ucrReceiverFactors" + Me.ucrReceiverFactors.Selector = Nothing + Me.ucrReceiverFactors.Size = New System.Drawing.Size(120, 100) + Me.ucrReceiverFactors.TabIndex = 4 + ' + 'lblDate + ' + Me.lblDate.AutoSize = True + Me.lblDate.Location = New System.Drawing.Point(275, 13) + Me.lblDate.Name = "lblDate" + Me.lblDate.Size = New System.Drawing.Size(30, 13) + Me.lblDate.TabIndex = 1 + Me.lblDate.Text = "Date" + ' + 'lblFactors + ' + Me.lblFactors.AutoSize = True + Me.lblFactors.Location = New System.Drawing.Point(278, 73) + Me.lblFactors.Name = "lblFactors" + Me.lblFactors.Size = New System.Drawing.Size(42, 13) + Me.lblFactors.TabIndex = 3 + Me.lblFactors.Text = "Factors" + ' + 'dlgInfill + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(415, 270) + Me.Controls.Add(Me.lblFactors) + Me.Controls.Add(Me.lblDate) + Me.Controls.Add(Me.ucrReceiverFactors) + Me.Controls.Add(Me.ucrReceiverDate) + Me.Controls.Add(Me.ucrInfillSelector) + Me.Controls.Add(Me.ucrBase) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "dlgInfill" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Tag = "Infill" + Me.Text = "Infill" + Me.ResumeLayout(False) + Me.PerformLayout() + End Sub Friend WithEvents ucrBase As ucrButtons From 0babde72a32fbfc0882accafa07ffa26106527c2 Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Tue, 31 Jan 2017 13:12:42 +0300 Subject: [PATCH 62/72] adding assignment --- instat/dlgInventoryPlot.vb | 1 + 1 file changed, 1 insertion(+) diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index 4bd3b905bf4..9c78b4d5d8f 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -85,6 +85,7 @@ Public Class dlgInventoryPlot clsDefaultRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$make_inventory_plot") clsDefaultRFunction.AddParameter(ucrInventoryPlotSelector.GetParameter(), 0) clsDefaultRFunction.AddParameter("threshold", "0.85") + clsDefaultRFunction.SetAssignTo("last_graph", strTempDataframe:=ucrInventoryPlotSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") End Sub Private Sub TestOkEnabled() From 04194d08e87497972adf2dedd9fa5e9f1841e7b7 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 31 Jan 2017 13:16:47 +0300 Subject: [PATCH 63/72] DlgFreezeColumns --- instat/dlgFreezeColumns.vb | 44 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/instat/dlgFreezeColumns.vb b/instat/dlgFreezeColumns.vb index b791df21ea7..83005d1a312 100644 --- a/instat/dlgFreezeColumns.vb +++ b/instat/dlgFreezeColumns.vb @@ -17,50 +17,50 @@ Imports instat.Translations Public Class dlgFreezeColumns Public bFirstLoad As Boolean = True - - + Private clsDefaultFunction As New RFunction Private Sub dlgFreezeColumns_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) If bFirstLoad Then InitialiseDialog() SetDefaults() bFirstLoad = False - End If - End Sub Private Sub SetDefaults() + ' Set default RFunction as the base function + ucrBaseforFreezeColumns.clsRsyntax.SetBaseRFunction(clsDefaultFunction.Clone()) ucrSelectorByDataFrameAddRemoveforFreezeColumns.Reset() + SetRCode(Me, ucrBaseforFreezeColumns.clsRsyntax.clsBaseFunction, True) End Sub Private Sub InitialiseDialog() ucrBaseforFreezeColumns.iHelpTopicID = 444 + clsDefaultFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$set_freeze_columns") + + 'Setting up the multiple receiver ucrReceiverMultipleforFreezeColumns.Selector = ucrSelectorByDataFrameAddRemoveforFreezeColumns ucrReceiverMultipleforFreezeColumns.SetMeAsReceiver() - ucrBaseforFreezeColumns.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$set_freeze_columns") - - End Sub + ucrReceiverMultipleforFreezeColumns.SetParameter(New RParameter("col_names")) + ucrReceiverMultipleforFreezeColumns.SetParameterIsString() - Private Sub ucrBaseforFreezeColumns_ClickReset(sender As Object, e As EventArgs) Handles ucrBaseforFreezeColumns.ClickReset - SetDefaults() - End Sub + 'Set data frame parameter + ucrSelectorByDataFrameAddRemoveforFreezeColumns.SetParameter(New RParameter("data_name", 0)) + ucrSelectorByDataFrameAddRemoveforFreezeColumns.SetParameterIsString() - Private Sub ucrSelectorByDataframeAddRemoveforFreezeColumns_DataFrameChanged() Handles ucrSelectorByDataFrameAddRemoveforFreezeColumns.DataFrameChanged - ucrBaseforFreezeColumns.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSelectorByDataFrameAddRemoveforFreezeColumns.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) - End Sub - Private Sub ucrReceiverHiddenColumns_SelectionChanged() Handles ucrReceiverMultipleforFreezeColumns.SelectionChanged - If Not ucrReceiverMultipleforFreezeColumns.IsEmpty Then - ucrBaseforFreezeColumns.clsRsyntax.AddParameter("col_names", ucrReceiverMultipleforFreezeColumns.GetVariableNames()) - Else - ucrBaseforFreezeColumns.clsRsyntax.AddParameter("col_names", "c()") - End If End Sub - Private Sub ucrSelectorByDataFrameAddRemoveforFreezeColumns_Load(sender As Object, e As EventArgs) Handles ucrSelectorByDataFrameAddRemoveforFreezeColumns.Load - - End Sub + 'Private Sub ucrSelectorByDataframeAddRemoveforFreezeColumns_DataFrameChanged() Handles ucrSelectorByDataFrameAddRemoveforFreezeColumns.DataFrameChanged + ' ucrBaseforFreezeColumns.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSelectorByDataFrameAddRemoveforFreezeColumns.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) + 'End Sub + 'Private Sub ucrReceiverHiddenColumns_SelectionChanged() Handles ucrReceiverMultipleforFreezeColumns.SelectionChanged + ' If Not ucrReceiverMultipleforFreezeColumns.IsEmpty Then + ' ucrBaseforFreezeColumns.clsRsyntax.AddParameter("col_names", ucrReceiverMultipleforFreezeColumns.GetVariableNames()) + ' Else + ' ucrBaseforFreezeColumns.clsRsyntax.AddParameter("col_names", "c()") + ' End If + 'End Sub End Class \ No newline at end of file From a83c5593ede707ab63e3d94e45355680490f07be Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 31 Jan 2017 13:17:24 +0300 Subject: [PATCH 64/72] Positioning of col_names paramater --- instat/dlgFreezeColumns.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgFreezeColumns.vb b/instat/dlgFreezeColumns.vb index 83005d1a312..8d41d03d197 100644 --- a/instat/dlgFreezeColumns.vb +++ b/instat/dlgFreezeColumns.vb @@ -41,7 +41,7 @@ Public Class dlgFreezeColumns 'Setting up the multiple receiver ucrReceiverMultipleforFreezeColumns.Selector = ucrSelectorByDataFrameAddRemoveforFreezeColumns ucrReceiverMultipleforFreezeColumns.SetMeAsReceiver() - ucrReceiverMultipleforFreezeColumns.SetParameter(New RParameter("col_names")) + ucrReceiverMultipleforFreezeColumns.SetParameter(New RParameter("col_names", 1)) ucrReceiverMultipleforFreezeColumns.SetParameterIsString() 'Set data frame parameter From 4336d363a7a55813fabc8a055852f6cb26908715 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 31 Jan 2017 13:22:19 +0300 Subject: [PATCH 65/72] Adding TestOKEnabled Sub --- instat/dlgFreezeColumns.vb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/instat/dlgFreezeColumns.vb b/instat/dlgFreezeColumns.vb index 8d41d03d197..74d71cf2a7a 100644 --- a/instat/dlgFreezeColumns.vb +++ b/instat/dlgFreezeColumns.vb @@ -51,6 +51,14 @@ Public Class dlgFreezeColumns End Sub + Private Sub TestOKEnabled() + If Not ucrReceiverMultipleforFreezeColumns.IsEmpty Then + ucrBaseforFreezeColumns.OKEnabled(True) + Else + ucrBaseforFreezeColumns.OKEnabled(False) + End If + End Sub + 'Private Sub ucrSelectorByDataframeAddRemoveforFreezeColumns_DataFrameChanged() Handles ucrSelectorByDataFrameAddRemoveforFreezeColumns.DataFrameChanged ' ucrBaseforFreezeColumns.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSelectorByDataFrameAddRemoveforFreezeColumns.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) 'End Sub @@ -62,5 +70,7 @@ Public Class dlgFreezeColumns ' ucrBaseforFreezeColumns.clsRsyntax.AddParameter("col_names", "c()") ' End If 'End Sub + Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverMultipleforFreezeColumns.ControlContentsChanged + End Sub End Class \ No newline at end of file From 49bf3784ea8bbce7ff93b67fe5017dca8ed4cb37 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 31 Jan 2017 13:24:55 +0300 Subject: [PATCH 66/72] Fixing reset button and tyding the code --- instat/dlgFreezeColumns.vb | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/instat/dlgFreezeColumns.vb b/instat/dlgFreezeColumns.vb index 74d71cf2a7a..a85a7eec5d8 100644 --- a/instat/dlgFreezeColumns.vb +++ b/instat/dlgFreezeColumns.vb @@ -59,18 +59,12 @@ Public Class dlgFreezeColumns End If End Sub - 'Private Sub ucrSelectorByDataframeAddRemoveforFreezeColumns_DataFrameChanged() Handles ucrSelectorByDataFrameAddRemoveforFreezeColumns.DataFrameChanged - ' ucrBaseforFreezeColumns.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSelectorByDataFrameAddRemoveforFreezeColumns.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) - 'End Sub - - 'Private Sub ucrReceiverHiddenColumns_SelectionChanged() Handles ucrReceiverMultipleforFreezeColumns.SelectionChanged - ' If Not ucrReceiverMultipleforFreezeColumns.IsEmpty Then - ' ucrBaseforFreezeColumns.clsRsyntax.AddParameter("col_names", ucrReceiverMultipleforFreezeColumns.GetVariableNames()) - ' Else - ' ucrBaseforFreezeColumns.clsRsyntax.AddParameter("col_names", "c()") - ' End If - 'End Sub Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverMultipleforFreezeColumns.ControlContentsChanged + TestOKEnabled() + End Sub + Private Sub ucrBaseforFreezeColumns_ClickReset(sender As Object, e As EventArgs) Handles ucrBaseforFreezeColumns.ClickReset + SetDefaults() + TestOKEnabled() End Sub End Class \ No newline at end of file From 46782e4dac1f640fbb46f067f973fe95dab46ff3 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 31 Jan 2017 13:26:15 +0300 Subject: [PATCH 67/72] Order of tab --- instat/dlgFreezeColumns.Designer.vb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/instat/dlgFreezeColumns.Designer.vb b/instat/dlgFreezeColumns.Designer.vb index dcc225412de..fa029eac886 100644 --- a/instat/dlgFreezeColumns.Designer.vb +++ b/instat/dlgFreezeColumns.Designer.vb @@ -40,19 +40,20 @@ Partial Class dlgFreezeColumns ' 'ucrReceiverMultipleforFreezeColumns ' + Me.ucrReceiverMultipleforFreezeColumns.frmParent = Me Me.ucrReceiverMultipleforFreezeColumns.Location = New System.Drawing.Point(240, 28) Me.ucrReceiverMultipleforFreezeColumns.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverMultipleforFreezeColumns.Name = "ucrReceiverMultipleforFreezeColumns" Me.ucrReceiverMultipleforFreezeColumns.Selector = Nothing Me.ucrReceiverMultipleforFreezeColumns.Size = New System.Drawing.Size(120, 100) - Me.ucrReceiverMultipleforFreezeColumns.TabIndex = 1 + Me.ucrReceiverMultipleforFreezeColumns.TabIndex = 2 ' 'ucrBaseforFreezeColumns ' Me.ucrBaseforFreezeColumns.Location = New System.Drawing.Point(12, 198) Me.ucrBaseforFreezeColumns.Name = "ucrBaseforFreezeColumns" Me.ucrBaseforFreezeColumns.Size = New System.Drawing.Size(410, 52) - Me.ucrBaseforFreezeColumns.TabIndex = 2 + Me.ucrBaseforFreezeColumns.TabIndex = 3 ' 'lblFreezeColumns ' @@ -60,7 +61,7 @@ Partial Class dlgFreezeColumns Me.lblFreezeColumns.Location = New System.Drawing.Point(237, 9) Me.lblFreezeColumns.Name = "lblFreezeColumns" Me.lblFreezeColumns.Size = New System.Drawing.Size(82, 13) - Me.lblFreezeColumns.TabIndex = 3 + Me.lblFreezeColumns.TabIndex = 1 Me.lblFreezeColumns.Text = "Freeze Columns" ' 'dlgFreezeColumns From 2c1c32cc33c66084269687f040f0fd5ae092aa71 Mon Sep 17 00:00:00 2001 From: Danny Parsons Date: Tue, 31 Jan 2017 11:07:13 +0000 Subject: [PATCH 68/72] updated save control and conditions --- instat/clsCondition.vb | 46 +++++++++++++++++++++++++++++++++--------- instat/ucrCore.vb | 6 +++++- instat/ucrInput.vb | 1 + instat/ucrSave.vb | 5 +++++ 4 files changed, 47 insertions(+), 11 deletions(-) diff --git a/instat/clsCondition.vb b/instat/clsCondition.vb index 9d2188caff5..51aa3ac8f41 100644 --- a/instat/clsCondition.vb +++ b/instat/clsCondition.vb @@ -1,32 +1,58 @@ Public Class Condition - Private strType As String = "ParameterValue" + Private bIsParameterValues As Boolean = False + Private bIsParameterPresenet As Boolean = False + Private bIsFunctionNames As Boolean = False Private strParameterName As String = "" Private lstValues As List(Of String) = New List(Of String) Public Sub SetParameterPresentName(strParamName As String) - strType = "ParameterPresent" strParameterName = strParamName + bIsParameterPresenet = True + bIsParameterValues = False + bIsFunctionNames = False End Sub Public Sub SetParameterValues(strParamName As String, lstParamValues As List(Of String)) - strType = "ParameterValue" strParameterName = strParamName lstValues = lstParamValues + bIsParameterValues = True + bIsParameterPresenet = False + bIsFunctionNames = False End Sub Public Sub SetParameterValues(strParamName As String, strParamValues As String) - strType = "ParameterValue" - strParameterName = strParamName - lstValues = New List(Of String)({strParamValues}) + SetParameterValues(strParameterName, New List(Of String)({strParamValues})) End Sub Public Sub SetFunctionName(strFuncName As String) - strType = "FunctionName" - lstValues = New List(Of String)({strFuncName}) + SetFunctionNamesMultiple(New List(Of String)({strFuncName})) End Sub Public Sub SetFunctionNamesMultiple(lstFuncNames As List(Of String)) - strType = "FunctionName" lstValues = lstFuncNames + bIsFunctionNames = True + bIsParameterValues = False + bIsParameterPresenet = False End Sub -End Class + + Public Function IsSatisfied(clsRCode As RCodeStructure) As Boolean + Dim clsTempParam As RParameter + Dim clsTempFunc As RFunction + + If bIsParameterValues Then + clsTempParam = clsRCode.GetParameter(strParameterName) + Return (clsTempParam IsNot Nothing AndAlso clsTempParam.bIsString AndAlso clsTempParam.strArgumentValue IsNot Nothing AndAlso lstValues.Contains(clsRCode.GetParameter(strParameterName).strArgumentValue)) + ElseIf bIsParameterPresenet Then + Return (clsRCode.ContainsParameter(strParameterName)) + ElseIf bIsFunctionNames Then + If TypeOf clsRCode Is RFunction Then + clsTempFunc = CType(clsRCode, RFunction) + Return lstValues.Contains(clsTempFunc.strRCommand) + Else + Return False + End If + Else + Return True + End If + End Function +End Class \ No newline at end of file diff --git a/instat/ucrCore.vb b/instat/ucrCore.vb index 07259a94491..4a7c1028c35 100644 --- a/instat/ucrCore.vb +++ b/instat/ucrCore.vb @@ -133,13 +133,17 @@ Public Class ucrCore Public Overridable Sub SetRCode(clsNewCodeStructure As RCodeStructure, Optional bReset As Boolean = False) If clsRCode Is Nothing OrElse Not clsRCode.Equals(clsNewCodeStructure) Then clsRCode = clsNewCodeStructure - If bUpdateRCodeFromControl AndAlso clsParameter IsNot Nothing AndAlso (Not clsRCode.ContainsParameter(clsParameter.strArgumentName)) AndAlso clsParameter.HasValue() Then + If bUpdateRCodeFromControl AndAlso CanUpdate() Then UpdateRCode() End If UpdateControl(bReset) End If End Sub + Protected Overridable Function CanUpdate() + Return (clsParameter IsNot Nothing AndAlso (Not clsRCode.ContainsParameter(clsParameter.strArgumentName)) AndAlso clsParameter.HasValue()) + End Function + Public Overridable Sub SetRDefault(objNewDefault As Object) objRDefault = objNewDefault End Sub diff --git a/instat/ucrInput.vb b/instat/ucrInput.vb index b4ac3d5e1fd..397a0e6f64f 100644 --- a/instat/ucrInput.vb +++ b/instat/ucrInput.vb @@ -140,6 +140,7 @@ Public Class ucrInput SetName(frmMain.clsRLink.GetNextDefault(strDefaultPrefix, frmMain.clsRLink.GetModelNames())) End If ElseIf strDefaultType = "Data Frame" Then + SetName(frmMain.clsRLink.GetNextDefault(strDefaultPrefix, frmMain.clsRLink.GetDataFrameNames())) ElseIf strDefaultType = "Graph" Then If ucrDataFrameSelector IsNot Nothing AndAlso ucrDataFrameSelector.cboAvailableDataFrames.Text <> "" Then SetName(frmMain.clsRLink.GetNextDefault(strDefaultPrefix, frmMain.clsRLink.GetGraphNames(ucrDataFrameSelector.cboAvailableDataFrames.Text))) diff --git a/instat/ucrSave.vb b/instat/ucrSave.vb index 5e0738bc527..63199190cd1 100644 --- a/instat/ucrSave.vb +++ b/instat/ucrSave.vb @@ -23,6 +23,7 @@ Public Class ucrSave End Sub Private Sub InitialiseControl() + bUpdateRCodeFromControl = True ucrInputComboSave.SetValidationTypeAsRVariable() ucrInputTextSave.SetValidationTypeAsRVariable() ucrChkSave.bIsActiveRControl = False @@ -282,4 +283,8 @@ Public Class ucrSave Return ucrInputTextSave.GetText() End If End Function + + Protected Overrides Function CanUpdate() As Object + Return ((Not clsRCode.bIsAssigned AndAlso Not clsRCode.bToBeAssigned) AndAlso strSaveType <> "") + End Function End Class \ No newline at end of file From 8c27b9d26c049b94b22ac421edaa8af9b272f05d Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Tue, 31 Jan 2017 15:33:23 +0300 Subject: [PATCH 69/72] testing for strTempDataframe --- instat/dlgInventoryPlot.vb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index 90a53d54fd5..873ee803704 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -56,7 +56,7 @@ Public Class dlgInventoryPlot ucrFacetsReceiver.SetParameter(New RParameter("facets")) ucrFacetsReceiver.SetParameterIsString() - ucrInventoryPlotSelector.SetParameter(New RParameter("data_name")) + ucrInventoryPlotSelector.SetParameter(New RParameter("data_name", 0)) ucrInventoryPlotSelector.SetParameterIsString() ucrChkAddRecodetoData.SetText("Add Recode to Data") @@ -84,9 +84,8 @@ Public Class dlgInventoryPlot ucrNudThreashold.SetRDefault("0.85") clsDefaultRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$make_inventory_plot") - clsDefaultRFunction.AddParameter(ucrInventoryPlotSelector.GetParameter(), 0) clsDefaultRFunction.AddParameter("threshold", "0.85") - clsDefaultRFunction.SetAssignTo("last_graph", strTempDataframe:=ucrInventoryPlotSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") + clsDefaultRFunction.SetAssignTo("last_graph", strTempGraph:="last_graph") End Sub Private Sub TestOkEnabled() From 199da09f56959f1538fe83a03b4d99d958fd4981 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 31 Jan 2017 17:16:15 +0300 Subject: [PATCH 70/72] Adding colon to freeze coumns label --- instat/dlgFreezeColumns.Designer.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/dlgFreezeColumns.Designer.vb b/instat/dlgFreezeColumns.Designer.vb index fa029eac886..4ef5ddfa948 100644 --- a/instat/dlgFreezeColumns.Designer.vb +++ b/instat/dlgFreezeColumns.Designer.vb @@ -60,9 +60,9 @@ Partial Class dlgFreezeColumns Me.lblFreezeColumns.AutoSize = True Me.lblFreezeColumns.Location = New System.Drawing.Point(237, 9) Me.lblFreezeColumns.Name = "lblFreezeColumns" - Me.lblFreezeColumns.Size = New System.Drawing.Size(82, 13) + Me.lblFreezeColumns.Size = New System.Drawing.Size(85, 13) Me.lblFreezeColumns.TabIndex = 1 - Me.lblFreezeColumns.Text = "Freeze Columns" + Me.lblFreezeColumns.Text = "Freeze Columns:" ' 'dlgFreezeColumns ' From 8acbac6b704b59381757fdad0e0bfa2c0242e70b Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 31 Jan 2017 17:24:11 +0300 Subject: [PATCH 71/72] suggested changes made --- instat/dlgInfill.Designer.vb | 8 ++++---- instat/dlgInfill.vb | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/instat/dlgInfill.Designer.vb b/instat/dlgInfill.Designer.vb index a7208ba8f29..126447b9526 100644 --- a/instat/dlgInfill.Designer.vb +++ b/instat/dlgInfill.Designer.vb @@ -72,18 +72,18 @@ Partial Class dlgInfill Me.lblDate.AutoSize = True Me.lblDate.Location = New System.Drawing.Point(275, 13) Me.lblDate.Name = "lblDate" - Me.lblDate.Size = New System.Drawing.Size(30, 13) + Me.lblDate.Size = New System.Drawing.Size(33, 13) Me.lblDate.TabIndex = 1 - Me.lblDate.Text = "Date" + Me.lblDate.Text = "Date:" ' 'lblFactors ' Me.lblFactors.AutoSize = True Me.lblFactors.Location = New System.Drawing.Point(278, 73) Me.lblFactors.Name = "lblFactors" - Me.lblFactors.Size = New System.Drawing.Size(42, 13) + Me.lblFactors.Size = New System.Drawing.Size(45, 13) Me.lblFactors.TabIndex = 3 - Me.lblFactors.Text = "Factors" + Me.lblFactors.Text = "Factors:" ' 'dlgInfill ' diff --git a/instat/dlgInfill.vb b/instat/dlgInfill.vb index 4466c6c4e9d..06d6ca1bef9 100644 --- a/instat/dlgInfill.vb +++ b/instat/dlgInfill.vb @@ -35,6 +35,7 @@ Public Class dlgInfill 'Set receiver ucrReceiverDate.Selector = ucrInfillSelector ucrReceiverDate.SetMeAsReceiver() + ucrReceiverDate.SetDataType("Date") ucrReceiverDate.SetParameter(New RParameter("date_name", 1)) ucrReceiverDate.SetParameterIsString() From f3a8cdac4d90c640bbbd24b88e223c499e5dcf3e Mon Sep 17 00:00:00 2001 From: Danny Parsons Date: Tue, 31 Jan 2017 16:52:14 +0000 Subject: [PATCH 72/72] updated dialog setup and added conditions list --- instat/dlgInventoryPlot.vb | 29 ++++++++++++++++++-------- instat/dlgOneVariableGraph.vb | 38 ++++++++++++++++++++++------------- instat/mdlCoreControl.vb | 12 +++++++++++ instat/ucrCore.vb | 2 ++ 4 files changed, 59 insertions(+), 22 deletions(-) diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index 873ee803704..fc019893331 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -17,13 +17,18 @@ Imports instat.Translations Public Class dlgInventoryPlot Private bFirstLoad As Boolean = True - Private clsDefaultRFunction As New RFunction + Private bReset As Boolean = True + Private Sub dlgInventoryPlot_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then InitialiseDialog() - SetDefaults() bFirstLoad = False End If + If bReset Then + SetDefaults() + End If + SetRCodeForControls(bReset) + bReset = False autoTranslate(Me) End Sub @@ -82,10 +87,6 @@ Public Class dlgInventoryPlot ucrNudThreashold.Increment = 0.01 ucrNudThreashold.DecimalPlaces = 2 ucrNudThreashold.SetRDefault("0.85") - - clsDefaultRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$make_inventory_plot") - clsDefaultRFunction.AddParameter("threshold", "0.85") - clsDefaultRFunction.SetAssignTo("last_graph", strTempGraph:="last_graph") End Sub Private Sub TestOkEnabled() @@ -95,14 +96,25 @@ Public Class dlgInventoryPlot ucrBase.OKEnabled(False) End If End Sub + Private Sub SetDefaults() - ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultRFunction.Clone()) + Dim clsDefaultRFunction As New RFunction + ucrInventoryPlotSelector.Reset() ucrSaveGraph.Reset() - SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) ucrYearReceiver.SetMeAsReceiver() + + clsDefaultRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$make_inventory_plot") + clsDefaultRFunction.AddParameter("threshold", "0.85") + clsDefaultRFunction.SetAssignTo("last_graph", strTempDataframe:=ucrInventoryPlotSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") + ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultRFunction.Clone()) TestOkEnabled() End Sub + + Private Sub SetRCodeForControls(bReset As Boolean) + SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) + End Sub + Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click 'there needs to be work on sdgplots before this could be linked 'sdgPlots.SetRSyntax(ucrBase.clsRsyntax) @@ -111,6 +123,7 @@ Public Class dlgInventoryPlot Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() + SetRCodeForControls(True) End Sub Private Sub AllControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrYearReceiver.ControlContentsChanged, ucrColourReceiver.ControlContentsChanged, ucrDayOfYearReceiver.ControlContentsChanged, ucrSaveGraph.ControlContentsChanged diff --git a/instat/dlgOneVariableGraph.vb b/instat/dlgOneVariableGraph.vb index 6e629bacbd3..aeee758c5d0 100644 --- a/instat/dlgOneVariableGraph.vb +++ b/instat/dlgOneVariableGraph.vb @@ -18,31 +18,47 @@ Imports instat.Translations Public Class dlgOneVariableGraph Private bFirstLoad As Boolean = True - Private clsDefaultFunction As New RFunction + Private bReset As Boolean = True Private bResetSubdialog As Boolean = False Private Sub dlgOneVariableGraph_Load(sender As Object, e As EventArgs) Handles Me.Load autoTranslate(Me) If bFirstLoad Then InitialiseDialog() - SetDefaults() bFirstLoad = False - Else - ReopenDialog() End If + If bReset Then + SetDefaults() + End If + SetRCodeForControls(bReset) + bReset = False + ReopenDialog() TestOkEnabled() End Sub Private Sub SetDefaults() - ' Set default RFunction as the base function - ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultFunction.Clone()) + Dim clsDefaultFunction As New RFunction + ucrSelectorOneVarGraph.Reset() ucrSaveGraph.Reset() - SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True) + + 'Define the default RFunction + clsDefaultFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$graph_one_variable") + clsDefaultFunction.AddParameter("numeric", Chr(34) & "geom_boxplot" & Chr(34)) + clsDefaultFunction.AddParameter("categorical", Chr(34) & "geom_bar" & Chr(34)) + clsDefaultFunction.AddParameter("output", Chr(34) & "facets" & Chr(34)) + clsDefaultFunction.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorOneVarGraph.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") + + ' Set default RFunction as the base function + ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultFunction.Clone()) bResetSubdialog = True TestOkEnabled() End Sub + Public Sub SetRCodeForControls(bReset As Boolean) + SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) + End Sub + Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 412 ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False @@ -73,13 +89,6 @@ Public Class dlgOneVariableGraph ucrSaveGraph.SetCheckBoxText("Save Graph") ucrSaveGraph.SetIsComboBox() ucrSaveGraph.SetAssignToIfUncheckedValue("last_graph") - - 'Define the default RFunction - clsDefaultFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$graph_one_variable") - clsDefaultFunction.AddParameter("numeric", Chr(34) & "geom_boxplot" & Chr(34)) - clsDefaultFunction.AddParameter("categorical", Chr(34) & "geom_bar" & Chr(34)) - clsDefaultFunction.AddParameter("output", Chr(34) & "facets" & Chr(34)) - clsDefaultFunction.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorOneVarGraph.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") End Sub Private Sub ReopenDialog() @@ -96,6 +105,7 @@ Public Class dlgOneVariableGraph Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() + SetRCodeForControls(True) TestOkEnabled() End Sub diff --git a/instat/mdlCoreControl.vb b/instat/mdlCoreControl.vb index 5519d71fc67..ac656305c31 100644 --- a/instat/mdlCoreControl.vb +++ b/instat/mdlCoreControl.vb @@ -78,4 +78,16 @@ Module mdlCoreControl ucrTemp.SetParameter(clsNewParameter) Next End Sub + + Public Function AllConditionsSatisfied(lstConditions As List(Of Condition), clsRCode As RCodeStructure) + Dim bTemp As Boolean = True + + For Each clsTempCond In lstConditions + If Not clsTempCond.IsSatisfied(clsRCode) Then + bTemp = False + Exit For + End If + Next + Return bTemp + End Function End Module \ No newline at end of file diff --git a/instat/ucrCore.vb b/instat/ucrCore.vb index 4a7c1028c35..9101c0b9aa8 100644 --- a/instat/ucrCore.vb +++ b/instat/ucrCore.vb @@ -77,6 +77,8 @@ Public Class ucrCore Public bUpdateRCodeFromControl As Boolean = False + Protected lstConditions As New List(Of KeyValuePair(Of Object, List(Of Condition))) + 'Update the control based on the code in RCodeStructure 'bReset : should the control reset to the default value if the parameter is not present in the code Public Overridable Sub UpdateControl(Optional bReset As Boolean = False)