Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationRow.cs
===================================================================
diff -u -r86594ccd7329d320872573a1d066fe18959d3cea -r8dd568726bfcaf1f2c517f6e7c76ebe2b0f7e8b1
--- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationRow.cs (.../MacroStabilityInwardsCalculationRow.cs) (revision 86594ccd7329d320872573a1d066fe18959d3cea)
+++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationRow.cs (.../MacroStabilityInwardsCalculationRow.cs) (revision 8dd568726bfcaf1f2c517f6e7c76ebe2b0f7e8b1)
@@ -21,11 +21,12 @@
using System;
using Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
using Core.Common.Controls.DataGrid;
using Riskeer.Common.Data.Hydraulics;
using Riskeer.Common.Forms.ChangeHandlers;
-using Riskeer.Common.Forms.PresentationObjects;
using Riskeer.Common.Forms.PropertyClasses;
+using Riskeer.Common.Forms.Views;
using Riskeer.MacroStabilityInwards.Data;
using Riskeer.MacroStabilityInwards.Data.SoilProfile;
@@ -34,70 +35,30 @@
///
/// This class represents a row of in the .
///
- internal class MacroStabilityInwardsCalculationRow
+ public class MacroStabilityInwardsCalculationRow : CalculationRow
{
- private readonly IObservablePropertyChangeHandler propertyChangeHandler;
-
///
/// Creates a new instance of .
///
- /// The this row contains.
+ /// The this row contains.
/// The handler responsible for handling effects of a property change.
/// Thrown when any parameter is null.
- public MacroStabilityInwardsCalculationRow(MacroStabilityInwardsCalculationScenario macroStabilityInwardsCalculation,
+ internal MacroStabilityInwardsCalculationRow(MacroStabilityInwardsCalculationScenario calculationScenario,
IObservablePropertyChangeHandler handler)
- {
- if (macroStabilityInwardsCalculation == null)
- {
- throw new ArgumentNullException(nameof(macroStabilityInwardsCalculation));
- }
+ : base(calculationScenario, handler) {}
- if (handler == null)
- {
- throw new ArgumentNullException(nameof(handler));
- }
-
- MacroStabilityInwardsCalculation = macroStabilityInwardsCalculation;
- propertyChangeHandler = handler;
- }
-
///
- /// Gets the this row contains.
- ///
- public MacroStabilityInwardsCalculationScenario MacroStabilityInwardsCalculation { get; }
-
- ///
- /// Gets or sets the name of the .
- ///
- public string Name
- {
- get
- {
- return MacroStabilityInwardsCalculation.Name;
- }
- set
- {
- MacroStabilityInwardsCalculation.Name = value;
-
- MacroStabilityInwardsCalculation.NotifyObservers();
- }
- }
-
- ///
/// Gets or sets the stochastic soil model of the .
///
public DataGridViewComboBoxItemWrapper StochasticSoilModel
{
- get
- {
- return new DataGridViewComboBoxItemWrapper(MacroStabilityInwardsCalculation.InputParameters.StochasticSoilModel);
- }
+ get => new DataGridViewComboBoxItemWrapper(Calculation.InputParameters.StochasticSoilModel);
set
{
MacroStabilityInwardsStochasticSoilModel valueToSet = value?.WrappedObject;
- if (!ReferenceEquals(MacroStabilityInwardsCalculation.InputParameters.StochasticSoilModel, valueToSet))
+ if (!ReferenceEquals(Calculation.InputParameters.StochasticSoilModel, valueToSet))
{
- PropertyChangeHelper.ChangePropertyAndNotify(() => MacroStabilityInwardsCalculation.InputParameters.StochasticSoilModel = valueToSet, propertyChangeHandler);
+ PropertyChangeHelper.ChangePropertyAndNotify(() => Calculation.InputParameters.StochasticSoilModel = valueToSet, PropertyChangeHandler);
}
}
}
@@ -107,57 +68,34 @@
///
public DataGridViewComboBoxItemWrapper StochasticSoilProfile
{
- get
- {
- return new DataGridViewComboBoxItemWrapper(MacroStabilityInwardsCalculation.InputParameters.StochasticSoilProfile);
- }
+ get => new DataGridViewComboBoxItemWrapper(Calculation.InputParameters.StochasticSoilProfile);
set
{
MacroStabilityInwardsStochasticSoilProfile valueToSet = value?.WrappedObject;
- if (!ReferenceEquals(MacroStabilityInwardsCalculation.InputParameters.StochasticSoilProfile, valueToSet))
+ if (!ReferenceEquals(Calculation.InputParameters.StochasticSoilProfile, valueToSet))
{
- PropertyChangeHelper.ChangePropertyAndNotify(() => MacroStabilityInwardsCalculation.InputParameters.StochasticSoilProfile = valueToSet, propertyChangeHandler);
+ PropertyChangeHelper.ChangePropertyAndNotify(() => Calculation.InputParameters.StochasticSoilProfile = valueToSet, PropertyChangeHandler);
}
}
}
///
/// Gets the stochastic soil profile probability of the .
///
- public RoundedDouble StochasticSoilProfileProbability
+ public RoundedDouble StochasticSoilProfileProbability =>
+ Calculation.InputParameters.StochasticSoilProfile != null
+ ? new RoundedDouble(2, Calculation.InputParameters.StochasticSoilProfile.Probability * 100)
+ : new RoundedDouble(2);
+
+ public override Point2D GetCalculationLocation()
{
- get
- {
- return MacroStabilityInwardsCalculation.InputParameters.StochasticSoilProfile != null
- ? new RoundedDouble(2, MacroStabilityInwardsCalculation.InputParameters.StochasticSoilProfile.Probability * 100)
- : new RoundedDouble(2);
- }
+ return Calculation.InputParameters.SurfaceLine?.ReferenceLineIntersectionWorldPoint;
}
- ///
- /// Gets or sets the hydraulic boundary location of the .
- ///
- public DataGridViewComboBoxItemWrapper SelectableHydraulicBoundaryLocation
+ protected override HydraulicBoundaryLocation HydraulicBoundaryLocation
{
- get
- {
- if (MacroStabilityInwardsCalculation.InputParameters.HydraulicBoundaryLocation == null)
- {
- return new DataGridViewComboBoxItemWrapper(null);
- }
-
- return new DataGridViewComboBoxItemWrapper(
- new SelectableHydraulicBoundaryLocation(MacroStabilityInwardsCalculation.InputParameters.HydraulicBoundaryLocation,
- MacroStabilityInwardsCalculation.InputParameters.SurfaceLine?.ReferenceLineIntersectionWorldPoint));
- }
- set
- {
- HydraulicBoundaryLocation valueToSet = value?.WrappedObject?.HydraulicBoundaryLocation;
- if (!ReferenceEquals(MacroStabilityInwardsCalculation.InputParameters.HydraulicBoundaryLocation, valueToSet))
- {
- PropertyChangeHelper.ChangePropertyAndNotify(() => MacroStabilityInwardsCalculation.InputParameters.HydraulicBoundaryLocation = valueToSet, propertyChangeHandler);
- }
- }
+ get => Calculation.InputParameters.HydraulicBoundaryLocation;
+ set => Calculation.InputParameters.HydraulicBoundaryLocation = value;
}
}
}
\ No newline at end of file
Fisheye: Tag 8dd568726bfcaf1f2c517f6e7c76ebe2b0f7e8b1 refers to a dead (removed) revision in file `Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationsView.Designer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationsView.cs
===================================================================
diff -u -r86594ccd7329d320872573a1d066fe18959d3cea -r8dd568726bfcaf1f2c517f6e7c76ebe2b0f7e8b1
--- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationsView.cs (.../MacroStabilityInwardsCalculationsView.cs) (revision 86594ccd7329d320872573a1d066fe18959d3cea)
+++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsCalculationsView.cs (.../MacroStabilityInwardsCalculationsView.cs) (revision 8dd568726bfcaf1f2c517f6e7c76ebe2b0f7e8b1)
@@ -26,14 +26,11 @@
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.Calculation;
-using Riskeer.Common.Data.FailureMechanism;
-using Riskeer.Common.Data.Hydraulics;
using Riskeer.Common.Forms.ChangeHandlers;
using Riskeer.Common.Forms.Helpers;
-using Riskeer.Common.Forms.PresentationObjects;
+using Riskeer.Common.Forms.Views;
using Riskeer.MacroStabilityInwards.Data;
using Riskeer.MacroStabilityInwards.Data.SoilProfile;
using Riskeer.MacroStabilityInwards.Forms.PresentationObjects;
@@ -47,363 +44,202 @@
///
/// This class is a view for configuring macro stability inwards calculations.
///
- public partial class MacroStabilityInwardsCalculationsView : UserControl, ISelectionProvider, IView
+ public class MacroStabilityInwardsCalculationsView : CalculationsView
{
- private const int stochasticSoilModelColumnIndex = 1;
- private const int stochasticSoilProfileColumnIndex = 2;
- private const int selectableHydraulicBoundaryLocationColumnIndex = 4;
+ private const int selectableHydraulicBoundaryLocationColumnIndex = 1;
+ private const int stochasticSoilModelColumnIndex = 2;
+ private const int stochasticSoilProfileColumnIndex = 3;
- private readonly Observer hydraulicBoundaryLocationsObserver;
- private readonly RecursiveObserver inputObserver;
- private readonly RecursiveObserver calculationGroupObserver;
- private readonly RecursiveObserver calculationObserver;
- private readonly Observer failureMechanismObserver;
private readonly RecursiveObserver surfaceLineObserver;
private readonly Observer stochasticSoilModelsObserver;
private readonly RecursiveObserver stochasticSoilProfileObserver;
- private IAssessmentSection assessmentSection;
- private CalculationGroup calculationGroup;
- private MacroStabilityInwardsFailureMechanism macroStabilityInwardsFailureMechanism;
- public event EventHandler SelectionChanged;
-
///
/// Creates a new instance of .
///
- public MacroStabilityInwardsCalculationsView()
+ public MacroStabilityInwardsCalculationsView(CalculationGroup calculationGroup, MacroStabilityInwardsFailureMechanism failureMechanism, IAssessmentSection assessmentSection)
+ : base(calculationGroup, failureMechanism, assessmentSection)
{
- InitializeComponent();
- InitializeDataGridView();
- InitializeListBox();
+ surfaceLineObserver = new RecursiveObserver(() =>
+ {
+ UpdateColumns();
+ UpdateGenerateCalculationsButtonState();
+ }, rpslc => rpslc)
+ {
+ Observable = failureMechanism.SurfaceLines
+ };
- failureMechanismObserver = new Observer(OnFailureMechanismUpdate);
- hydraulicBoundaryLocationsObserver = new Observer(UpdateSelectableHydraulicBoundaryLocationsColumn);
- // The concat is needed to observe the input of calculations in child groups.
- inputObserver = new RecursiveObserver(UpdateDataGridViewDataSource, cg => cg.Children
- .Concat