Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PresentationObjects/MacroStabilityInwardsScenariosContext.cs
===================================================================
diff -u -r566d36e29347b40381bff26e321334b5af07c367 -r5a67fdd92b4e69e1fde669dd27605d0eeaad734b
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PresentationObjects/MacroStabilityInwardsScenariosContext.cs (.../MacroStabilityInwardsScenariosContext.cs) (revision 566d36e29347b40381bff26e321334b5af07c367)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PresentationObjects/MacroStabilityInwardsScenariosContext.cs (.../MacroStabilityInwardsScenariosContext.cs) (revision 5a67fdd92b4e69e1fde669dd27605d0eeaad734b)
@@ -21,6 +21,7 @@
using System;
using Core.Common.Controls.PresentationObjects;
+using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.MacroStabilityInwards.Data;
@@ -35,21 +36,35 @@
/// Creates a new instance of .
///
/// The wrapped .
- /// A forming the context.
+ /// The failure mechanism that the calculation group belongs to.
+ /// The assessment section that the calculation group belongs to.
/// Thrown when any parameter is null.
- public MacroStabilityInwardsScenariosContext(CalculationGroup wrappedData, MacroStabilityInwardsFailureMechanism failureMechanism)
+ public MacroStabilityInwardsScenariosContext(CalculationGroup wrappedData, MacroStabilityInwardsFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
: base(wrappedData)
{
if (failureMechanism == null)
{
throw new ArgumentNullException(nameof(failureMechanism));
}
- ParentFailureMechanism = failureMechanism;
+
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ FailureMechanism = failureMechanism;
+ AssessmentSection = assessmentSection;
}
///
/// Gets the parent failure mechanism of the calculation group.
///
- public MacroStabilityInwardsFailureMechanism ParentFailureMechanism { get; }
+ public MacroStabilityInwardsFailureMechanism FailureMechanism { get; }
+
+ ///
+ /// Gets the assessment section.
+ ///
+ public IAssessmentSection AssessmentSection { get; }
}
}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.cs
===================================================================
diff -u -re38673ff639b5d86a2f55997e2d0d876ba4737f7 -r5a67fdd92b4e69e1fde669dd27605d0eeaad734b
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.cs (.../MacroStabilityInwardsScenariosView.cs) (revision e38673ff639b5d86a2f55997e2d0d876ba4737f7)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.cs (.../MacroStabilityInwardsScenariosView.cs) (revision 5a67fdd92b4e69e1fde669dd27605d0eeaad734b)
@@ -26,6 +26,7 @@
using Core.Common.Base;
using Core.Common.Base.Geometry;
using Core.Common.Controls.Views;
+using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.MacroStabilityInwards.Data;
@@ -38,6 +39,7 @@
///
public partial class MacroStabilityInwardsScenariosView : UserControl, IView
{
+ private readonly IAssessmentSection assessmentSection;
private readonly RecursiveObserver inputObserver;
private readonly RecursiveObserver calculationGroupObserver;
private readonly RecursiveObserver calculationObserver;
@@ -48,12 +50,22 @@
///
/// Creates a new instance of the class.
///
- public MacroStabilityInwardsScenariosView()
+ /// The assessment section the scenarios belong to.
+ /// Thrown when
+ /// is null.
+ public MacroStabilityInwardsScenariosView(IAssessmentSection assessmentSection)
{
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
InitializeComponent();
InitializeDataGridView();
InitializeListBox();
+ this.assessmentSection = assessmentSection;
+
failureMechanismObserver = new Observer(OnFailureMechanismUpdate);
// The concat is needed to observe the input of calculations in child groups.
@@ -169,7 +181,7 @@
List dataSource = calculations.Select(pc => new MacroStabilityInwardsScenarioRow(
pc,
MacroStabilityInwardsFailureMechanism,
- null)).ToList();
+ assessmentSection)).ToList();
dataGridViewControl.SetDataSource(dataSource);
}
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs
===================================================================
diff -u -r0bc724e93170500800aa7e5d3bf641ab44eeeac7 -r5a67fdd92b4e69e1fde669dd27605d0eeaad734b
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision 0bc724e93170500800aa7e5d3bf641ab44eeeac7)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision 5a67fdd92b4e69e1fde669dd27605d0eeaad734b)
@@ -249,9 +249,10 @@
GetViewData = context => context.WrappedData,
GetViewName = (view, calculationGroup) => RingtoetsCommonFormsResources.Scenarios_DisplayName,
Image = RingtoetsCommonFormsResources.ScenariosIcon,
- AdditionalDataCheck = context => context.WrappedData == context.ParentFailureMechanism.CalculationsGroup,
+ AdditionalDataCheck = context => context.WrappedData == context.FailureMechanism.CalculationsGroup,
CloseForData = CloseScenariosViewForData,
- AfterCreate = (view, context) => { view.MacroStabilityInwardsFailureMechanism = context.ParentFailureMechanism; }
+ AfterCreate = (view, context) => { view.MacroStabilityInwardsFailureMechanism = context.FailureMechanism; },
+ CreateInstance = context => new MacroStabilityInwardsScenariosView(context.AssessmentSection)
};
yield return new ViewInfo
@@ -686,7 +687,7 @@
{
new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Inputs_DisplayName, GetInputs(wrappedData, macroStabilityInwardsFailureMechanismContext.Parent), TreeFolderCategory.Input),
new MacroStabilityInwardsCalculationGroupContext(wrappedData.CalculationsGroup, null, wrappedData.SurfaceLines, wrappedData.StochasticSoilModels, wrappedData, macroStabilityInwardsFailureMechanismContext.Parent),
- new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Outputs_DisplayName, GetOutputs(wrappedData), TreeFolderCategory.Output)
+ new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Outputs_DisplayName, GetOutputs(wrappedData, macroStabilityInwardsFailureMechanismContext.Parent), TreeFolderCategory.Output)
};
}
@@ -709,11 +710,11 @@
};
}
- private static IEnumerable