Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r106eeb3a0608bd85eb1fcc8fff72256fd9c3ac5f -ra61a8c6b3b7dcf4126ad67dd8ca79ba514839a08 --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 106eeb3a0608bd85eb1fcc8fff72256fd9c3ac5f) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a61a8c6b3b7dcf4126ad67dd8ca79ba514839a08) @@ -1,25 +1,4 @@ -// Copyright (C) Stichting Deltares 2019. All rights reserved. -// -// This file is part of Riskeer. -// -// Riskeer is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// All names, logos, and references to "Deltares" are registered trademarks of -// Stichting Deltares and remain full property of Stichting Deltares at all times. -// All rights reserved. - -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 @@ -40,7 +19,7 @@ // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { @@ -271,6 +250,78 @@ } /// + /// Looks up a localized string similar to Damhoogte [m+NAP]. + /// + public static string GrassCoverErosionInwardsCalculation_Damheight { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsCalculation_Damheight", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Damtype. + /// + public static string GrassCoverErosionInwardsCalculation_Damtype { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsCalculation_Damtype", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dijkhoogte [m+NAP]. + /// + public static string GrassCoverErosionInwardsCalculation_Dikeheight { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsCalculation_Dikeheight", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Verwachtingswaarde kritiek overslagdebiet [m3/m/s]. + /// + public static string GrassCoverErosionInwardsCalculation_Expected_Critical_OvertoppingRate { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsCalculation_Expected_Critical_OvertoppingRate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Naam. + /// + public static string GrassCoverErosionInwardsCalculation_Name_DisplayName { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsCalculation_Name_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Standaardafwijking kritiek overslagdebiet [m3/m/s]. + /// + public static string GrassCoverErosionInwardsCalculation_StandardDeviation_Critical_OvertoppingRate { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsCalculation_StandardDeviation_Critical_OvertoppingRate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Gebruik dam. + /// + public static string GrassCoverErosionInwardsCalculation_Use_Dam { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsCalculation_Use_Dam", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Gebruik voorlandgeometrie. + /// + public static string GrassCoverErosionInwardsCalculation_Use_ForeShoreGeometry { + get { + return ResourceManager.GetString("GrassCoverErosionInwardsCalculation_Use_ForeShoreGeometry", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Selecteer dijkprofielen. /// public static string GrassCoverErosionInwardsDikeProfileSelectionDialog_Select_DikeProfiles { Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Properties/Resources.resx =================================================================== diff -u -rbf1fde9d2147a6eeaecebbb371be2c4856759159 -ra61a8c6b3b7dcf4126ad67dd8ca79ba514839a08 --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision bf1fde9d2147a6eeaecebbb371be2c4856759159) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision a61a8c6b3b7dcf4126ad67dd8ca79ba514839a08) @@ -261,4 +261,28 @@ Illustratiepunten inlezen Spaces are added to make this value unique to prevent jumping from the selected property after editing. + + Naam + + + Gebruik dam + + + Damtype + + + Damhoogte [m+NAP] + + + Gebruik voorlandgeometrie + + + Verwachtingswaarde kritiek overslagdebiet [m3/m/s] + + + Standaardafwijking kritiek overslagdebiet [m3/m/s] + + + Dijkhoogte [m+NAP] + \ No newline at end of file Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Riskeer.GrassCoverErosionInwards.Forms.csproj =================================================================== diff -u -r42ca5fa567ea7172e3ecd027038501909d4dbbe1 -ra61a8c6b3b7dcf4126ad67dd8ca79ba514839a08 --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Riskeer.GrassCoverErosionInwards.Forms.csproj (.../Riskeer.GrassCoverErosionInwards.Forms.csproj) (revision 42ca5fa567ea7172e3ecd027038501909d4dbbe1) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Riskeer.GrassCoverErosionInwards.Forms.csproj (.../Riskeer.GrassCoverErosionInwards.Forms.csproj) (revision a61a8c6b3b7dcf4126ad67dd8ca79ba514839a08) @@ -67,6 +67,9 @@ True Resources.resx + + UserControl + Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationRow.cs =================================================================== diff -u --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationRow.cs (revision 0) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationRow.cs (revision a61a8c6b3b7dcf4126ad67dd8ca79ba514839a08) @@ -0,0 +1,127 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Controls.DataGrid; +using Riskeer.Common.Data.DikeProfiles; +using Riskeer.Common.Data.Hydraulics; +using Riskeer.Common.Forms.ChangeHandlers; +using Riskeer.Common.Forms.PresentationObjects; +using Riskeer.Common.Forms.PropertyClasses; +using Riskeer.Common.IO.DikeProfiles; +using Riskeer.GrassCoverErosionInwards.Data; + +namespace Riskeer.GrassCoverErosionInwards.Forms.Views +{ + /// + /// This class represents a row in the . + /// + internal class GrassCoverErosionInwardsCalculationRow + { + private readonly IObservablePropertyChangeHandler propertyChangeHandler; + + /// + /// Creates a new instance of . + /// + /// The this row contains. + /// The handler responsible for handling effects of a property change. + /// Thrown when any parameter is null. + public GrassCoverErosionInwardsCalculationRow(GrassCoverErosionInwardsCalculationScenario grassCoverErosionInwardsCalculationScenario, + IObservablePropertyChangeHandler handler) + { + if (grassCoverErosionInwardsCalculationScenario == null) + { + throw new ArgumentNullException(nameof(grassCoverErosionInwardsCalculationScenario)); + } + + if (handler == null) + { + throw new ArgumentNullException(nameof(handler)); + } + + GrassCoverErosionInwardsCalculationScenario = grassCoverErosionInwardsCalculationScenario; + propertyChangeHandler = handler; + } + + /// + /// Gets the this row contains. + /// + public GrassCoverErosionInwardsCalculationScenario GrassCoverErosionInwardsCalculationScenario { get; } + + /// + /// Gets or sets the name of the . + /// + public string Name + { + get + { + return GrassCoverErosionInwardsCalculationScenario.Name; + } + set + { + GrassCoverErosionInwardsCalculationScenario.Name = value; + + GrassCoverErosionInwardsCalculationScenario.NotifyObservers(); + } + } + + /// + /// Gets or sets the hydraulic boundary location of the . + /// + public DataGridViewComboBoxItemWrapper SelectableHydraulicBoundaryLocation + { + get + { + if (GrassCoverErosionInwardsCalculationScenario.InputParameters.HydraulicBoundaryLocation == null) + { + return new DataGridViewComboBoxItemWrapper(null); + } + + return new DataGridViewComboBoxItemWrapper( + new SelectableHydraulicBoundaryLocation(GrassCoverErosionInwardsCalculationScenario.InputParameters.HydraulicBoundaryLocation,null)); + } + set + { + HydraulicBoundaryLocation valueToSet = value?.WrappedObject?.HydraulicBoundaryLocation; + if (!ReferenceEquals(GrassCoverErosionInwardsCalculationScenario.InputParameters.HydraulicBoundaryLocation, valueToSet)) + { + PropertyChangeHelper.ChangePropertyAndNotify(() => GrassCoverErosionInwardsCalculationScenario.InputParameters.HydraulicBoundaryLocation = valueToSet, propertyChangeHandler); + } + } + } + + public DataGridViewComboBoxItemWrapper DikeProfile { get; set; } + + public bool UseDam { get; set; } + + public DataGridViewComboBoxItemWrapper DamType { get; set; } + + public double Damheight { get; set; } + + public bool UseForeShoreGeometry { get; set; } + + public double DikeHeight { get; set; } + + public double ExpectedCriticalOvertoppingRate { get; set; } + + public double StandardDeviationCriticalOvertoppingRate { get; set; } + } +} \ No newline at end of file Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.Designer.cs =================================================================== diff -u --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.Designer.cs (revision 0) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.Designer.cs (revision a61a8c6b3b7dcf4126ad67dd8ca79ba514839a08) @@ -0,0 +1,154 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +namespace Riskeer.GrassCoverErosionInwards.Forms.Views +{ + partial class GrassCoverErosionInwardsCalculationsView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GrassCoverErosionInwardsCalculationsView)); + this.tableLayoutPanelUserControl = new System.Windows.Forms.TableLayoutPanel(); + this.splitContainer = new System.Windows.Forms.SplitContainer(); + this.tableLayoutPanelListBox = new System.Windows.Forms.TableLayoutPanel(); + this.listBox = new System.Windows.Forms.ListBox(); + this.labelFailureMechanismSections = new System.Windows.Forms.Label(); + this.tableLayoutPanelDataGrid = new System.Windows.Forms.TableLayoutPanel(); + this.labelCalculations = new System.Windows.Forms.Label(); + this.dataGridViewControl = new Core.Common.Controls.DataGrid.DataGridViewControl(); + this.buttonGenerateScenarios = new System.Windows.Forms.Button(); + this.tableLayoutPanelUserControl.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); + this.splitContainer.Panel1.SuspendLayout(); + this.splitContainer.Panel2.SuspendLayout(); + this.splitContainer.SuspendLayout(); + this.tableLayoutPanelListBox.SuspendLayout(); + this.tableLayoutPanelDataGrid.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanelUserControl + // + resources.ApplyResources(this.tableLayoutPanelUserControl, "tableLayoutPanelUserControl"); + this.tableLayoutPanelUserControl.Controls.Add(this.splitContainer, 0, 0); + this.tableLayoutPanelUserControl.Controls.Add(this.buttonGenerateScenarios, 0, 1); + this.tableLayoutPanelUserControl.Name = "tableLayoutPanelUserControl"; + // + // splitContainer + // + resources.ApplyResources(this.splitContainer, "splitContainer"); + this.splitContainer.Name = "splitContainer"; + // + // splitContainer.Panel1 + // + this.splitContainer.Panel1.Controls.Add(this.tableLayoutPanelListBox); + // + // splitContainer.Panel2 + // + this.splitContainer.Panel2.Controls.Add(this.tableLayoutPanelDataGrid); + this.splitContainer.TabStop = false; + // + // tableLayoutPanelListBox + // + resources.ApplyResources(this.tableLayoutPanelListBox, "tableLayoutPanelListBox"); + this.tableLayoutPanelListBox.Controls.Add(this.listBox, 0, 1); + this.tableLayoutPanelListBox.Controls.Add(this.labelFailureMechanismSections, 0, 0); + this.tableLayoutPanelListBox.Name = "tableLayoutPanelListBox"; + // + // listBox + // + resources.ApplyResources(this.listBox, "listBox"); + this.listBox.FormattingEnabled = true; + this.listBox.Name = "listBox"; + // + // labelFailureMechanismSections + // + resources.ApplyResources(this.labelFailureMechanismSections, "labelFailureMechanismSections"); + this.labelFailureMechanismSections.Name = "labelFailureMechanismSections"; + // + // tableLayoutPanelDataGrid + // + resources.ApplyResources(this.tableLayoutPanelDataGrid, "tableLayoutPanelDataGrid"); + this.tableLayoutPanelDataGrid.Controls.Add(this.labelCalculations, 0, 0); + this.tableLayoutPanelDataGrid.Controls.Add(this.dataGridViewControl, 0, 1); + this.tableLayoutPanelDataGrid.Name = "tableLayoutPanelDataGrid"; + // + // labelCalculations + // + resources.ApplyResources(this.labelCalculations, "labelCalculations"); + this.labelCalculations.Name = "labelCalculations"; + // + // dataGridViewControl + // + resources.ApplyResources(this.dataGridViewControl, "dataGridViewControl"); + this.dataGridViewControl.MultiSelect = true; + this.dataGridViewControl.Name = "dataGridViewControl"; + this.dataGridViewControl.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect; + // + // buttonGenerateScenarios + // + resources.ApplyResources(this.buttonGenerateScenarios, "buttonGenerateScenarios"); + this.buttonGenerateScenarios.Name = "buttonGenerateScenarios"; + this.buttonGenerateScenarios.UseVisualStyleBackColor = true; + // + // GrassCoverErosionInwardsCalculationsView + // + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tableLayoutPanelUserControl); + this.Name = "GrassCoverErosionInwardsCalculationsView"; + this.tableLayoutPanelUserControl.ResumeLayout(false); + this.tableLayoutPanelUserControl.PerformLayout(); + this.splitContainer.Panel1.ResumeLayout(false); + this.splitContainer.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); + this.splitContainer.ResumeLayout(false); + this.tableLayoutPanelListBox.ResumeLayout(false); + this.tableLayoutPanelListBox.PerformLayout(); + this.tableLayoutPanelDataGrid.ResumeLayout(false); + this.tableLayoutPanelDataGrid.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanelUserControl; + private System.Windows.Forms.SplitContainer splitContainer; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanelListBox; + private System.Windows.Forms.ListBox listBox; + private System.Windows.Forms.Label labelFailureMechanismSections; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanelDataGrid; + private System.Windows.Forms.Label labelCalculations; + private Core.Common.Controls.DataGrid.DataGridViewControl dataGridViewControl; + private System.Windows.Forms.Button buttonGenerateScenarios; + } +} Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.cs =================================================================== diff -u --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.cs (revision 0) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.cs (revision a61a8c6b3b7dcf4126ad67dd8ca79ba514839a08) @@ -0,0 +1,195 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Base; +using Core.Common.Base.Geometry; +using Core.Common.Controls.DataGrid; +using Core.Common.Controls.Views; +using Riskeer.Common.Data.AssessmentSection; +using Riskeer.Common.Data.DikeProfiles; +using Riskeer.Common.Data.Hydraulics; +using Riskeer.Common.Forms.Helpers; +using Riskeer.Common.Forms.PresentationObjects; +using Riskeer.Common.IO.DikeProfiles; +using Riskeer.GrassCoverErosionInwards.Data; +using Riskeer.GrassCoverErosionInwards.Forms.Properties; +using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources; + +namespace Riskeer.GrassCoverErosionInwards.Forms.Views +{ + /// + /// This class is a view for configuring grass cover erosion inwards calculations. + /// + public partial class GrassCoverErosionInwardsCalculationsView : UserControl, ISelectionProvider, IView + { + private const int selectableHydraulicBoundaryLocationColumnIndex = 1; + + private readonly Observer hydraulicBoundaryLocationsObserver; + private IAssessmentSection assessmentSection; + + public event EventHandler SelectionChanged; + + /// + /// Creates a new instance of . + /// + public GrassCoverErosionInwardsCalculationsView() + { + InitializeComponent(); + InitializeDataGridView(); + + hydraulicBoundaryLocationsObserver = new Observer(UpdateSelectableHydraulicBoundaryLocationsColumn); + } + + /// + /// Gets or sets the assessment section. + /// + public IAssessmentSection AssessmentSection + { + get + { + return assessmentSection; + } + set + { + assessmentSection = value; + + hydraulicBoundaryLocationsObserver.Observable = assessmentSection?.HydraulicBoundaryDatabase.Locations; + } + } + + public GrassCoverErosionInwardsFailureMechanism GrassCoverErosionInwardsFailureMechanism { get; set; } + + public object Selection { get; } + + public object Data { get; set; } + + private void InitializeDataGridView() + { + dataGridViewControl.AddTextBoxColumn( + nameof(GrassCoverErosionInwardsCalculationRow.Name), + Resources.GrassCoverErosionInwardsCalculation_Name_DisplayName); + + dataGridViewControl.AddComboBoxColumn>( + nameof(GrassCoverErosionInwardsCalculationRow.SelectableHydraulicBoundaryLocation), + RiskeerCommonFormsResources.HydraulicBoundaryLocation_DisplayName, + null, + nameof(DataGridViewComboBoxItemWrapper.This), + nameof(DataGridViewComboBoxItemWrapper.DisplayName)); + + dataGridViewControl.AddComboBoxColumn>( + nameof(GrassCoverErosionInwardsCalculationRow.DikeProfile), + Resources.DikeProfile_DisplayName, + null, + nameof(DataGridViewComboBoxItemWrapper.This), + nameof(DataGridViewComboBoxItemWrapper.DisplayName)); + + dataGridViewControl.AddCheckBoxColumn(nameof(GrassCoverErosionInwardsCalculationRow.UseDam), Resources.GrassCoverErosionInwardsCalculation_Use_Dam); + + dataGridViewControl.AddComboBoxColumn>( + nameof(GrassCoverErosionInwardsCalculationRow.DamType), + Resources.GrassCoverErosionInwardsCalculation_Damtype, + null, + nameof(DataGridViewComboBoxItemWrapper.This), + nameof(DataGridViewComboBoxItemWrapper.DisplayName)); + + dataGridViewControl.AddTextBoxColumn( + nameof(GrassCoverErosionInwardsCalculationRow.Damheight), + Resources.GrassCoverErosionInwardsCalculation_Damheight); + + dataGridViewControl.AddCheckBoxColumn(nameof(GrassCoverErosionInwardsCalculationRow.UseForeShoreGeometry), Resources.GrassCoverErosionInwardsCalculation_Use_ForeShoreGeometry); + + dataGridViewControl.AddTextBoxColumn( + nameof(GrassCoverErosionInwardsCalculationRow.DikeHeight), + Resources.GrassCoverErosionInwardsCalculation_Dikeheight); + + dataGridViewControl.AddTextBoxColumn( + nameof(GrassCoverErosionInwardsCalculationRow.ExpectedCriticalOvertoppingRate), + Resources.GrassCoverErosionInwardsCalculation_Expected_Critical_OvertoppingRate); + + dataGridViewControl.AddTextBoxColumn( + nameof(GrassCoverErosionInwardsCalculationRow.StandardDeviationCriticalOvertoppingRate), + Resources.GrassCoverErosionInwardsCalculation_StandardDeviation_Critical_OvertoppingRate); + } + + private void UpdateSelectableHydraulicBoundaryLocationsColumn() + { + var column = (DataGridViewComboBoxColumn) dataGridViewControl.GetColumnFromIndex(selectableHydraulicBoundaryLocationColumnIndex); + + using (new SuspendDataGridViewColumnResizes(column)) + { + foreach (DataGridViewRow dataGridViewRow in dataGridViewControl.Rows) + { + FillAvailableSelectableHydraulicBoundaryLocationsList(dataGridViewRow); + } + } + } + + private void FillAvailableSelectableHydraulicBoundaryLocationsList(DataGridViewRow dataGridViewRow) + { + var rowData = (GrassCoverErosionInwardsCalculationRow) dataGridViewRow.DataBoundItem; + IEnumerable locations = GetSelectableHydraulicBoundaryLocationsForCalculation(rowData.GrassCoverErosionInwardsCalculationScenario); + + var cell = (DataGridViewComboBoxCell) dataGridViewRow.Cells[selectableHydraulicBoundaryLocationColumnIndex]; + DataGridViewComboBoxItemWrapper[] dataGridViewComboBoxItemWrappers = GetSelectableHydraulicBoundaryLocationsDataSource(locations).ToArray(); + SetItemsOnObjectCollection(cell.Items, dataGridViewComboBoxItemWrappers); + } + + private IEnumerable GetSelectableHydraulicBoundaryLocationsForCalculation(GrassCoverErosionInwardsCalculationScenario grassCoverErosionInwardsCalculationScenario) + { + return GetSelectableHydraulicBoundaryLocations(assessmentSection?.HydraulicBoundaryDatabase.Locations, + grassCoverErosionInwardsCalculationScenario.InputParameters.DikeProfile); + } + + private static IEnumerable GetSelectableHydraulicBoundaryLocations( + IEnumerable hydraulicBoundaryLocations, DikeProfile dikeProfile) + { + Point2D referencePoint = dikeProfile?.WorldReferencePoint; + return SelectableHydraulicBoundaryLocationHelper.GetSortedSelectableHydraulicBoundaryLocations( + hydraulicBoundaryLocations, referencePoint); + } + + private static void SetItemsOnObjectCollection(DataGridViewComboBoxCell.ObjectCollection objectCollection, object[] comboBoxItems) + { + objectCollection.Clear(); + objectCollection.AddRange(comboBoxItems); + } + + private static List> GetSelectableHydraulicBoundaryLocationsDataSource( + IEnumerable selectableHydraulicBoundaryLocations = null) + { + var dataGridViewComboBoxItemWrappers = new List> + { + new DataGridViewComboBoxItemWrapper(null) + }; + + if (selectableHydraulicBoundaryLocations != null) + { + dataGridViewComboBoxItemWrappers.AddRange(selectableHydraulicBoundaryLocations.Select(hbl => new DataGridViewComboBoxItemWrapper(hbl))); + } + + return dataGridViewComboBoxItemWrappers; + } + } +} \ No newline at end of file Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.resx =================================================================== diff -u --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.resx (revision 0) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsCalculationsView.resx (revision a61a8c6b3b7dcf4126ad67dd8ca79ba514839a08) @@ -0,0 +1,477 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + 1 + + + + Fill + + + + 4, 4 + + + 4, 4, 4, 4 + + + 1 + + + Top, Bottom, Left, Right + + + False + + + 16 + + + 4, 25 + + + 4, 0, 4, 0 + + + 204, 234 + + + 1 + + + listBox + + + System.Windows.Forms.ListBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanelListBox + + + 0 + + + True + + + 4, 0 + + + 4, 0, 4, 0 + + + 32, 17 + + + 0 + + + Vak + + + labelFailureMechanismSections + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanelListBox + + + 1 + + + Fill + + + 0, 0 + + + 4, 4, 4, 4 + + + 2 + + + 212, 259 + + + 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,25,Percent,100" /></TableLayoutSettings> + + + splitContainer.Panel1 + + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + splitContainer + + + 0 + + + 100 + + + 1 + + + True + + + 4, 0 + + + 4, 0, 4, 0 + + + 240, 17 + + + 0 + + + Berekeningen voor geselecteerd vak + + + labelCalculations + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanelDataGrid + + + 0 + + + Top, Bottom, Left, Right + + + 5, 30 + + + 5, 5, 5, 5 + + + 432, 224 + + + 1 + + + dataGridViewControl + + + Core.Common.Controls.DataGrid.DataGridViewControl, Core.Common.Controls, Version=20.1.1.1, Culture=neutral, PublicKeyToken=null + + + tableLayoutPanelDataGrid + + + 1 + + + Fill + + + 0, 0 + + + 4, 4, 4, 4 + + + 2 + + + 442, 259 + + + 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="dataGridViewControl" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="Absolute,25,Percent,100" /></TableLayoutSettings> + + + splitContainer.Panel2 + + + System.Windows.Forms.SplitterPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + splitContainer + + + 1 + + + 0 + + + 659, 259 + + + 212 + + + 5 + + + 0 + + + splitContainer + + + System.Windows.Forms.SplitContainer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanelUserControl + + + 0 + + + True + + + Left + + + False + + + NoControl + + + 4, 271 + + + 4, 4, 4, 4 + + + 212, 33 + + + 0 + + + Genereer &berekeningen... + + + buttonGenerateScenarios + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanelUserControl + + + 1 + + + Fill + + + 0, 0 + + + 4, 4, 4, 4 + + + 2 + + + 667, 308 + + + 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="buttonGenerateScenarios" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="Percent,100,AutoSize,0,Absolute,25" /></TableLayoutSettings> + + + True + + + 8, 16 + + + True + + + 500, 250 + + + 4, 4, 4, 4 + + + 667, 308 + + + GrassCoverErosionInwardsCalculationsView + + + System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file Index: Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs =================================================================== diff -u -r9b642748438acbabb3f67559e289ec49525aaf4b -ra61a8c6b3b7dcf4126ad67dd8ca79ba514839a08 --- Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision 9b642748438acbabb3f67559e289ec49525aaf4b) +++ Riskeer/GrassCoverErosionInwards/src/Riskeer.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision a61a8c6b3b7dcf4126ad67dd8ca79ba514839a08) @@ -249,6 +249,20 @@ CreateInstance = context => new OvertoppingRateOutputGeneralResultFaultTreeIllustrationPointView( () => context.WrappedData.Output?.OvertoppingRateOutput?.GeneralResult) }; + + yield return new ViewInfo + { + GetViewData = context => context.WrappedData, + GetViewName = (view, context) => context.WrappedData.Name, + Image = RiskeerCommonFormsResources.GeneralFolderIcon, + AdditionalDataCheck = context => context.WrappedData == context.FailureMechanism.CalculationsGroup, + CloseForData = CloseGrassCoverErosionInwardsCalculationsViewForData, + AfterCreate = (view, context) => + { + view.AssessmentSection = context.AssessmentSection; + view.GrassCoverErosionInwardsFailureMechanism = context.FailureMechanism; + } + }; } public override IEnumerable GetTreeNodeInfos() @@ -465,6 +479,21 @@ return calculations != null && calculations.Any(ci => ReferenceEquals(view.Data, ci)); } + private static bool CloseGrassCoverErosionInwardsCalculationsViewForData(GrassCoverErosionInwardsCalculationsView view, object o) + { + var assessmentSection = o as IAssessmentSection; + var grassCoverErosionInwardsFailureMechanism = o as GrassCoverErosionInwardsFailureMechanism; + + if (assessmentSection != null) + { + grassCoverErosionInwardsFailureMechanism = assessmentSection.GetFailureMechanisms() + .OfType() + .FirstOrDefault(); + } + + return grassCoverErosionInwardsFailureMechanism != null && ReferenceEquals(view.Data, grassCoverErosionInwardsFailureMechanism.CalculationsGroup); + } + #endregion #region TreeNodeInfos Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsCalculationRowTest.cs =================================================================== diff -u --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsCalculationRowTest.cs (revision 0) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsCalculationRowTest.cs (revision a61a8c6b3b7dcf4126ad67dd8ca79ba514839a08) @@ -0,0 +1,80 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Rhino.Mocks; +using Riskeer.Common.Forms.PropertyClasses; +using Riskeer.GrassCoverErosionInwards.Data; +using Riskeer.GrassCoverErosionInwards.Forms.Views; + +namespace Riskeer.GrassCoverErosionInwards.Forms.Test.Views +{ + [TestFixture] + public class GrassCoverErosionInwardsCalculationRowTest + { + [Test] + public void Constructor_WithoutCalculation_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var handler = mocks.Stub(); + mocks.ReplayAll(); + + // Call + void Call() => new GrassCoverErosionInwardsCalculationRow(null, handler); + + // Assert + string paramName = Assert.Throws(Call).ParamName; + Assert.AreEqual("grassCoverErosionInwardsCalculationScenario", paramName); + mocks.VerifyAll(); + } + + [Test] + public void Constructor_WithoutHandler_ThrowsArgumentNullException() + { + // Call + void Call() => new GrassCoverErosionInwardsCalculationRow(new GrassCoverErosionInwardsCalculationScenario(), null); + + // Assert + string paramName = Assert.Throws(Call).ParamName; + Assert.AreEqual("handler", paramName); + } + + [Test] + public void Constructor_WithCalculation_PropertiesCorrectlySet() + { + // Setup + var mocks = new MockRepository(); + var handler = mocks.Stub(); + mocks.ReplayAll(); + var grassCoverErosionInwardsCalculationScenario = new GrassCoverErosionInwardsCalculationScenario(); + + // Call + var grassCoverErosionInwardsCalculationRow = new GrassCoverErosionInwardsCalculationRow(grassCoverErosionInwardsCalculationScenario, handler); + + // Asserts + Assert.AreSame(grassCoverErosionInwardsCalculationScenario, grassCoverErosionInwardsCalculationRow.GrassCoverErosionInwardsCalculationScenario); + + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsCalculationsViewTest.cs =================================================================== diff -u --- Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsCalculationsViewTest.cs (revision 0) +++ Riskeer/GrassCoverErosionInwards/test/Riskeer.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsCalculationsViewTest.cs (revision a61a8c6b3b7dcf4126ad67dd8ca79ba514839a08) @@ -0,0 +1,127 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Linq; +using System.Windows.Forms; +using Core.Common.Controls.Views; +using NUnit.Extensions.Forms; +using NUnit.Framework; +using Riskeer.GrassCoverErosionInwards.Forms.Views; + +namespace Riskeer.GrassCoverErosionInwards.Forms.Test.Views +{ + [TestFixture] + public class GrassCoverErosionInwardsCalculationsViewTest : NUnitFormTest + { + private const int nameColumnIndex = 0; + private const int selectableHydraulicBoundaryLocationsColumnIndex = 1; + private const int dikeProfileColumnIndex = 2; + private const int useDamColumnIndex = 3; + private const int damTypeColumnIndex = 4; + private const int damHeightColumnIndex = 5; + private const int useForeShoreGeometryColumnIndex = 6; + private const int dikeHeightColumnIndex = 7; + private const int expectedCriticalOvertoppingRateColumnIndex = 8; + private const int standardDeviationCriticalOvertoppingRateColumnIndex = 9; + private Form testForm; + + [Test] + public void Constructor_DefaultValues() + { + // Call + using (var grassCoverErosionInwardsCalculationsView = new GrassCoverErosionInwardsCalculationsView()) + { + // Assert + Assert.IsInstanceOf(grassCoverErosionInwardsCalculationsView); + Assert.IsInstanceOf(grassCoverErosionInwardsCalculationsView); + Assert.IsInstanceOf(grassCoverErosionInwardsCalculationsView); + Assert.IsNull(grassCoverErosionInwardsCalculationsView.Data); + Assert.IsNull(grassCoverErosionInwardsCalculationsView.AssessmentSection); + } + } + + [Test] + public void Constructor_DataGridViewCorrectlyInitialized() + { + // Call + using (ShowGrassCoverErosionInwardsCalculationsView()) + { + var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; + + // Assert + Assert.IsFalse(dataGridView.AutoGenerateColumns); + Assert.AreEqual(10, dataGridView.ColumnCount); + + foreach (DataGridViewComboBoxColumn column in dataGridView.Columns.OfType()) + { + Assert.AreEqual("This", column.ValueMember); + Assert.AreEqual("DisplayName", column.DisplayMember); + } + } + } + + [Test] + public void Constructor_DataGridViewControlColumnHeadersCorrectlyInitialized_() + { + // Call + using (ShowGrassCoverErosionInwardsCalculationsView()) + { + // Assert + var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; + Assert.AreEqual(10, dataGridView.ColumnCount); + Assert.AreEqual("Naam", dataGridView.Columns[nameColumnIndex].HeaderText); + Assert.AreEqual("Hydraulische belastingenlocatie", dataGridView.Columns[selectableHydraulicBoundaryLocationsColumnIndex].HeaderText); + Assert.AreEqual("Dijkprofiel", dataGridView.Columns[dikeProfileColumnIndex].HeaderText); + Assert.AreEqual("Gebruik dam", dataGridView.Columns[useDamColumnIndex].HeaderText); + Assert.AreEqual("Damtype", dataGridView.Columns[damTypeColumnIndex].HeaderText); + Assert.AreEqual("Damhoogte [m+NAP]", dataGridView.Columns[damHeightColumnIndex].HeaderText); + Assert.AreEqual("Gebruik voorlandgeometrie", dataGridView.Columns[useForeShoreGeometryColumnIndex].HeaderText); + Assert.AreEqual("Dijkhoogte [m+NAP]", dataGridView.Columns[dikeHeightColumnIndex].HeaderText); + Assert.AreEqual("Verwachtingswaarde kritiek overslagdebiet [m3/m/s]", dataGridView.Columns[expectedCriticalOvertoppingRateColumnIndex].HeaderText); + Assert.AreEqual("Standaardafwijking kritiek overslagdebiet [m3/m/s]", dataGridView.Columns[standardDeviationCriticalOvertoppingRateColumnIndex].HeaderText); + } + } + + public override void Setup() + { + base.Setup(); + + testForm = new Form(); + } + + public override void TearDown() + { + base.TearDown(); + + testForm.Dispose(); + } + + private GrassCoverErosionInwardsCalculationsView ShowGrassCoverErosionInwardsCalculationsView() + { + var grassCoverErosionInwardsCalculationsView = new GrassCoverErosionInwardsCalculationsView(); + + testForm.Controls.Add(grassCoverErosionInwardsCalculationsView); + testForm.Show(); + + return grassCoverErosionInwardsCalculationsView; + } + } +} \ No newline at end of file