Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r3fb9abfa805e982990945675c30d93658fd6e912 -r7b59ab6aaa9f81445151848d8b3aa651062ee6b7 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 3fb9abfa805e982990945675c30d93658fd6e912) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7b59ab6aaa9f81445151848d8b3aa651062ee6b7) @@ -677,11 +677,12 @@ } /// - /// Looks up a localized string similar to Er zijn geen profielschematisaties beschikbaar om berekeningen voor te genereren.. + /// Looks up a localized string similar to Er zijn geen profielschematisaties of stochastische ondergrondmodellen beschikbaar om berekeningen voor te genereren.. /// - public static string PipingCalculationGroup_Generate_PipingCalculations_NoSurfaceLines_ToolTip { + public static string PipingCalculationGroup_Generate_PipingCalculations_NoSurfaceLinesOrSoilModels_ToolTip { get { - return ResourceManager.GetString("PipingCalculationGroup_Generate_PipingCalculations_NoSurfaceLines_ToolTip", resourceCulture); + return ResourceManager.GetString("PipingCalculationGroup_Generate_PipingCalculations_NoSurfaceLinesOrSoilModels_Too" + + "lTip", resourceCulture); } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx =================================================================== diff -u -r3fb9abfa805e982990945675c30d93658fd6e912 -r7b59ab6aaa9f81445151848d8b3aa651062ee6b7 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision 3fb9abfa805e982990945675c30d93658fd6e912) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Properties/Resources.resx (.../Resources.resx) (revision 7b59ab6aaa9f81445151848d8b3aa651062ee6b7) @@ -736,7 +736,7 @@ Toetslaag 3 - - Er zijn geen profielschematisaties beschikbaar om berekeningen voor te genereren. + + Er zijn geen profielschematisaties of stochastische ondergrondmodellen beschikbaar om berekeningen voor te genereren. \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.Designer.cs =================================================================== diff -u -r375428303ce2602d07cef6b01b4aaf9eaf1f4722 -r7b59ab6aaa9f81445151848d8b3aa651062ee6b7 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.Designer.cs (.../PipingCalculationsView.Designer.cs) (revision 375428303ce2602d07cef6b01b4aaf9eaf1f4722) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.Designer.cs (.../PipingCalculationsView.Designer.cs) (revision 7b59ab6aaa9f81445151848d8b3aa651062ee6b7) @@ -15,6 +15,7 @@ /// private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PipingCalculationsView)); this.tableLayoutPanelUserControl = new System.Windows.Forms.TableLayoutPanel(); this.splitContainer = new System.Windows.Forms.SplitContainer(); this.tableLayoutPanelListBox = new System.Windows.Forms.TableLayoutPanel(); @@ -24,7 +25,7 @@ this.labelCalculations = new System.Windows.Forms.Label(); this.dataGridView = new System.Windows.Forms.DataGridView(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.buttonCreateCalculations = new System.Windows.Forms.Button(); + this.buttonGenerateScenarios = new System.Windows.Forms.Button(); this.buttonNavigateToSelectedCalculation = new System.Windows.Forms.Button(); this.tableLayoutPanelUserControl.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); @@ -39,98 +40,54 @@ // // tableLayoutPanelUserControl // - this.tableLayoutPanelUserControl.ColumnCount = 1; - this.tableLayoutPanelUserControl.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + resources.ApplyResources(this.tableLayoutPanelUserControl, "tableLayoutPanelUserControl"); this.tableLayoutPanelUserControl.Controls.Add(this.splitContainer, 0, 0); this.tableLayoutPanelUserControl.Controls.Add(this.tableLayoutPanel1, 0, 1); - this.tableLayoutPanelUserControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanelUserControl.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanelUserControl.MinimumSize = new System.Drawing.Size(500, 300); this.tableLayoutPanelUserControl.Name = "tableLayoutPanelUserControl"; - this.tableLayoutPanelUserControl.RowCount = 2; - this.tableLayoutPanelUserControl.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanelUserControl.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F)); - this.tableLayoutPanelUserControl.Size = new System.Drawing.Size(762, 560); - this.tableLayoutPanelUserControl.TabIndex = 0; // // splitContainer // - this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer.Location = new System.Drawing.Point(3, 3); + resources.ApplyResources(this.splitContainer, "splitContainer"); this.splitContainer.Name = "splitContainer"; // // splitContainer.Panel1 // this.splitContainer.Panel1.Controls.Add(this.tableLayoutPanelListBox); - this.splitContainer.Panel1MinSize = 200; // // splitContainer.Panel2 // this.splitContainer.Panel2.Controls.Add(this.tableLayoutPanelDataGrid); - this.splitContainer.Panel2MinSize = 300; - this.splitContainer.Size = new System.Drawing.Size(756, 522); - this.splitContainer.SplitterDistance = 209; - this.splitContainer.TabIndex = 0; this.splitContainer.TabStop = false; // // tableLayoutPanelListBox // - this.tableLayoutPanelListBox.ColumnCount = 1; - this.tableLayoutPanelListBox.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + resources.ApplyResources(this.tableLayoutPanelListBox, "tableLayoutPanelListBox"); this.tableLayoutPanelListBox.Controls.Add(this.listBox, 0, 1); this.tableLayoutPanelListBox.Controls.Add(this.labelFailureMechanismSections, 0, 0); - this.tableLayoutPanelListBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanelListBox.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanelListBox.Name = "tableLayoutPanelListBox"; - this.tableLayoutPanelListBox.RowCount = 2; - this.tableLayoutPanelListBox.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanelListBox.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanelListBox.Size = new System.Drawing.Size(209, 522); - this.tableLayoutPanelListBox.TabIndex = 0; // // listBox // - this.listBox.Dock = System.Windows.Forms.DockStyle.Fill; + resources.ApplyResources(this.listBox, "listBox"); this.listBox.FormattingEnabled = true; - this.listBox.IntegralHeight = false; - this.listBox.Location = new System.Drawing.Point(3, 20); - this.listBox.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.listBox.Name = "listBox"; - this.listBox.Size = new System.Drawing.Size(203, 502); - this.listBox.TabIndex = 1; // // labelFailureMechanismSections // - this.labelFailureMechanismSections.AutoSize = true; - this.labelFailureMechanismSections.Location = new System.Drawing.Point(3, 0); + resources.ApplyResources(this.labelFailureMechanismSections, "labelFailureMechanismSections"); this.labelFailureMechanismSections.Name = "labelFailureMechanismSections"; - this.labelFailureMechanismSections.Size = new System.Drawing.Size(44, 13); - this.labelFailureMechanismSections.TabIndex = 0; - this.labelFailureMechanismSections.Text = "Vakken"; // // tableLayoutPanelDataGrid // - this.tableLayoutPanelDataGrid.ColumnCount = 1; - this.tableLayoutPanelDataGrid.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + resources.ApplyResources(this.tableLayoutPanelDataGrid, "tableLayoutPanelDataGrid"); this.tableLayoutPanelDataGrid.Controls.Add(this.labelCalculations, 0, 0); this.tableLayoutPanelDataGrid.Controls.Add(this.dataGridView, 0, 1); - this.tableLayoutPanelDataGrid.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanelDataGrid.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanelDataGrid.Name = "tableLayoutPanelDataGrid"; - this.tableLayoutPanelDataGrid.RowCount = 2; - this.tableLayoutPanelDataGrid.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanelDataGrid.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanelDataGrid.Size = new System.Drawing.Size(543, 522); - this.tableLayoutPanelDataGrid.TabIndex = 1; // // labelCalculations // - this.labelCalculations.AutoSize = true; - this.labelCalculations.Location = new System.Drawing.Point(3, 0); + resources.ApplyResources(this.labelCalculations, "labelCalculations"); this.labelCalculations.Name = "labelCalculations"; - this.labelCalculations.Size = new System.Drawing.Size(182, 13); - this.labelCalculations.TabIndex = 0; - this.labelCalculations.Text = "Berekeningen voor geselecteerd vak"; // // dataGridView // @@ -140,61 +97,37 @@ this.dataGridView.AllowUserToResizeRows = false; this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader; this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView.Dock = System.Windows.Forms.DockStyle.Fill; + resources.ApplyResources(this.dataGridView, "dataGridView"); this.dataGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; - this.dataGridView.Location = new System.Drawing.Point(3, 20); - this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.dataGridView.Name = "dataGridView"; this.dataGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; - this.dataGridView.Size = new System.Drawing.Size(537, 502); - this.dataGridView.TabIndex = 1; // // tableLayoutPanel1 // - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.Controls.Add(this.buttonCreateCalculations, 0, 0); + resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1"); + this.tableLayoutPanel1.Controls.Add(this.buttonGenerateScenarios, 0, 0); this.tableLayoutPanel1.Controls.Add(this.buttonNavigateToSelectedCalculation, 1, 0); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 531); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 1; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(756, 26); - this.tableLayoutPanel1.TabIndex = 1; // - // buttonCreateCalculations + // buttonGenerateScenarios // - this.buttonCreateCalculations.Dock = System.Windows.Forms.DockStyle.Left; - this.buttonCreateCalculations.Enabled = false; - this.buttonCreateCalculations.Location = new System.Drawing.Point(3, 3); - this.buttonCreateCalculations.Name = "buttonCreateCalculations"; - this.buttonCreateCalculations.Size = new System.Drawing.Size(137, 20); - this.buttonCreateCalculations.TabIndex = 0; - this.buttonCreateCalculations.Text = "Berekeningen aanmaken"; - this.buttonCreateCalculations.UseVisualStyleBackColor = true; + resources.ApplyResources(this.buttonGenerateScenarios, "buttonGenerateScenarios"); + this.buttonGenerateScenarios.Name = "buttonGenerateScenarios"; + this.buttonGenerateScenarios.UseVisualStyleBackColor = true; + this.buttonGenerateScenarios.Click += new System.EventHandler(this.OnGenerateScenariosButtonClick); // // buttonNavigateToSelectedCalculation // - this.buttonNavigateToSelectedCalculation.Dock = System.Windows.Forms.DockStyle.Right; - this.buttonNavigateToSelectedCalculation.Enabled = false; - this.buttonNavigateToSelectedCalculation.Location = new System.Drawing.Point(572, 3); + resources.ApplyResources(this.buttonNavigateToSelectedCalculation, "buttonNavigateToSelectedCalculation"); this.buttonNavigateToSelectedCalculation.Name = "buttonNavigateToSelectedCalculation"; - this.buttonNavigateToSelectedCalculation.Size = new System.Drawing.Size(181, 20); - this.buttonNavigateToSelectedCalculation.TabIndex = 1; - this.buttonNavigateToSelectedCalculation.Text = "Ga naar geselecteerde berekening"; this.buttonNavigateToSelectedCalculation.UseVisualStyleBackColor = true; // // PipingCalculationsView // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.AutoScroll = true; - this.AutoScrollMinSize = new System.Drawing.Size(600, 400); this.Controls.Add(this.tableLayoutPanelUserControl); this.Name = "PipingCalculationsView"; - this.Size = new System.Drawing.Size(762, 560); this.tableLayoutPanelUserControl.ResumeLayout(false); this.splitContainer.Panel1.ResumeLayout(false); this.splitContainer.Panel2.ResumeLayout(false); @@ -221,7 +154,7 @@ private System.Windows.Forms.Label labelCalculations; private System.Windows.Forms.DataGridView dataGridView; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.Button buttonCreateCalculations; + private System.Windows.Forms.Button buttonGenerateScenarios; private System.Windows.Forms.Button buttonNavigateToSelectedCalculation; } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs =================================================================== diff -u -r43fb77c51a8d1c0af128a2da0c3d51bbea6e25bb -r7b59ab6aaa9f81445151848d8b3aa651062ee6b7 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision 43fb77c51a8d1c0af128a2da0c3d51bbea6e25bb) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.cs (.../PipingCalculationsView.cs) (revision 7b59ab6aaa9f81445151848d8b3aa651062ee6b7) @@ -65,8 +65,8 @@ InitializeDataGridView(); InitializeListBox(); - pipingSoilProfilesObserver = new Observer(UpdateSoilProfileColumn); - pipingFailureMechanismObserver = new Observer(UpdateDikeSectionsListBox); + pipingSoilProfilesObserver = new Observer(OnSoilProfilesUpdate); + pipingFailureMechanismObserver = new Observer(OnPipingFailureMechanismUpdate); assessmentSectionObserver = new Observer(UpdateHydraulicBoundaryLocationsColumn); pipingInputObserver = new RecursiveObserver(UpdateDataGridViewDataSource, pcg => pcg.Children.Concat(pcg.Children.OfType().Select(pc => pc.InputParameters))); pipingCalculationObserver = new RecursiveObserver(RefreshDataGridView, pcg => pcg.Children); @@ -91,6 +91,7 @@ UpdateSoilProfileColumn(); UpdateDikeSectionsListBox(); + UpdateGenerateScenariosButtonState(); } } @@ -248,6 +249,12 @@ } } + private void OnSoilProfilesUpdate() + { + UpdateGenerateScenariosButtonState(); + UpdateSoilProfileColumn(); + } + private void UpdateSoilProfileColumn() { using (new SuspendDataGridViewColumnResizes(soilProfileColumn)) @@ -259,6 +266,11 @@ } } + private void UpdateGenerateScenariosButtonState() + { + buttonGenerateScenarios.Enabled = pipingFailureMechanism != null && pipingFailureMechanism.SurfaceLines.Any() && pipingFailureMechanism.StochasticSoilModels.Any(); + } + private void RefreshDataGridView() { dataGridView.Refresh(); @@ -349,6 +361,12 @@ objectCollection.AddRange(comboBoxItems); } + private void OnPipingFailureMechanismUpdate() + { + UpdateGenerateScenariosButtonState(); + UpdateDikeSectionsListBox(); + } + private void UpdateDikeSectionsListBox() { listBox.Items.Clear(); @@ -565,6 +583,18 @@ UpdateDataGridViewDataSource(); } + private void OnGenerateScenariosButtonClick(object sender, EventArgs e) + { + var dialog = new PipingSurfaceLineSelectionDialog(Parent, pipingFailureMechanism.SurfaceLines); + dialog.ShowDialog(); + foreach(var item in PipingCalculationConfigurationHelper.GenerateCalculationsStructure(dialog.SelectedSurfaceLines, pipingFailureMechanism.StochasticSoilModels)) + { + pipingCalculationGroup.Children.Add(item); + } + pipingCalculationGroup.NotifyObservers(); + } + # endregion + } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.resx =================================================================== diff -u -r89d85bbdb63102cec36c46902e2a5c18e249412a -r7b59ab6aaa9f81445151848d8b3aa651062ee6b7 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.resx (.../PipingCalculationsView.resx) (revision 89d85bbdb63102cec36c46902e2a5c18e249412a) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingCalculationsView.resx (.../PipingCalculationsView.resx) (revision 7b59ab6aaa9f81445151848d8b3aa651062ee6b7) @@ -117,4 +117,391 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 1 + + + + Fill + + + + 3, 3 + + + 1 + + + Fill + + + False + + + 3, 20 + + + 3, 0, 3, 0 + + + 203, 502 + + + 1 + + + listBox + + + System.Windows.Forms.ListBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanelListBox + + + 0 + + + True + + + 3, 0 + + + 44, 13 + + + 0 + + + Vakken + + + labelFailureMechanismSections + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanelListBox + + + 1 + + + Fill + + + 0, 0 + + + 2 + + + 209, 522 + + + 0 + + + tableLayoutPanelListBox + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + splitContainer.Panel1 + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="listBox" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelFailureMechanismSections" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="Absolute,20,Percent,100" /></TableLayoutSettings> + + + splitContainer.Panel1 + + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + splitContainer + + + 0 + + + 200 + + + 1 + + + True + + + 3, 0 + + + 182, 13 + + + 0 + + + Berekeningen voor geselecteerd vak + + + labelCalculations + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanelDataGrid + + + 0 + + + Fill + + + 3, 20 + + + 3, 0, 3, 0 + + + 537, 502 + + + 1 + + + dataGridView + + + System.Windows.Forms.DataGridView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanelDataGrid + + + 1 + + + Fill + + + 0, 0 + + + 2 + + + 543, 522 + + + 1 + + + tableLayoutPanelDataGrid + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + splitContainer.Panel2 + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="labelCalculations" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="dataGridView" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="Absolute,20,Percent,100" /></TableLayoutSettings> + + + splitContainer.Panel2 + + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + splitContainer + + + 1 + + + 300 + + + 756, 522 + + + 209 + + + 0 + + + splitContainer + + + System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanelUserControl + + + 0 + + + 2 + + + Left + + + False + + + 3, 3 + + + 137, 20 + + + 0 + + + Genereer scenario's... + + + buttonGenerateScenarios + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 0 + + + Right + + + False + + + 572, 3 + + + 181, 20 + + + 1 + + + Ga naar geselecteerde berekening + + + buttonNavigateToSelectedCalculation + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 1 + + + Fill + + + 3, 531 + + + 1 + + + 756, 26 + + + 1 + + + tableLayoutPanel1 + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanelUserControl + + + 1 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="buttonGenerateScenarios" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="buttonNavigateToSelectedCalculation" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="Percent,50,Percent,50" /><Rows Styles="Percent,50" /></TableLayoutSettings> + + + Fill + + + 0, 0 + + + 500, 300 + + + 2 + + + 762, 560 + + + 0 + + + tableLayoutPanelUserControl + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="splitContainer" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="tableLayoutPanel1" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="Percent,100,Absolute,32" /></TableLayoutSettings> + + + True + + + 6, 13 + + + True + + + 600, 400 + + + 762, 560 + + + PipingCalculationsView + + + System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs =================================================================== diff -u -r756f077b356b86d6524dac7234ed6003b51a6d68 -r7b59ab6aaa9f81445151848d8b3aa651062ee6b7 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 756f077b356b86d6524dac7234ed6003b51a6d68) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 7b59ab6aaa9f81445151848d8b3aa651062ee6b7) @@ -739,12 +739,12 @@ private StrictContextMenuItem CreateGeneratePipingCalculationsItem(PipingCalculationGroupContext nodeData) { - var surfaceLineAvailable = nodeData.AvailablePipingSurfaceLines.Any(); + var surfaceLineAvailable = nodeData.AvailablePipingSurfaceLines.Any() && nodeData.AvailableStochasticSoilModels.Any(); var pipingCalculationGroupGeneratePipingCalculationsToolTip = surfaceLineAvailable ? PipingFormsResources.PipingCalculationGroup_Generate_PipingCalculations_ToolTip : - PipingFormsResources.PipingCalculationGroup_Generate_PipingCalculations_NoSurfaceLines_ToolTip; + PipingFormsResources.PipingCalculationGroup_Generate_PipingCalculations_NoSurfaceLinesOrSoilModels_ToolTip; var generateCalculationsItem = new StrictContextMenuItem( PipingFormsResources.PipingCalculationGroup_Generate_PipingCalculations, Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r3fb9abfa805e982990945675c30d93658fd6e912 -r7b59ab6aaa9f81445151848d8b3aa651062ee6b7 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision 3fb9abfa805e982990945675c30d93658fd6e912) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision 7b59ab6aaa9f81445151848d8b3aa651062ee6b7) @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using Core.Common.Base; @@ -530,6 +529,49 @@ var parentData = new PipingFailureMechanismContext(pipingFailureMechanismMock, assessmentSectionMock); var nodeData = new PipingCalculationGroupContext(group, Enumerable.Empty(), + new [] + { + new TestStochasticSoilModel() + }, + pipingFailureMechanismMock, + assessmentSectionMock); + + + var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); + gui.Expect(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder); + + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + ContextMenuStrip menu = info.ContextMenuStrip(nodeData, parentData, treeViewControl); + + // Assert + TestHelper.AssertContextMenuStripContainsItem(menu, 1, + PipingFormsResources.PipingCalculationGroup_Generate_PipingCalculations, + PipingFormsResources.PipingCalculationGroup_Generate_PipingCalculations_NoSurfaceLinesOrSoilModels_ToolTip, + PipingFormsResources.GeneratePipingCalculationsIcon, + false); + } + + [Test] + public void ContextMenuStrip_FailureMechanismAsParentWithoutAvailableSoilModels_GenerateCalculationsDisabled() + { + // Setup + var gui = mocks.StrictMock(); + var treeViewControl = mocks.StrictMock(); + var group = new PipingCalculationGroup(); + + var pipingFailureMechanismMock = mocks.StrictMock(); + var assessmentSectionMock = mocks.StrictMock(); + + var parentData = new PipingFailureMechanismContext(pipingFailureMechanismMock, assessmentSectionMock); + var nodeData = new PipingCalculationGroupContext(group, + new[] + { + new RingtoetsPipingSurfaceLine() + }, Enumerable.Empty(), pipingFailureMechanismMock, assessmentSectionMock); @@ -548,13 +590,13 @@ // Assert TestHelper.AssertContextMenuStripContainsItem(menu, 1, PipingFormsResources.PipingCalculationGroup_Generate_PipingCalculations, - PipingFormsResources.PipingCalculationGroup_Generate_PipingCalculations_NoSurfaceLines_ToolTip, + PipingFormsResources.PipingCalculationGroup_Generate_PipingCalculations_NoSurfaceLinesOrSoilModels_ToolTip, PipingFormsResources.GeneratePipingCalculationsIcon, false); } [Test] - public void ContextMenuStrip_FailureMechanismAsParentWithAvailableSurfaceLines_GenerateCalculationsDisabled() + public void ContextMenuStrip_FailureMechanismAsParentWithAvailableSurfaceLinesAndSoilModels_GenerateCalculationsDisabled() { // Setup var gui = mocks.StrictMock(); @@ -570,7 +612,10 @@ { new RingtoetsPipingSurfaceLine() }, - Enumerable.Empty(), + new[] + { + new TestStochasticSoilModel() + }, pipingFailureMechanismMock, assessmentSectionMock); @@ -934,7 +979,7 @@ } [Test] - public void ContextMenuStrip_ClickOnGenerateCalculationsItemWithSurfaceLines_ShowSurfaceLineSelectionView() + public void ContextMenuStrip_ClickOnGenerateCalculationsItemWithSurfaceLinesAndSoilModels_ShowSurfaceLineSelectionView() { // Setup var gui = mocks.StrictMock(); @@ -962,7 +1007,10 @@ }; var nodeData = new PipingCalculationGroupContext(group, surfaceLines, - Enumerable.Empty(), + new [] + { + new TestStochasticSoilModel() + }, pipingFailureMechanismMock, assessmentSectionMock); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingCalculationsViewTest.cs =================================================================== diff -u -rbf334f50530164badedba45a78f3aab857ae1bf6 -r7b59ab6aaa9f81445151848d8b3aa651062ee6b7 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingCalculationsViewTest.cs (.../PipingCalculationsViewTest.cs) (revision bf334f50530164badedba45a78f3aab857ae1bf6) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingCalculationsViewTest.cs (.../PipingCalculationsViewTest.cs) (revision 7b59ab6aaa9f81445151848d8b3aa651062ee6b7) @@ -34,6 +34,7 @@ using Ringtoets.Common.Data; using Ringtoets.HydraRing.Data; using Ringtoets.Piping.Data; +using Ringtoets.Piping.Data.TestUtil; using Ringtoets.Piping.Forms.PresentationObjects; using Ringtoets.Piping.Forms.Views; using Ringtoets.Piping.Primitives; @@ -386,6 +387,154 @@ Assert.AreEqual(expectedPipingCalculationInputCounter, pipingCalculationInputCounter); } + [Test] + public void PipingFailureMechanism_WithoutSurfaceLines_GenerateScenariosButtonDisabled() + { + // Setup + var pipingCalculationsView = ShowPipingCalculationsView(); + pipingCalculationsView.PipingFailureMechanism = new PipingFailureMechanism + { + StochasticSoilModels = + { + new TestStochasticSoilModel() + } + }; + var button = (Button)new ButtonTester("buttonGenerateScenarios", testForm).TheObject; + + // Call + var state = button.Enabled; + + // Assert + Assert.IsFalse(state); + } + + [Test] + public void PipingFailureMechanism_WithoutSoilModels_GenerateScenariosButtonDisabled() + { + // Setup + var pipingCalculationsView = ShowPipingCalculationsView(); + pipingCalculationsView.PipingFailureMechanism = new PipingFailureMechanism + { + SurfaceLines = + { + new RingtoetsPipingSurfaceLine() + }, + }; + var button = (Button)new ButtonTester("buttonGenerateScenarios", testForm).TheObject; + + // Call + var state = button.Enabled; + + // Assert + Assert.IsFalse(state); + } + + [Test] + public void PipingFailureMechanism_WithSurfaceLinesAndSoilModels_GenerateScenariosButtonEnabled() + { + // Setup + var pipingCalculationsView = ShowPipingCalculationsView(); + pipingCalculationsView.PipingFailureMechanism = new PipingFailureMechanism + { + SurfaceLines = + { + new RingtoetsPipingSurfaceLine() + }, + StochasticSoilModels = + { + new TestStochasticSoilModel() + } + }; + var button = (Button)new ButtonTester("buttonGenerateScenarios", testForm).TheObject; + + // Call + var state = button.Enabled; + + // Assert + Assert.IsTrue(state); + } + + [Test] + public void PipingFailureMechanism_AddSoilModelAndNotify_GenerateScenariosButtonDisabled() + { + // Setup + var pipingCalculationsView = ShowPipingCalculationsView(); + var pipingFailureMechanism = new PipingFailureMechanism(); + pipingCalculationsView.PipingFailureMechanism = pipingFailureMechanism; + + pipingFailureMechanism.StochasticSoilModels.Add(new TestStochasticSoilModel()); + pipingFailureMechanism.NotifyObservers(); + + var button = (Button)new ButtonTester("buttonGenerateScenarios", testForm).TheObject; + + // Call + var state = button.Enabled; + + // Assert + Assert.IsFalse(state); + } + + [Test] + public void PipingFailureMechanism_AddSurfaceLineAndNotify_GenerateScenariosButtonDisabled() + { + // Setup + var pipingCalculationsView = ShowPipingCalculationsView(); + var pipingFailureMechanism = new PipingFailureMechanism(); + pipingCalculationsView.PipingFailureMechanism = pipingFailureMechanism; + + pipingFailureMechanism.SurfaceLines.Add(new RingtoetsPipingSurfaceLine()); + pipingFailureMechanism.NotifyObservers(); + + var button = (Button)new ButtonTester("buttonGenerateScenarios", testForm).TheObject; + + // Call + var state = button.Enabled; + + // Assert + Assert.IsFalse(state); + } + + [Test] + public void PipingFailureMechanism_AddSurfaceLineAndSoilModelAndDoNotNotifyObservers_GenerateScenariosButtonDisabled() + { + // Setup + var pipingCalculationsView = ShowPipingCalculationsView(); + var pipingFailureMechanism = new PipingFailureMechanism(); + pipingCalculationsView.PipingFailureMechanism = pipingFailureMechanism; + + pipingFailureMechanism.SurfaceLines.Add(new RingtoetsPipingSurfaceLine()); + pipingFailureMechanism.StochasticSoilModels.Add(new TestStochasticSoilModel()); + + var button = (Button)new ButtonTester("buttonGenerateScenarios", testForm).TheObject; + + // Call + var state = button.Enabled; + + // Assert + Assert.IsFalse(state); + } + + [Test] + public void PipingFailureMechanism_AddSurfaceLineAndSoilModelAndNotifyObservers_GenerateScenariosButtonEnabled() + { + // Setup + var pipingCalculationsView = ShowPipingCalculationsView(); + var pipingFailureMechanism = new PipingFailureMechanism(); + pipingCalculationsView.PipingFailureMechanism = pipingFailureMechanism; + + pipingFailureMechanism.SurfaceLines.Add(new RingtoetsPipingSurfaceLine()); + pipingFailureMechanism.StochasticSoilModels.Add(new TestStochasticSoilModel()); + pipingCalculationsView.PipingFailureMechanism.NotifyObservers(); + + var button = (Button)new ButtonTester("buttonGenerateScenarios", testForm).TheObject; + + // Call + var state = button.Enabled; + + // Assert + Assert.IsTrue(state); + } + private const int nameColumnIndex = 0; private const int soilProfilesColumnIndex = 1; private const int hydraulicBoundaryLocationsColumnIndex = 2;