diff --git a/source/Analysis/Analysis.vb b/source/Analysis/Analysis.vb index 4356d802..053e8bf8 100644 --- a/source/Analysis/Analysis.vb +++ b/source/Analysis/Analysis.vb @@ -42,9 +42,9 @@ Friend MustInherit Class Analysis #Region "Eigenschaften" ''' - ''' List of input TimeSeries for analysis + ''' List of analysis parameters ''' - Protected InputTimeSeries As List(Of TimeSeries) + Friend parameters As Dictionary(Of String, AnalysisParameter) ''' ''' Result text @@ -87,11 +87,8 @@ Friend MustInherit Class Analysis ''' ''' Returns a text description of the analysis function - ''' Should be overloaded by inheriting analysis functions ''' - Public Shared Function Description() As String - Return "No description found" - End Function + Public MustOverride ReadOnly Property Description() As String ''' ''' Flag indicating whether the analysis function has a result text @@ -177,13 +174,10 @@ Friend MustInherit Class Analysis ''' ''' Constructor ''' - ''' List of input TimeSeries - Public Sub New(inputseries As List(Of TimeSeries)) - - 'Zeitreihen - Me.InputTimeSeries = inputseries + Public Sub New() 'Datenstrukturen initialisieren + Me.parameters = New Dictionary(Of String, AnalysisParameter) Me.ResultValues = New Dictionary(Of String, Double) Me.ResultSeries = New List(Of TimeSeries) End Sub diff --git a/source/Analysis/AnalysisDialog.Designer.vb b/source/Analysis/AnalysisDialog.Designer.vb index e5add809..b76c1521 100644 --- a/source/Analysis/AnalysisDialog.Designer.vb +++ b/source/Analysis/AnalysisDialog.Designer.vb @@ -22,115 +22,181 @@ Partial Class AnalysisDialog 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. _ Private Sub InitializeComponent() - Dim Label_Series As System.Windows.Forms.Label Dim Label_Analysis As System.Windows.Forms.Label Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(AnalysisDialog)) Me.Button_Cancel = New System.Windows.Forms.Button() - Me.Button_OK = New System.Windows.Forms.Button() - Me.ListBox_Series = New System.Windows.Forms.ListBox() - Me.ComboBox_Analysis = New System.Windows.Forms.ComboBox() + Me.Button_Next = New System.Windows.Forms.Button() Me.Label_AnalaysisDescription = New System.Windows.Forms.Label() Me.LinkLabel_Helplink = New System.Windows.Forms.LinkLabel() - Label_Series = New System.Windows.Forms.Label() + Me.ListBox_AnalysisFunctions = New System.Windows.Forms.ListBox() + Me.WizardPages1 = New BlueM.Wave.WizardPages() + Me.TabPage3 = New System.Windows.Forms.TabPage() + Me.TabPage4 = New System.Windows.Forms.TabPage() + Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() + Me.Label_AnalysisFunction = New System.Windows.Forms.Label() + Me.Button_Previous = New System.Windows.Forms.Button() + Me.Button_Execute = New System.Windows.Forms.Button() Label_Analysis = New System.Windows.Forms.Label() + Me.WizardPages1.SuspendLayout() + Me.TabPage3.SuspendLayout() + Me.TabPage4.SuspendLayout() Me.SuspendLayout() ' - 'Label_Series - ' - Label_Series.AutoSize = True - Label_Series.Location = New System.Drawing.Point(12, 120) - Label_Series.Name = "Label_Series" - Label_Series.Size = New System.Drawing.Size(39, 13) - Label_Series.TabIndex = 8 - Label_Series.Text = "Series:" - ' 'Label_Analysis ' Label_Analysis.AutoSize = True - Label_Analysis.Location = New System.Drawing.Point(12, 15) + Label_Analysis.Location = New System.Drawing.Point(6, 3) Label_Analysis.Name = "Label_Analysis" - Label_Analysis.Size = New System.Drawing.Size(48, 13) + Label_Analysis.Size = New System.Drawing.Size(136, 13) Label_Analysis.TabIndex = 8 - Label_Analysis.Text = "Analysis:" + Label_Analysis.Text = "Select an analysis function:" ' 'Button_Cancel ' Me.Button_Cancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.Button_Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.Button_Cancel.Location = New System.Drawing.Point(207, 308) + Me.Button_Cancel.Location = New System.Drawing.Point(357, 308) Me.Button_Cancel.Name = "Button_Cancel" Me.Button_Cancel.Size = New System.Drawing.Size(75, 23) Me.Button_Cancel.TabIndex = 9 Me.Button_Cancel.Text = "Cancel" Me.Button_Cancel.UseVisualStyleBackColor = True ' - 'Button_OK - ' - Me.Button_OK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.Button_OK.DialogResult = System.Windows.Forms.DialogResult.OK - Me.Button_OK.Location = New System.Drawing.Point(126, 308) - Me.Button_OK.Name = "Button_OK" - Me.Button_OK.Size = New System.Drawing.Size(75, 23) - Me.Button_OK.TabIndex = 7 - Me.Button_OK.Text = "OK" - Me.Button_OK.UseVisualStyleBackColor = True - ' - 'ListBox_Series + 'Button_Next ' - Me.ListBox_Series.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ - Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ListBox_Series.FormattingEnabled = True - Me.ListBox_Series.Location = New System.Drawing.Point(12, 140) - Me.ListBox_Series.Name = "ListBox_Series" - Me.ListBox_Series.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended - Me.ListBox_Series.Size = New System.Drawing.Size(272, 160) - Me.ListBox_Series.TabIndex = 6 - ' - 'ComboBox_Analysis - ' - Me.ComboBox_Analysis.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ComboBox_Analysis.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList - Me.ComboBox_Analysis.FormattingEnabled = True - Me.ComboBox_Analysis.Location = New System.Drawing.Point(69, 12) - Me.ComboBox_Analysis.Name = "ComboBox_Analysis" - Me.ComboBox_Analysis.Size = New System.Drawing.Size(213, 21) - Me.ComboBox_Analysis.TabIndex = 10 + Me.Button_Next.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.Button_Next.Location = New System.Drawing.Point(519, 308) + Me.Button_Next.Name = "Button_Next" + Me.Button_Next.Size = New System.Drawing.Size(75, 23) + Me.Button_Next.TabIndex = 7 + Me.Button_Next.Text = "Next >" + Me.Button_Next.UseVisualStyleBackColor = True ' 'Label_AnalaysisDescription ' Me.Label_AnalaysisDescription.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.Label_AnalaysisDescription.Location = New System.Drawing.Point(12, 44) + Me.Label_AnalaysisDescription.Location = New System.Drawing.Point(233, 19) Me.Label_AnalaysisDescription.Name = "Label_AnalaysisDescription" - Me.Label_AnalaysisDescription.Size = New System.Drawing.Size(272, 51) + Me.Label_AnalaysisDescription.Size = New System.Drawing.Size(428, 216) Me.Label_AnalaysisDescription.TabIndex = 11 - Me.Label_AnalaysisDescription.Text = "Select an analysis method" + Me.Label_AnalaysisDescription.Text = "Select an analysis function" ' 'LinkLabel_Helplink ' Me.LinkLabel_Helplink.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.LinkLabel_Helplink.Location = New System.Drawing.Point(12, 98) + Me.LinkLabel_Helplink.Location = New System.Drawing.Point(233, 251) Me.LinkLabel_Helplink.Name = "LinkLabel_Helplink" - Me.LinkLabel_Helplink.Size = New System.Drawing.Size(272, 16) + Me.LinkLabel_Helplink.Size = New System.Drawing.Size(428, 19) Me.LinkLabel_Helplink.TabIndex = 12 Me.LinkLabel_Helplink.TabStop = True Me.LinkLabel_Helplink.Text = "Open wiki page" ' + 'ListBox_AnalysisFunctions + ' + Me.ListBox_AnalysisFunctions.FormattingEnabled = True + Me.ListBox_AnalysisFunctions.Location = New System.Drawing.Point(6, 19) + Me.ListBox_AnalysisFunctions.Name = "ListBox_AnalysisFunctions" + Me.ListBox_AnalysisFunctions.Size = New System.Drawing.Size(221, 251) + Me.ListBox_AnalysisFunctions.TabIndex = 14 + ' + 'WizardPages1 + ' + Me.WizardPages1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.WizardPages1.Controls.Add(Me.TabPage3) + Me.WizardPages1.Controls.Add(Me.TabPage4) + Me.WizardPages1.Location = New System.Drawing.Point(0, 0) + Me.WizardPages1.Margin = New System.Windows.Forms.Padding(0) + Me.WizardPages1.Name = "WizardPages1" + Me.WizardPages1.SelectedIndex = 0 + Me.WizardPages1.Size = New System.Drawing.Size(675, 305) + Me.WizardPages1.TabIndex = 16 + ' + 'TabPage3 + ' + Me.TabPage3.BackColor = System.Drawing.SystemColors.Control + Me.TabPage3.Controls.Add(Label_Analysis) + Me.TabPage3.Controls.Add(Me.ListBox_AnalysisFunctions) + Me.TabPage3.Controls.Add(Me.Label_AnalaysisDescription) + Me.TabPage3.Controls.Add(Me.LinkLabel_Helplink) + Me.TabPage3.Location = New System.Drawing.Point(4, 22) + Me.TabPage3.Name = "TabPage3" + Me.TabPage3.Padding = New System.Windows.Forms.Padding(3) + Me.TabPage3.Size = New System.Drawing.Size(667, 279) + Me.TabPage3.TabIndex = 0 + Me.TabPage3.Text = "Step1" + ' + 'TabPage4 + ' + Me.TabPage4.BackColor = System.Drawing.SystemColors.Control + Me.TabPage4.Controls.Add(Me.TableLayoutPanel1) + Me.TabPage4.Controls.Add(Me.Label_AnalysisFunction) + Me.TabPage4.Location = New System.Drawing.Point(4, 22) + Me.TabPage4.Name = "TabPage4" + Me.TabPage4.Padding = New System.Windows.Forms.Padding(3) + Me.TabPage4.Size = New System.Drawing.Size(667, 279) + Me.TabPage4.TabIndex = 1 + Me.TabPage4.Text = "Step2" + ' + 'TableLayoutPanel1 + ' + Me.TableLayoutPanel1.AutoSize = True + Me.TableLayoutPanel1.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.[Single] + Me.TableLayoutPanel1.ColumnCount = 2 + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.Location = New System.Drawing.Point(6, 23) + Me.TableLayoutPanel1.Name = "TableLayoutPanel1" + Me.TableLayoutPanel1.RowCount = 2 + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle()) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle()) + Me.TableLayoutPanel1.Size = New System.Drawing.Size(656, 26) + Me.TableLayoutPanel1.TabIndex = 10 + ' + 'Label_AnalysisFunction + ' + Me.Label_AnalysisFunction.AutoSize = True + Me.Label_AnalysisFunction.Location = New System.Drawing.Point(11, 7) + Me.Label_AnalysisFunction.Name = "Label_AnalysisFunction" + Me.Label_AnalysisFunction.Size = New System.Drawing.Size(86, 13) + Me.Label_AnalysisFunction.TabIndex = 9 + Me.Label_AnalysisFunction.Text = "Analysis function" + ' + 'Button_Previous + ' + Me.Button_Previous.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.Button_Previous.Enabled = False + Me.Button_Previous.Location = New System.Drawing.Point(438, 308) + Me.Button_Previous.Name = "Button_Previous" + Me.Button_Previous.Size = New System.Drawing.Size(75, 23) + Me.Button_Previous.TabIndex = 17 + Me.Button_Previous.Text = "< Previous" + Me.Button_Previous.UseVisualStyleBackColor = True + ' + 'Button_Execute + ' + Me.Button_Execute.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.Button_Execute.DialogResult = System.Windows.Forms.DialogResult.OK + Me.Button_Execute.Enabled = False + Me.Button_Execute.Location = New System.Drawing.Point(600, 308) + Me.Button_Execute.Name = "Button_Execute" + Me.Button_Execute.Size = New System.Drawing.Size(75, 23) + Me.Button_Execute.TabIndex = 18 + Me.Button_Execute.Text = "Execute" + Me.Button_Execute.UseVisualStyleBackColor = True + ' 'AnalysisDialog ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(294, 343) - Me.Controls.Add(Me.LinkLabel_Helplink) - Me.Controls.Add(Me.Label_AnalaysisDescription) - Me.Controls.Add(Label_Analysis) - Me.Controls.Add(Me.ComboBox_Analysis) - Me.Controls.Add(Label_Series) - Me.Controls.Add(Me.ListBox_Series) - Me.Controls.Add(Me.Button_OK) + Me.ClientSize = New System.Drawing.Size(684, 343) + Me.Controls.Add(Me.Button_Execute) + Me.Controls.Add(Me.Button_Previous) + Me.Controls.Add(Me.WizardPages1) + Me.Controls.Add(Me.Button_Next) Me.Controls.Add(Me.Button_Cancel) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.MaximizeBox = False @@ -140,14 +206,24 @@ Partial Class AnalysisDialog Me.ShowInTaskbar = False Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent Me.Text = "Analysis" + Me.WizardPages1.ResumeLayout(False) + Me.TabPage3.ResumeLayout(False) + Me.TabPage3.PerformLayout() + Me.TabPage4.ResumeLayout(False) + Me.TabPage4.PerformLayout() Me.ResumeLayout(False) - Me.PerformLayout() End Sub Private WithEvents Button_Cancel As System.Windows.Forms.Button - Private WithEvents Button_OK As System.Windows.Forms.Button - Private WithEvents ListBox_Series As System.Windows.Forms.ListBox - Private WithEvents ComboBox_Analysis As System.Windows.Forms.ComboBox + Private WithEvents Button_Next As System.Windows.Forms.Button Friend WithEvents Label_AnalaysisDescription As Label Friend WithEvents LinkLabel_Helplink As LinkLabel + Friend WithEvents ListBox_AnalysisFunctions As ListBox + Friend WithEvents WizardPages1 As WizardPages + Friend WithEvents TabPage3 As TabPage + Friend WithEvents TabPage4 As TabPage + Private WithEvents Button_Previous As Button + Friend WithEvents Label_AnalysisFunction As Label + Friend WithEvents TableLayoutPanel1 As TableLayoutPanel + Private WithEvents Button_Execute As Button End Class diff --git a/source/Analysis/AnalysisDialog.resx b/source/Analysis/AnalysisDialog.resx index d8f15b44..f988780f 100644 --- a/source/Analysis/AnalysisDialog.resx +++ b/source/Analysis/AnalysisDialog.resx @@ -112,18 +112,15 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + False - - False - - + AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAABMLAAATCwAAAAAAAAAA diff --git a/source/Analysis/AnalysisDialog.vb b/source/Analysis/AnalysisDialog.vb index 02e176da..4aa1fccd 100644 --- a/source/Analysis/AnalysisDialog.vb +++ b/source/Analysis/AnalysisDialog.vb @@ -20,17 +20,24 @@ ''' Friend Class AnalysisDialog + Friend analysis As Analysis + Private isInitializing As Boolean + Private seriesList As List(Of TimeSeries) + Public Sub New(seriesList As List(Of TimeSeries)) Call InitializeComponent() + Me.isInitializing = True + 'Populate combobox with analysis functions - Me.ComboBox_Analysis.DataSource = System.Enum.GetValues(GetType(AnalysisFactory.AnalysisFunctions)) + Me.ListBox_AnalysisFunctions.DataSource = System.Enum.GetValues(GetType(AnalysisFactory.AnalysisFunctions)) + Me.ListBox_AnalysisFunctions.SelectedIndex = -1 - 'Populate listbox with time series - For Each series As TimeSeries In seriesList - Me.ListBox_Series.Items.Add(series) - Next + 'store list of time series + Me.seriesList = seriesList + + Me.isInitializing = False End Sub @@ -40,21 +47,8 @@ Friend Class AnalysisDialog ''' Friend ReadOnly Property selectedAnalysisFunction() As AnalysisFactory.AnalysisFunctions Get - Return Me.ComboBox_Analysis.SelectedItem - End Get - End Property - ''' - ''' List of selected time series - ''' - ''' - Friend ReadOnly Property selectedTimeseries() As List(Of TimeSeries) - Get - Dim seriesList As New List(Of TimeSeries)() - For Each item As Object In Me.ListBox_Series.SelectedItems - seriesList.Add(CType(item, TimeSeries).Clone()) - Next - Return seriesList + Return Me.ListBox_AnalysisFunctions.SelectedItem End Get End Property @@ -63,14 +57,88 @@ Friend Class AnalysisDialog ''' ''' ''' - Private Sub ComboBox_Analysis_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox_Analysis.SelectedIndexChanged + Private Sub ComboBox_Analysis_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox_AnalysisFunctions.SelectedIndexChanged + + If Me.isInitializing Then + Return + End If + + Me.analysis = AnalysisFactory.CreateAnalysis(Me.selectedAnalysisFunction) + Dim url As String 'update the description and wiki link - Me.Label_AnalaysisDescription.Text = AnalysisFactory.getAnalysisDescription(Me.selectedAnalysisFunction) + Me.Label_AnalaysisDescription.Text = Me.analysis.Description url = "https://wiki.bluemodel.org/index.php/Wave:" & Me.selectedAnalysisFunction.ToString("g") Me.LinkLabel_Helplink.Text = url Me.LinkLabel_Helplink.Links.Clear() Me.LinkLabel_Helplink.Links.Add(0, Me.LinkLabel_Helplink.Text.Length, url) + + 'prepare second wizard page + Me.Label_AnalysisFunction.Text = Me.selectedAnalysisFunction.ToString("g") + Me.TableLayoutPanel1.Controls.Clear() + Me.TableLayoutPanel1.RowCount = analysis.parameters.Count + Me.TableLayoutPanel1.Visible = True + Dim row As Integer = 0 + For Each param As AnalysisParameter In analysis.parameters.Values + + 'label + Dim label As New Label() + label.Text = param.Description & ":" + label.AutoSize = True + Me.TableLayoutPanel1.Controls.Add(label) + Me.TableLayoutPanel1.SetCellPosition(label, New TableLayoutPanelCellPosition(0, row)) + + 'input control + Dim control As New Control() + Select Case param.ParameterType + + Case AnalysisParameter.ParameterTypeEnum.Timeseries + Select Case param.ParameterAmount + Case AnalysisParameter.ParameterAmountEnum.Single + Dim combobox As New ComboBox() + combobox.DropDownStyle = ComboBoxStyle.DropDownList + For Each ts As TimeSeries In Me.seriesList + combobox.Items.Add(ts) + Next + combobox.SelectedIndex = 0 + param.Value = combobox.SelectedItem + combobox.DataBindings.Add(New Binding("SelectedItem", param, "Value")) + control = combobox + + Case AnalysisParameter.ParameterAmountEnum.Multiple + Dim listbox As New ListBox() + listbox.SelectionMode = SelectionMode.MultiExtended + For Each ts As TimeSeries In Me.seriesList + listbox.Items.Add(ts) + Next + listbox.SelectedIndex = -1 + param.Value = listbox.SelectedItems + listbox.DataBindings.Add(New Binding("SelectedItems", param, "Value")) 'TODO: cannot bind to a read-only property! + control = listbox + End Select + + Case AnalysisParameter.ParameterTypeEnum.Integer + Dim numericupdown As New NumericUpDown() + numericupdown.Minimum = param.MinValue + numericupdown.Maximum = param.MaxValue + param.Value = param.DefaultValue + numericupdown.DataBindings.Add(New Binding("Value", param, "Value")) + control = numericupdown + + Case AnalysisParameter.ParameterTypeEnum.Boolean + Dim checkbox As New CheckBox() + checkbox.Checked = param.DefaultValue + checkbox.DataBindings.Add(New Binding("Checked", param, "Value", True)) + control = checkbox + + End Select + + Me.TableLayoutPanel1.Controls.Add(control) + Me.TableLayoutPanel1.SetCellPosition(control, New TableLayoutPanelCellPosition(1, row)) + + row += 1 + Next + 'Me.TableLayoutPanel1.Refresh() End Sub ''' @@ -87,11 +155,32 @@ Friend Class AnalysisDialog ''' ''' ''' - Private Sub Button_OK_Click(sender As System.Object, e As System.EventArgs) Handles Button_OK.Click - 'Eingabekontrolle - If (Me.ListBox_Series.SelectedItems.Count < 1) Then - MsgBox("Please select at least one series!", MsgBoxStyle.Exclamation) - Me.DialogResult = Windows.Forms.DialogResult.None + Private Sub Button_Next_Click(sender As System.Object, e As System.EventArgs) Handles Button_Next.Click + Me.WizardPages1.SelectedIndex += 1 + End Sub + + Private Sub Button_Previous_Click(sender As Object, e As EventArgs) Handles Button_Previous.Click + Me.WizardPages1.SelectedIndex -= 1 + End Sub + + Private Sub WizardPages1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles WizardPages1.SelectedIndexChanged + + If Me.WizardPages1.SelectedIndex > 0 Then + Me.Button_Previous.Enabled = True + Else + Me.Button_Previous.Enabled = False + End If + + If Me.WizardPages1.SelectedIndex < Me.WizardPages1.TabCount - 1 Then + Me.Button_Next.Enabled = True + Else + Me.Button_Next.Enabled = False + End If + + If Me.WizardPages1.SelectedIndex = Me.WizardPages1.TabCount - 1 Then + Me.Button_Execute.Enabled = True + Else + Me.Button_Execute.Enabled = False End If End Sub diff --git a/source/Analysis/AnalysisFactory.vb b/source/Analysis/AnalysisFactory.vb index b5d9b99f..dcf30eb9 100644 --- a/source/Analysis/AnalysisFactory.vb +++ b/source/Analysis/AnalysisFactory.vb @@ -39,94 +39,54 @@ Friend Module AnalysisFactory 'TestAnalysis 'EDIT THIS End Enum - ''' - ''' Returns a text description of the analysis function - ''' - ''' - ''' - Public Function getAnalysisDescription(analysisfunction As AnalysisFunctions) As String - Select Case analysisfunction - Case AnalysisFunctions.AnnualStatistics - Return AnnualStatistics.Description - Case AnalysisFunctions.Autocorrelation - Return Autocorrelation.Description - Case AnalysisFunctions.Calculator - Return Calculator.Description - Case AnalysisFunctions.ChangeTimestep - Return ChangeTimestep.Description - Case AnalysisFunctions.Comparison - Return Comparison.Description - Case AnalysisFunctions.Cumulative - Return Cumulative.Description - Case AnalysisFunctions.DoubleSumCurve - Return DoubleSumCurve.Description - Case AnalysisFunctions.GoodnessOfFit - Return GoodnessOfFit.Description - Case AnalysisFunctions.Histogram - Return Histogram.Description - Case AnalysisFunctions.LinearRegression - Return LinearRegression.Description - Case AnalysisFunctions.MonthlyStatistics - Return MonthlyStatistics.Description - Case AnalysisFunctions.TimestepAnalysis - Return TimeStepAnalysis.Description - 'Case AnalysisFunctions.TestAnalysis 'EDIT THIS - ' Return TestAnalysis.Description 'EDIT THIS - Case Else - Return "Description not found" - End Select - End Function - - ''' ''' Factory method for creating an analysis instance ''' ''' the type of analysis instance to create - ''' list of input TimeSeries ''' the analysis instance - Public Function CreateAnalysis(analysisfunction As AnalysisFunctions, seriesList As List(Of TimeSeries)) As Analysis + Public Function CreateAnalysis(analysisfunction As AnalysisFunctions) As Analysis Dim oAnalysis As Analysis Select Case analysisfunction Case AnalysisFunctions.AnnualStatistics - oAnalysis = New AnnualStatistics(seriesList) + oAnalysis = New AnnualStatistics() Case AnalysisFunctions.Autocorrelation - oAnalysis = New Autocorrelation(seriesList) + oAnalysis = New Autocorrelation() Case AnalysisFunctions.Calculator - oAnalysis = New Calculator(seriesList) + oAnalysis = New Calculator() - Case AnalysisFunctions.ChangeTimestep - oAnalysis = New ChangeTimestep(seriesList) + 'Case AnalysisFunctions.ChangeTimestep + ' oAnalysis = New ChangeTimestep() - Case AnalysisFunctions.Comparison - oAnalysis = New Comparison(seriesList) + 'Case AnalysisFunctions.Comparison + ' oAnalysis = New Comparison() - Case AnalysisFunctions.Cumulative - oAnalysis = New Cumulative(seriesList) + 'Case AnalysisFunctions.Cumulative + ' oAnalysis = New Cumulative() - Case AnalysisFunctions.DoubleSumCurve - oAnalysis = New DoubleSumCurve(seriesList) + 'Case AnalysisFunctions.DoubleSumCurve + ' oAnalysis = New DoubleSumCurve() - Case AnalysisFunctions.GoodnessOfFit - oAnalysis = New GoodnessOfFit(seriesList) + 'Case AnalysisFunctions.GoodnessOfFit + ' oAnalysis = New GoodnessOfFit() - Case AnalysisFunctions.Histogram - oAnalysis = New Histogram(seriesList) + 'Case AnalysisFunctions.Histogram + ' oAnalysis = New Histogram() - Case AnalysisFunctions.LinearRegression - oAnalysis = New LinearRegression(seriesList) + 'Case AnalysisFunctions.LinearRegression + ' oAnalysis = New LinearRegression() - Case AnalysisFunctions.MonthlyStatistics - oAnalysis = New MonthlyStatistics(seriesList) + 'Case AnalysisFunctions.MonthlyStatistics + ' oAnalysis = New MonthlyStatistics() - Case AnalysisFunctions.TimestepAnalysis - oAnalysis = New TimeStepAnalysis(seriesList) + 'Case AnalysisFunctions.TimestepAnalysis + ' oAnalysis = New TimeStepAnalysis() - 'Case AnalysisFunctions.TestAnalysis 'EDIT THIS - ' oAnalysis = New TestAnalysis(seriesList) 'EDIT THIS + 'Case AnalysisFunctions.TestAnalysis 'EDIT THIS + ' oAnalysis = New TestAnalysis() 'EDIT THIS Case Else Throw New Exception("Analysis not found!") diff --git a/source/Analysis/AnalysisParameter.vb b/source/Analysis/AnalysisParameter.vb new file mode 100644 index 00000000..d60aa08d --- /dev/null +++ b/source/Analysis/AnalysisParameter.vb @@ -0,0 +1,78 @@ +'BlueM.Wave +'Copyright (C) BlueM Dev Group +' +' +'This program is free software: you can redistribute it and/or modify +'it under the terms of the GNU Lesser 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 Lesser General Public License for more details. +' +'You should have received a copy of the GNU Lesser General Public License +'along with this program. If not, see . +' +''' +''' Class representing an input parameter for an analysis +''' +Friend Class AnalysisParameter + + Public Enum ParameterTypeEnum + Timeseries + [Integer] + [Date] + [Boolean] + End Enum + + Public Enum ParameterAmountEnum + [Single] + Multiple + End Enum + + Public ParameterType As ParameterTypeEnum + Public ParameterAmount As ParameterAmountEnum + Public Description As String + Public DefaultValue As Object + Public MinValue As Object + Public MaxValue As Object + Private _Value As Object + + ''' + ''' Parameter value + ''' + ''' + Public Property Value As Object + Get + Return _Value + End Get + Set + _Value = Value + End Set + End Property + + ''' + ''' Constructor + ''' + ''' Parameter description + ''' Parameter type + ''' Parameter amount (single/multiple) + ''' Default value + ''' Minimum value + ''' Maximum value + Public Sub New(description As String, type As ParameterTypeEnum, amount As ParameterAmountEnum, Optional def As Object = Nothing, Optional min As Object = Nothing, Optional max As Object = Nothing) + + Me.Description = description + Me.ParameterType = type + Me.ParameterAmount = amount + Me.DefaultValue = def + Me.MinValue = min + Me.MaxValue = max + + Me.Value = Nothing + + End Sub + +End Class diff --git a/source/Analysis/AnnualStatistics.vb b/source/Analysis/AnnualStatistics.vb index a0ee1648..6d7b09cb 100644 --- a/source/Analysis/AnnualStatistics.vb +++ b/source/Analysis/AnnualStatistics.vb @@ -32,12 +32,16 @@ Friend Class AnnualStatistics Public vol As Double End Structure + Private timeseries As TimeSeries + Private startOfHydrologicalYear As Integer Private stats As Dictionary(Of String, struct_stat) Private generateBoundingBoxes As Boolean - Public Overloads Shared Function Description() As String - Return "Calculates annual statistics (min, max, avg, vol) based on hydrological years." - End Function + Public Overrides ReadOnly Property Description() As String + Get + Return "Calculates annual statistics (min, max, avg, vol) based on hydrological years." + End Get + End Property Public Overrides ReadOnly Property hasResultChart() As Boolean Get @@ -73,12 +77,18 @@ Friend Class AnnualStatistics End Get End Property - Public Sub New(ByRef series As List(Of TimeSeries)) - MyBase.New(series) - 'Check: expects exactly one series - If (series.Count <> 1) Then - Throw New Exception("The Annual Statistics analysis requires the selection of exactly 1 time series!") - End If + Public Sub New() + MyBase.New() + MyBase.parameters.Add("timeseries", + New AnalysisParameter("Input time series", AnalysisParameter.ParameterTypeEnum.Timeseries, AnalysisParameter.ParameterAmountEnum.Single) + ) + MyBase.parameters.Add("startOfHydrologicalYear", + New AnalysisParameter("Start of hydrological year", AnalysisParameter.ParameterTypeEnum.Integer, AnalysisParameter.ParameterAmountEnum.Single, def:=11, min:=1, max:=12) + ) + MyBase.parameters.Add("generateBoundingBoxes", + New AnalysisParameter("Generate annual bounding boxes (max, avg, min)", AnalysisParameter.ParameterTypeEnum.Boolean, AnalysisParameter.ParameterAmountEnum.Single, def:=False) + ) + 'initialize data structures stats = New Dictionary(Of String, struct_stat) End Sub @@ -97,26 +107,22 @@ Friend Class AnnualStatistics Public Overrides Sub ProcessAnalysis() Dim hyoseries As Dictionary(Of Integer, TimeSeries) Dim year As Integer - Dim series As TimeSeries - - Dim dialog As New AnnualStatistics_Dialog() - Dim dialogResult As DialogResult = dialog.ShowDialog() - If dialogResult <> DialogResult.OK Then - Throw New Exception("User abort!") - End If + Dim ts As TimeSeries - Dim startMonth As Integer = CType(dialog.ComboBox_startMonth.SelectedItem, Month).number - Me.generateBoundingBoxes = dialog.CheckBox_boundingbox.Checked + 'get input parameters + Me.timeseries = MyBase.parameters("timeseries").Value + Me.startOfHydrologicalYear = MyBase.parameters("startOfHydrologicalYear").Value + Me.generateBoundingBoxes = MyBase.parameters("generateBoundingBoxes").Value 'stats for entire series - Me.stats.Add("Entire series", calculateStats(Me.InputTimeSeries(0))) + Me.stats.Add("Entire series", calculateStats(Me.timeseries)) 'stats for hydrological years - hyoseries = Me.InputTimeSeries(0).SplitHydroYears(startMonth) + hyoseries = Me.timeseries.SplitHydroYears(Me.startOfHydrologicalYear) For Each kvp As KeyValuePair(Of Integer, TimeSeries) In hyoseries year = kvp.Key - series = kvp.Value - Me.stats.Add(year.ToString, calculateStats(series)) + ts = kvp.Value + Me.stats.Add(year.ToString, calculateStats(ts)) Next End Sub @@ -124,7 +130,7 @@ Friend Class AnnualStatistics Public Overrides Sub PrepareResults() 'result table - Me.ResultTable = New DataTable($"Annual statistics: {Me.InputTimeSeries(0).Title}") + Me.ResultTable = New DataTable($"Annual statistics: {Me.timeseries.Title}") Me.ResultTable.Columns.Add("Period", GetType(String)) Me.ResultTable.Columns.Add("Start", GetType(DateTime)) @@ -153,7 +159,7 @@ Friend Class AnnualStatistics 'Generate timeseries with max/avg/min values if checkbox is checked and at least two years are present If (Me.generateBoundingBoxes And Me.stats.Count > 2) Then 'Prepare output timeseries - Dim basename As String = Me.InputTimeSeries(0).Title + Dim basename As String = Me.timeseries.Title Dim timeseries_max As TimeSeries = New TimeSeries(basename & " (annual maximum)") Dim timeseries_avg As TimeSeries = New TimeSeries(basename & " (annual average)") Dim timeseries_min As TimeSeries = New TimeSeries(basename & " (annual minimum)") @@ -164,7 +170,7 @@ Friend Class AnnualStatistics timeseries_min.Interpretation = TimeSeries.InterpretationEnum.BlockRight 'Transfer unit from input timeseries - Dim unit As String = Me.InputTimeSeries(0).Unit + Dim unit As String = Me.timeseries.Unit timeseries_max.Unit = unit timeseries_avg.Unit = unit timeseries_min.Unit = unit diff --git a/source/Analysis/AnnualStatistics_Dialog.Designer.vb b/source/Analysis/AnnualStatistics_Dialog.Designer.vb deleted file mode 100644 index 305a0b97..00000000 --- a/source/Analysis/AnnualStatistics_Dialog.Designer.vb +++ /dev/null @@ -1,96 +0,0 @@ - -Partial Class AnnualStatistics_Dialog - Inherits System.Windows.Forms.Form - - 'Form overrides dispose to clean up the component list. - - Protected Overrides Sub Dispose(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() - Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(AnnualStatistics_Dialog)) - Me.Button_OK = New System.Windows.Forms.Button() - Me.ComboBox_startMonth = New System.Windows.Forms.ComboBox() - Me.Label_startMonth = New System.Windows.Forms.Label() - Me.CheckBox_boundingbox = New System.Windows.Forms.CheckBox() - Me.SuspendLayout() - ' - 'Button_OK - ' - Me.Button_OK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.Button_OK.DialogResult = System.Windows.Forms.DialogResult.OK - Me.Button_OK.Location = New System.Drawing.Point(192, 59) - Me.Button_OK.Name = "Button_OK" - Me.Button_OK.Size = New System.Drawing.Size(75, 23) - Me.Button_OK.TabIndex = 3 - Me.Button_OK.Text = "OK" - Me.Button_OK.UseVisualStyleBackColor = True - ' - 'ComboBox_startMonth - ' - Me.ComboBox_startMonth.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList - Me.ComboBox_startMonth.FormattingEnabled = True - Me.ComboBox_startMonth.Location = New System.Drawing.Point(144, 6) - Me.ComboBox_startMonth.Name = "ComboBox_startMonth" - Me.ComboBox_startMonth.Size = New System.Drawing.Size(123, 21) - Me.ComboBox_startMonth.TabIndex = 14 - ' - 'Label_startMonth - ' - Me.Label_startMonth.AutoSize = True - Me.Label_startMonth.Location = New System.Drawing.Point(12, 9) - Me.Label_startMonth.Name = "Label_startMonth" - Me.Label_startMonth.Size = New System.Drawing.Size(126, 13) - Me.Label_startMonth.TabIndex = 13 - Me.Label_startMonth.Text = "Start of hydrological year:" - ' - 'CheckBox_boundingbox - ' - Me.CheckBox_boundingbox.AutoSize = True - Me.CheckBox_boundingbox.Location = New System.Drawing.Point(12, 33) - Me.CheckBox_boundingbox.Name = "CheckBox_boundingbox" - Me.CheckBox_boundingbox.Size = New System.Drawing.Size(257, 17) - Me.CheckBox_boundingbox.TabIndex = 15 - Me.CheckBox_boundingbox.Text = "Generate annual bounding boxes (max, avg, min)" - Me.CheckBox_boundingbox.UseVisualStyleBackColor = True - ' - 'AnnualStatistics_Dialog - ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(279, 94) - Me.Controls.Add(Me.CheckBox_boundingbox) - Me.Controls.Add(Me.ComboBox_startMonth) - Me.Controls.Add(Me.Label_startMonth) - Me.Controls.Add(Me.Button_OK) - Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog - Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) - Me.MaximizeBox = False - Me.MinimizeBox = False - Me.Name = "AnnualStatistics_Dialog" - Me.ShowInTaskbar = False - Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent - Me.Text = "AnnualStatistics" - Me.ResumeLayout(False) - Me.PerformLayout() - - End Sub - Private WithEvents Button_OK As System.Windows.Forms.Button - Friend WithEvents ComboBox_startMonth As ComboBox - Friend WithEvents Label_startMonth As Label - Friend WithEvents CheckBox_boundingbox As CheckBox -End Class diff --git a/source/Analysis/AnnualStatistics_Dialog.resx b/source/Analysis/AnnualStatistics_Dialog.resx deleted file mode 100644 index 192f6f4e..00000000 --- a/source/Analysis/AnnualStatistics_Dialog.resx +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAABMLAAATCwAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAALRpK/+zaCv/smgq/7FoKv+wZir/r2Yq/69mKf+uZSn/rmUo/61kKP+tZCj/rGQo/6tj - KP+rYyj/AAAAAAAAAAC2ai3/KWgyTydoMUY5UCdFJ2gxCQAAAABIKBMdAAAAAAAAAABCJRIdAAAAACdv - MhosWihoKHM1DAAAAAAAAAAAt2st/yx0ORkrdTiZLXU34it1OO0sdjhoAAAAAAAAAAAAAAAAAAAAACt/ - OAgsgjjeK4Q2kwAAAAAAAAAAAAAAALltLv8oFZxAAAAAAAAAAAAyiEGWMolB8TGKQKIxjEAMAAAAAAAA - AAAxj0CIL5I+7wAAAAAAAAAAAAAAAAAAAAC7bi//BAD5VAQA+xcAAAAAAAAAADmZSko5mUjoN5pI4Dib - Rq02nUW+NZ9E9DOgQl8AAAAAEQ39GgAAAAAAAAAAvW8w/wUB/08GAv/cAAAAAAAAAAAAAAAA3FAAd0Ci - Spc8pEvMOqRJzTejRlcAAAAAAAAAABsX+7AAAAAAAAAAAL5xMP9QMHsvEQ39/hIO/IbgWACE4FcA/+BX - Av3gVwP+31YGVwAAAAAAAAAAAAAAAAAAAAAkIfn6AAAAAAAAAADAcjL/AAAAABoW+6UcGfn7uk499+Bh - CpLhYg0D32IQuN5hEfjdYhV+AAAAAAAAAAAtKvnALiv38AAAAAAAAAAAwnMy/wAAAAAAAAAAOSrr/kUx - 4fkAAAAAAAAAAAAAAADgbyCo3nIk+95zJ581MvclNjP2/4hbppcAAAAAAAAAAMNzM/+ARyId4XYbiq9g - Z/o4MvX3OTb2lQAAAAAAAAAAAAAAAOB/M43fgTf934I5+9+GPPnfiD7+AAAAAAAAAADEdDT/4oAmA+B/ - LPnggTC2QT71h0NA9P5GQ/M8AAAAAAAAAABJRvMiS0jx8VBK7vbgk0uAAAAAAAAAAAAAAAAAxXU0/+CH - ODPeiT/93oxBCQAAAABQTfHDUk/y+lJP8spTUfDdU1Hw+1NR8OJTUfAiAAAAAAAAAAAAAAAAAAAAAMZ2 - NP/GfT9m3ZJPpwAAAAAAAAAAAAAAAFpY74paWO/gWVfv01lX714AAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AADGdjT/3ZdbVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAA//8AAIABAAC//wAAo/MAALjnAAC+DwAArx0AAKB9AAChOQAAs4kAAKHBAACh4wAArA8AAK4/ - //+//////////w== - - - \ No newline at end of file diff --git a/source/Analysis/AnnualStatistics_Dialog.vb b/source/Analysis/AnnualStatistics_Dialog.vb deleted file mode 100644 index 1d3ff8ee..00000000 --- a/source/Analysis/AnnualStatistics_Dialog.vb +++ /dev/null @@ -1,34 +0,0 @@ -'BlueM.Wave -'Copyright (C) BlueM Dev Group -' -' -'This program is free software: you can redistribute it and/or modify -'it under the terms of the GNU Lesser 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 Lesser General Public License for more details. -' -'You should have received a copy of the GNU Lesser General Public License -'along with this program. If not, see . -' -Friend Class AnnualStatistics_Dialog - - Public Sub New() - - ' This call is required by the Windows Form Designer. - InitializeComponent() - - ' Add any initialization after the InitializeComponent() call. - - Me.ComboBox_startMonth.BeginUpdate() - Me.ComboBox_startMonth.Items.AddRange(Helpers.CalendarMonths.ToArray) - Me.ComboBox_startMonth.EndUpdate() - - Me.ComboBox_startMonth.SelectedIndex = 10 'November - End Sub - -End Class \ No newline at end of file diff --git a/source/Analysis/Autocorrelation.vb b/source/Analysis/Autocorrelation.vb index 05b9db6a..6717e23b 100644 --- a/source/Analysis/Autocorrelation.vb +++ b/source/Analysis/Autocorrelation.vb @@ -32,9 +32,11 @@ Friend Class Autocorrelation Private dtList As List(Of TimeSpan) 'list of time step differences Private periode_avg As Double 'Durchschinttliche Periode - Public Overloads Shared Function Description() As String - Return "Autocorrelation analysis for analyzing time series periodicity" - End Function + Public Overrides ReadOnly Property Description() As String + Get + Return "Autocorrelation analysis for analyzing time series periodicity" + End Get + End Property ''' ''' Flag, der anzeigt, ob die Analysefunktion einen Ergebnistext erzeugt @@ -82,17 +84,18 @@ Friend Class Autocorrelation ''' ''' Konstruktor ''' - ''' zu analysierende Zeitreihen - Public Sub New(ByRef zeitreihen As List(Of TimeSeries)) - - 'Konstruktor der Basisklasse aufrufen! - Call MyBase.New(zeitreihen) - - 'Prüfung: Anzahl erwarteter Zeitreihen - If (zeitreihen.Count <> 1) Then - Throw New Exception("The Autocorrelation analysis requires the selection of exactly 1 time series!") - End If - + Public Sub New() + MyBase.New() + 'define input parameters + MyBase.parameters.Add("timeseries", + New AnalysisParameter("Input time series", AnalysisParameter.ParameterTypeEnum.Timeseries, AnalysisParameter.ParameterAmountEnum.Single) + ) + MyBase.parameters.Add("lagSize", + New AnalysisParameter("Number of time steps", AnalysisParameter.ParameterTypeEnum.Integer, AnalysisParameter.ParameterAmountEnum.Single, def:=5, min:=1, max:=10) + ) + MyBase.parameters.Add("numberOfOffsets", + New AnalysisParameter("Number of offsets", AnalysisParameter.ParameterTypeEnum.Integer, AnalysisParameter.ParameterAmountEnum.Single, def:=300, min:=1, max:=2000) + ) End Sub ''' @@ -100,18 +103,19 @@ Friend Class Autocorrelation ''' Public Overrides Sub ProcessAnalysis() - Me.ts_in = Me.InputTimeSeries(0) - - 'Parameter-Dialog anzeigen - Dim dialog As New Autocorrelation_Dialog(Me.ts_in) - If (dialog.ShowDialog() <> DialogResult.OK) Then - Throw New Exception("User abort") + 'get input parameters + Me.ts_in = MyBase.parameters("timeseries").Value + Me.lagSize = MyBase.parameters("lagSize").Value + Me.lagCount = MyBase.parameters("numberOfOffsets").Value + + 'Check max possible lag + Dim maxlag As Integer = Me.ts_in.Length / Me.lagSize - 1 + If Me.lagSize * Me.lagCount > Me.ts_in.Length Then + Throw New Exception( + $"The selected time series is too short or the largest lag is too long! " & + $"Please select at most {maxlag} offsets with the currently set number of time steps!") End If - 'Parameter der Lags aus Dialog abfragen - Me.lagSize = dialog.lagSize - Me.lagCount = dialog.lagCount - 'Announce progress start MyBase.AnalysisProgressStart(lagCount) diff --git a/source/Analysis/Autocorrelation_Dialog.Designer.vb b/source/Analysis/Autocorrelation_Dialog.Designer.vb deleted file mode 100644 index f55b24aa..00000000 --- a/source/Analysis/Autocorrelation_Dialog.Designer.vb +++ /dev/null @@ -1,201 +0,0 @@ - _ -Partial Class Autocorrelation_Dialog - Inherits System.Windows.Forms.Form - - 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. - _ - 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 - - 'Wird vom Windows Form-Designer benötigt. - Private components As System.ComponentModel.IContainer - - 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. - 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. - 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. - _ - Private Sub InitializeComponent() - Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Autocorrelation_Dialog)) - Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() - Me.Cancel_Button = New System.Windows.Forms.Button() - Me.OK_Button = New System.Windows.Forms.Button() - Me.spnAnzahlLag = New System.Windows.Forms.NumericUpDown() - Me.spnGroesseLag = New System.Windows.Forms.NumericUpDown() - Me.Label2 = New System.Windows.Forms.Label() - Me.Label1 = New System.Windows.Forms.Label() - Me.Label4 = New System.Windows.Forms.Label() - Me.Label5 = New System.Windows.Forms.Label() - Me.Label7 = New System.Windows.Forms.Label() - Me.GroupBox1 = New System.Windows.Forms.GroupBox() - Me.TableLayoutPanel1.SuspendLayout() - CType(Me.spnAnzahlLag, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.spnGroesseLag, System.ComponentModel.ISupportInitialize).BeginInit() - Me.GroupBox1.SuspendLayout() - Me.SuspendLayout() - ' - 'TableLayoutPanel1 - ' - Me.TableLayoutPanel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TableLayoutPanel1.ColumnCount = 2 - Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) - Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) - Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0) - Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0) - Me.TableLayoutPanel1.Location = New System.Drawing.Point(152, 171) - Me.TableLayoutPanel1.Name = "TableLayoutPanel1" - Me.TableLayoutPanel1.RowCount = 1 - Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) - Me.TableLayoutPanel1.Size = New System.Drawing.Size(146, 29) - Me.TableLayoutPanel1.TabIndex = 0 - ' - 'Cancel_Button - ' - Me.Cancel_Button.Anchor = System.Windows.Forms.AnchorStyles.None - Me.Cancel_Button.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.Cancel_Button.Location = New System.Drawing.Point(76, 3) - Me.Cancel_Button.Name = "Cancel_Button" - Me.Cancel_Button.Size = New System.Drawing.Size(67, 23) - Me.Cancel_Button.TabIndex = 1 - Me.Cancel_Button.Text = "Cancel" - ' - 'OK_Button - ' - Me.OK_Button.Anchor = System.Windows.Forms.AnchorStyles.None - Me.OK_Button.Location = New System.Drawing.Point(3, 3) - Me.OK_Button.Name = "OK_Button" - Me.OK_Button.Size = New System.Drawing.Size(67, 23) - Me.OK_Button.TabIndex = 0 - Me.OK_Button.Text = "OK" - ' - 'spnAnzahlLag - ' - Me.spnAnzahlLag.Location = New System.Drawing.Point(121, 47) - Me.spnAnzahlLag.Maximum = New Decimal(New Integer() {2000, 0, 0, 0}) - Me.spnAnzahlLag.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.spnAnzahlLag.Name = "spnAnzahlLag" - Me.spnAnzahlLag.Size = New System.Drawing.Size(68, 20) - Me.spnAnzahlLag.TabIndex = 9 - Me.spnAnzahlLag.Value = New Decimal(New Integer() {300, 0, 0, 0}) - ' - 'spnGroesseLag - ' - Me.spnGroesseLag.Location = New System.Drawing.Point(121, 22) - Me.spnGroesseLag.Maximum = New Decimal(New Integer() {10, 0, 0, 0}) - Me.spnGroesseLag.Minimum = New Decimal(New Integer() {1, 0, 0, 0}) - Me.spnGroesseLag.Name = "spnGroesseLag" - Me.spnGroesseLag.Size = New System.Drawing.Size(68, 20) - Me.spnGroesseLag.TabIndex = 8 - Me.spnGroesseLag.Value = New Decimal(New Integer() {5, 0, 0, 0}) - ' - 'Label2 - ' - Me.Label2.AutoSize = True - Me.Label2.Location = New System.Drawing.Point(6, 49) - Me.Label2.Name = "Label2" - Me.Label2.Size = New System.Drawing.Size(93, 13) - Me.Label2.TabIndex = 6 - Me.Label2.Text = "Number of offsets:" - ' - 'Label1 - ' - Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(6, 24) - Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(109, 13) - Me.Label1.TabIndex = 5 - Me.Label1.Text = "Number of time steps:" - ' - 'Label4 - ' - Me.Label4.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ - Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.Label4.AutoEllipsis = True - Me.Label4.Location = New System.Drawing.Point(12, 93) - Me.Label4.Name = "Label4" - Me.Label4.Size = New System.Drawing.Size(286, 75) - Me.Label4.TabIndex = 10 - Me.Label4.Text = "More offsets take longer to compute." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "NOTE: The time series should not contain " & - "a trend and be equidistant." - ' - 'Label5 - ' - Me.Label5.AutoSize = True - Me.Label5.ForeColor = System.Drawing.SystemColors.ControlText - Me.Label5.Location = New System.Drawing.Point(195, 24) - Me.Label5.Name = "Label5" - Me.Label5.Size = New System.Drawing.Size(40, 13) - Me.Label5.TabIndex = 13 - Me.Label5.Text = "(1 - 10)" - ' - 'Label7 - ' - Me.Label7.AutoSize = True - Me.Label7.Location = New System.Drawing.Point(195, 49) - Me.Label7.Name = "Label7" - Me.Label7.Size = New System.Drawing.Size(52, 13) - Me.Label7.TabIndex = 14 - Me.Label7.Text = "(1 - 2000)" - ' - 'GroupBox1 - ' - Me.GroupBox1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.GroupBox1.Controls.Add(Me.Label7) - Me.GroupBox1.Controls.Add(Me.Label1) - Me.GroupBox1.Controls.Add(Me.Label5) - Me.GroupBox1.Controls.Add(Me.Label2) - Me.GroupBox1.Controls.Add(Me.spnGroesseLag) - Me.GroupBox1.Controls.Add(Me.spnAnzahlLag) - Me.GroupBox1.Location = New System.Drawing.Point(12, 12) - Me.GroupBox1.Name = "GroupBox1" - Me.GroupBox1.Size = New System.Drawing.Size(286, 78) - Me.GroupBox1.TabIndex = 15 - Me.GroupBox1.TabStop = False - Me.GroupBox1.Text = "Offsets (lag)" - ' - 'Autocorrelation_Dialog - ' - Me.AcceptButton = Me.OK_Button - Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.CancelButton = Me.Cancel_Button - Me.ClientSize = New System.Drawing.Size(310, 212) - Me.Controls.Add(Me.GroupBox1) - Me.Controls.Add(Me.Label4) - Me.Controls.Add(Me.TableLayoutPanel1) - Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog - Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) - Me.MaximizeBox = False - Me.MinimizeBox = False - Me.Name = "Autocorrelation_Dialog" - Me.ShowInTaskbar = False - Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent - Me.Text = "Autocorrelation" - Me.TableLayoutPanel1.ResumeLayout(False) - CType(Me.spnAnzahlLag, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.spnGroesseLag, System.ComponentModel.ISupportInitialize).EndInit() - Me.GroupBox1.ResumeLayout(False) - Me.GroupBox1.PerformLayout() - Me.ResumeLayout(False) - - End Sub - Friend WithEvents TableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel - Friend WithEvents OK_Button As System.Windows.Forms.Button - Friend WithEvents Cancel_Button As System.Windows.Forms.Button - Friend WithEvents spnAnzahlLag As System.Windows.Forms.NumericUpDown - Friend WithEvents spnGroesseLag As System.Windows.Forms.NumericUpDown - Friend WithEvents Label2 As System.Windows.Forms.Label - Friend WithEvents Label1 As System.Windows.Forms.Label - Friend WithEvents Label4 As System.Windows.Forms.Label - Friend WithEvents Label5 As Label - Friend WithEvents Label7 As Label - Friend WithEvents GroupBox1 As GroupBox -End Class diff --git a/source/Analysis/Autocorrelation_Dialog.resx b/source/Analysis/Autocorrelation_Dialog.resx deleted file mode 100644 index 192f6f4e..00000000 --- a/source/Analysis/Autocorrelation_Dialog.resx +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 - - - - - AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAABMLAAATCwAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAALRpK/+zaCv/smgq/7FoKv+wZir/r2Yq/69mKf+uZSn/rmUo/61kKP+tZCj/rGQo/6tj - KP+rYyj/AAAAAAAAAAC2ai3/KWgyTydoMUY5UCdFJ2gxCQAAAABIKBMdAAAAAAAAAABCJRIdAAAAACdv - MhosWihoKHM1DAAAAAAAAAAAt2st/yx0ORkrdTiZLXU34it1OO0sdjhoAAAAAAAAAAAAAAAAAAAAACt/ - OAgsgjjeK4Q2kwAAAAAAAAAAAAAAALltLv8oFZxAAAAAAAAAAAAyiEGWMolB8TGKQKIxjEAMAAAAAAAA - AAAxj0CIL5I+7wAAAAAAAAAAAAAAAAAAAAC7bi//BAD5VAQA+xcAAAAAAAAAADmZSko5mUjoN5pI4Dib - Rq02nUW+NZ9E9DOgQl8AAAAAEQ39GgAAAAAAAAAAvW8w/wUB/08GAv/cAAAAAAAAAAAAAAAA3FAAd0Ci - Spc8pEvMOqRJzTejRlcAAAAAAAAAABsX+7AAAAAAAAAAAL5xMP9QMHsvEQ39/hIO/IbgWACE4FcA/+BX - Av3gVwP+31YGVwAAAAAAAAAAAAAAAAAAAAAkIfn6AAAAAAAAAADAcjL/AAAAABoW+6UcGfn7uk499+Bh - CpLhYg0D32IQuN5hEfjdYhV+AAAAAAAAAAAtKvnALiv38AAAAAAAAAAAwnMy/wAAAAAAAAAAOSrr/kUx - 4fkAAAAAAAAAAAAAAADgbyCo3nIk+95zJ581MvclNjP2/4hbppcAAAAAAAAAAMNzM/+ARyId4XYbiq9g - Z/o4MvX3OTb2lQAAAAAAAAAAAAAAAOB/M43fgTf934I5+9+GPPnfiD7+AAAAAAAAAADEdDT/4oAmA+B/ - LPnggTC2QT71h0NA9P5GQ/M8AAAAAAAAAABJRvMiS0jx8VBK7vbgk0uAAAAAAAAAAAAAAAAAxXU0/+CH - ODPeiT/93oxBCQAAAABQTfHDUk/y+lJP8spTUfDdU1Hw+1NR8OJTUfAiAAAAAAAAAAAAAAAAAAAAAMZ2 - NP/GfT9m3ZJPpwAAAAAAAAAAAAAAAFpY74paWO/gWVfv01lX714AAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AADGdjT/3ZdbVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAA//8AAIABAAC//wAAo/MAALjnAAC+DwAArx0AAKB9AAChOQAAs4kAAKHBAACh4wAArA8AAK4/ - //+//////////w== - - - \ No newline at end of file diff --git a/source/Analysis/Autocorrelation_Dialog.vb b/source/Analysis/Autocorrelation_Dialog.vb deleted file mode 100644 index c319b484..00000000 --- a/source/Analysis/Autocorrelation_Dialog.vb +++ /dev/null @@ -1,66 +0,0 @@ -'BlueM.Wave -'Copyright (C) BlueM Dev Group -' -' -'This program is free software: you can redistribute it and/or modify -'it under the terms of the GNU Lesser 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 Lesser General Public License for more details. -' -'You should have received a copy of the GNU Lesser General Public License -'along with this program. If not, see . -' -Friend Class Autocorrelation_Dialog - - Private timeseries As TimeSeries - - Public ReadOnly Property lagSize As Integer - Get - 'Größe der Lags auslesen - Return Me.spnGroesseLag.Value - End Get - End Property - - Public ReadOnly Property lagCount As Integer - Get - 'Anzahl der Lags auslesen - Return Me.spnAnzahlLag.Value() - End Get - End Property - - Public Sub New(ts As TimeSeries) - - ' This call is required by the designer. - InitializeComponent() - - ' Add any initialization after the InitializeComponent() call. - Me.timeseries = ts - - End Sub - - Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click - - 'Check max possible lag - Dim maxlag As Integer = Me.timeseries.Length / lagSize - 1 - If lagSize * lagCount > Me.timeseries.Length Then - MsgBox( - $"The selected time series is too short or the largest lag is too long! " & - $"Please select at most {maxlag} offsets with the currently set number of time steps!", MsgBoxStyle.Exclamation) - Return - End If - - Me.DialogResult = System.Windows.Forms.DialogResult.OK - Me.Close() - End Sub - - Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click - Me.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.Close() - End Sub - -End Class diff --git a/source/Analysis/Calculator.vb b/source/Analysis/Calculator.vb index ba3a6f40..03d9e88b 100644 --- a/source/Analysis/Calculator.vb +++ b/source/Analysis/Calculator.vb @@ -27,9 +27,11 @@ Friend Class Calculator ''' ''' Returns a text description of the analysis function ''' - Public Overloads Shared Function Description() As String - Return "Performs mathematical operations on time series and returns a new time series as the result." - End Function + Public Overrides ReadOnly Property Description() As String + Get + Return "Performs mathematical operations on time series and returns a new time series as the result." + End Get + End Property ''' ''' Flag indicating whether the analysis function has a result test @@ -91,10 +93,21 @@ Friend Class Calculator ''' ''' Constructor ''' - ''' list of TimeSeries - Public Sub New(ByRef seriesList As List(Of TimeSeries)) + Public Sub New() + MyBase.New() + 'define input parameters + MyBase.parameters.Add("timeseries", + New AnalysisParameter("Input time series", AnalysisParameter.ParameterTypeEnum.Timeseries, AnalysisParameter.ParameterAmountEnum.Multiple) + ) + End Sub - Call MyBase.New(seriesList) + ''' + ''' Analyse durchführen + ''' + Public Overrides Sub ProcessAnalysis() + + 'get input parameters + Dim seriesList As List(Of TimeSeries) = MyBase.parameters("timeseries").Value If seriesList.Count > 26 Then ' only 26 variable names are available @@ -106,18 +119,11 @@ Friend Class Calculator Dim varNames As New List(Of String) From {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"} Dim i As Integer = 0 - For Each ts As TimeSeries In Me.InputTimeSeries + For Each ts As TimeSeries In seriesList tsVariables.Add(New CalculatorVariable(varNames(i), ts)) i += 1 Next - End Sub - - ''' - ''' Analyse durchführen - ''' - Public Overrides Sub ProcessAnalysis() - 'show the ChangeTimeStepDialog Dim dlg As New CalculatorDialog(Me.tsVariables) If dlg.ShowDialog() = Windows.Forms.DialogResult.OK Then @@ -137,7 +143,7 @@ Friend Class Calculator 'collect unique timestamps Dim timestamps As New HashSet(Of DateTime) - For Each ts As TimeSeries In Me.InputTimeSeries + For Each ts As TimeSeries In seriesList timestamps.UnionWith(ts.Dates) Next diff --git a/source/Analysis/ChangeTimestep.vb b/source/Analysis/ChangeTimestep.vb index 3344c853..91d8e12d 100644 --- a/source/Analysis/ChangeTimestep.vb +++ b/source/Analysis/ChangeTimestep.vb @@ -27,9 +27,11 @@ Friend Class ChangeTimestep ''' ''' Returns a text description of the analysis function ''' - Public Overloads Shared Function Description() As String - Return "Make a time series equidistant with a user-specified timestep" - End Function + Public Overrides ReadOnly Property Description As String + Get + Return "Make a time series equidistant with a user-specified timestep" + End Get + End Property ''' ''' Flag indicating whether the analysis function has a result test diff --git a/source/Analysis/Comparison.vb b/source/Analysis/Comparison.vb index 2bb8b9be..e53242b8 100644 --- a/source/Analysis/Comparison.vb +++ b/source/Analysis/Comparison.vb @@ -25,9 +25,11 @@ Friend Class Comparison Private ts_x, ts_y As TimeSeries - Public Overloads Shared Function Description() As String - Return "Plots the coincident values of two time series against each other, least-squares fits a line to the resulting points and calculates the linear correlation coefficient." - End Function + Public Overrides ReadOnly Property Description As String + Get + Return "Plots the coincident values of two time series against each other, least-squares fits a line to the resulting points and calculates the linear correlation coefficient." + End Get + End Property ''' ''' Flag, der anzeigt, ob die Analysefunktion einen Ergebnistext erzeugt diff --git a/source/Analysis/Cumulative.vb b/source/Analysis/Cumulative.vb index dd7690be..6eb954f3 100644 --- a/source/Analysis/Cumulative.vb +++ b/source/Analysis/Cumulative.vb @@ -23,9 +23,11 @@ Friend Class Cumulative #Region "Properties" - Public Overloads Shared Function Description() As String - Return "For each selected time series, calculates a new time series that consists of the cumulative values of the original series. NaN values are ignored." - End Function + Public Overrides ReadOnly Property Description As String + Get + Return "For each selected time series, calculates a new time series that consists of the cumulative values of the original series. NaN values are ignored." + End Get + End Property ''' ''' Flag indicating whether the analysis function has a result test diff --git a/source/Analysis/DoubleSumCurve.vb b/source/Analysis/DoubleSumCurve.vb index a3556ac9..802af2c0 100644 --- a/source/Analysis/DoubleSumCurve.vb +++ b/source/Analysis/DoubleSumCurve.vb @@ -25,9 +25,11 @@ Friend Class DoubleSumCurve Private ts_1, ts_2 As TimeSeries Private summe1(), summe2() As Double - Public Overloads Shared Function Description() As String - Return "Plots the cumulative coincident values of two time series against each other and adds a 45° line to the resulting plot." - End Function + Public Overrides ReadOnly Property Description As String + Get + Return "Plots the cumulative coincident values of two time series against each other and adds a 45° line to the resulting plot." + End Get + End Property ''' ''' Flag, der anzeigt, ob die Analysefunktion einen Ergebnistext erzeugt diff --git a/source/Analysis/GoodnessOfFit.vb b/source/Analysis/GoodnessOfFit.vb index 3e151171..c9b63ccb 100644 --- a/source/Analysis/GoodnessOfFit.vb +++ b/source/Analysis/GoodnessOfFit.vb @@ -31,9 +31,11 @@ Friend Class GoodnessOfFit ''' Private GoFResults As Dictionary(Of String, Dictionary(Of String, GoF)) - Public Overloads Shared Function Description() As String - Return "Calculates multiple goodness of fit criteria between two or more time series. Only coincident data points where both values are not NaN are considered." - End Function + Public Overrides ReadOnly Property Description As String + Get + Return "Calculates multiple goodness of fit criteria between two or more time series. Only coincident data points where both values are not NaN are considered." + End Get + End Property Private Structure GoF Public startDate As DateTime diff --git a/source/Analysis/Histogram.vb b/source/Analysis/Histogram.vb index d4b8d2ac..79944423 100644 --- a/source/Analysis/Histogram.vb +++ b/source/Analysis/Histogram.vb @@ -37,10 +37,12 @@ Friend Class Histogram Private results As histogramResults() - Public Overloads Shared Function Description() As String - Return "Divides the entire range of values into a series of user-defined intervals (bins) and calculates the percentage of values falling into each interval." & + Public Overrides ReadOnly Property Description As String + Get + Return "Divides the entire range of values into a series of user-defined intervals (bins) and calculates the percentage of values falling into each interval." & "Also estimates a corresponding density function." - End Function + End Get + End Property ''' ''' Flag, der anzeigt, ob die Analysefunktion einen Ergebnistext erzeugt diff --git a/source/Analysis/LinearRegression.vb b/source/Analysis/LinearRegression.vb index 497400e5..75d13409 100644 --- a/source/Analysis/LinearRegression.vb +++ b/source/Analysis/LinearRegression.vb @@ -30,9 +30,11 @@ Friend Class LinearRegression Private r As Double 'correlation coefficient Private filled_nodes As SortedDictionary(Of DateTime, Double) 'filled nodes - Public Overloads Shared Function Description() As String - Return "Fills gaps (NaN values and missing timestamps) in one time series by applying a linear regression relationship with a second time series." - End Function + Public Overrides ReadOnly Property Description As String + Get + Return "Fills gaps (NaN values and missing timestamps) in one time series by applying a linear regression relationship with a second time series." + End Get + End Property ''' ''' Flag, der anzeigt, ob die Analysefunktion einen Ergebnistext erzeugt diff --git a/source/Analysis/MonthlyStatistics.vb b/source/Analysis/MonthlyStatistics.vb index f1878717..9294d88f 100644 --- a/source/Analysis/MonthlyStatistics.vb +++ b/source/Analysis/MonthlyStatistics.vb @@ -63,10 +63,12 @@ Friend Class MonthlyStatistics #Region "Properties" - Public Overloads Shared Function Description() As String - Return "Calculates the following statistical values for each month of the year: average, median, minimum, maximum, standard deviation " & + Public Overrides ReadOnly Property Description As String + Get + Return "Calculates the following statistical values for each month of the year: average, median, minimum, maximum, standard deviation " & "and displays them in a chart." - End Function + End Get + End Property ''' ''' Flag indicating whether the analysis function has a result text diff --git a/source/Analysis/TestAnalysis.vb b/source/Analysis/TestAnalysis.vb index e8fb7486..b014d451 100644 --- a/source/Analysis/TestAnalysis.vb +++ b/source/Analysis/TestAnalysis.vb @@ -32,9 +32,11 @@ Friend Class TestAnalysis ''' ''' Returns the description of the analysis function ''' - Public Overloads Shared Function Description() As String - Return "Write description!" - End Function + Public Overrides ReadOnly Property Description As String + Get + Return "Write description!" + End Get + End Property ''' ''' Flag indicating whether the analysis function produces a result text diff --git a/source/Analysis/TimestepAnalysis.vb b/source/Analysis/TimestepAnalysis.vb index 2ecb6594..85947506 100644 --- a/source/Analysis/TimestepAnalysis.vb +++ b/source/Analysis/TimestepAnalysis.vb @@ -40,9 +40,11 @@ Friend Class TimeStepAnalysis #Region "Properties" - Public Overloads Shared Function Description() As String - Return "Calculates the the timestep between nodes and returns a new timeseries of timestep sizes in the user-specified unit." - End Function + Public Overrides ReadOnly Property Description As String + Get + Return "Calculates the the timestep between nodes and returns a new timeseries of timestep sizes in the user-specified unit." + End Get + End Property ''' ''' Flag indicating whether the analysis function has a result test diff --git a/source/Controllers/WaveController.vb b/source/Controllers/WaveController.vb index 5e333b29..a11f1e31 100644 --- a/source/Controllers/WaveController.vb +++ b/source/Controllers/WaveController.vb @@ -818,8 +818,7 @@ Friend Class WaveController Call Log.AddLogEntry(Log.levels.info, $"Starting analysis {oAnalysisDialog.selectedAnalysisFunction} ...") 'Analyse instanzieren - Dim oAnalysis As Analysis - oAnalysis = AnalysisFactory.CreateAnalysis(oAnalysisDialog.selectedAnalysisFunction, oAnalysisDialog.selectedTimeseries) + Dim oAnalysis As Analysis = oAnalysisDialog.analysis 'Add handlers for progress events AddHandler oAnalysis.AnalysisStarted, AddressOf ProgressReset diff --git a/source/Dialogs/WizardPages.vb b/source/Dialogs/WizardPages.vb new file mode 100644 index 00000000..8d1ebf18 --- /dev/null +++ b/source/Dialogs/WizardPages.vb @@ -0,0 +1,43 @@ +'BlueM.Wave +'Copyright (C) BlueM Dev Group +' +' +'This program is free software: you can redistribute it and/or modify +'it under the terms of the GNU Lesser 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 Lesser General Public License for more details. +' +'You should have received a copy of the GNU Lesser General Public License +'along with this program. If not, see . +' +Imports System +Imports System.Windows.Forms +''' +''' TabControl with hidden tabs +''' Source: https://stackoverflow.com/questions/2340566/creating-wizards-for-windows-forms-in-c-sharp +''' +Friend Class WizardPages + Inherits TabControl + + Protected Overrides Sub WndProc(ByRef m As Message) + 'Hide tabs by trapping the TCM_ADJUSTRECT message + If (m.Msg = Convert.ToInt32("0x1328", 16) And Not DesignMode) Then + m.Result = CType(1, IntPtr) + Else + MyBase.WndProc(m) + End If + End Sub + + Protected Overrides Sub OnKeyDown(ke As KeyEventArgs) + 'Block Ctrl+Tab And Ctrl+Shift+Tab hotkeys + If (ke.Control And ke.KeyCode = Keys.Tab) Then + Return + End If + MyBase.OnKeyDown(ke) + End Sub +End Class \ No newline at end of file diff --git a/source/Wave.vbproj b/source/Wave.vbproj index e7dc3ff6..535faed6 100644 --- a/source/Wave.vbproj +++ b/source/Wave.vbproj @@ -121,6 +121,7 @@ Form + AnalysisResultTable.vb @@ -129,78 +130,8 @@ - - Autocorrelation_Dialog.vb - - - Form - - - - CumulativeDialog.vb - - - Form - - - ChangeTimestepDialog.vb - - - Form - - - - Comparison_Dialog.vb - - - Form - - - - - - AnnualStatistics_Dialog.vb - - - Form - - - GoodnessOfFit_Dialog.vb - - - Form - - - - HistogramDialog.vb - - - Form - - - - LinearRegression_Dialog.vb - - - Form - - - - MonthlyStatisticsDialog.vb - - - Form - - - - - TimestepAnalysisDialog.vb - - - Form - @@ -284,6 +215,9 @@ Form + + Component + @@ -368,36 +302,6 @@ AnalysisResultTable.vb - - Autocorrelation_Dialog.vb - - - CumulativeDialog.vb - - - ChangeTimestepDialog.vb - - - Comparison_Dialog.vb - - - AnnualStatistics_Dialog.vb - - - GoodnessOfFit_Dialog.vb - - - HistogramDialog.vb - - - LinearRegression_Dialog.vb - - - MonthlyStatisticsDialog.vb - - - TimestepAnalysisDialog.vb - AboutBox.vb