Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresDataSynchronizationService.cs
===================================================================
diff -u -r2f41eb6eb560911cd4ebe2d4d6924c26df911c40 -r12cec002453a1828efc68633fbd25219632c6c47
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresDataSynchronizationService.cs (.../HeightStructuresDataSynchronizationService.cs) (revision 2f41eb6eb560911cd4ebe2d4d6924c26df911c40)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Service/HeightStructuresDataSynchronizationService.cs (.../HeightStructuresDataSynchronizationService.cs) (revision 12cec002453a1828efc68633fbd25219632c6c47)
@@ -23,6 +23,7 @@
using System.Collections.Generic;
using System.Linq;
using Core.Common.Base;
+using Ringtoets.Common.Data;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.Hydraulics;
using Ringtoets.Common.Data.Structures;
@@ -121,89 +122,6 @@
return new ClearResults(changedObjects, removedObjects);
}
- ///
- /// Removes the given and all dependent data, either directly
- /// or indirectly, from the .
- ///
- /// The failure mechanism containing .
- /// The structure to be removed.
- /// All objects affected by the removal.
- public static IEnumerable RemoveStructure(HeightStructuresFailureMechanism failureMechanism, HeightStructure structure)
- {
- StructuresCalculation[] heightStructureCalculations = failureMechanism.Calculations
- .Cast>()
- .ToArray();
- StructuresCalculation[] calculationWithRemovedHeightStructure = heightStructureCalculations
- .Where(c => ReferenceEquals(c.InputParameters.Structure, structure))
- .ToArray();
-
- ICollection changedObservables = RemoveStructureDependentData(failureMechanism,
- calculationWithRemovedHeightStructure,
- heightStructureCalculations);
-
- failureMechanism.HeightStructures.Remove(structure);
- changedObservables.Add(failureMechanism.HeightStructures);
-
- return changedObservables;
- }
-
- ///
- /// Removes all height structures from the
- /// and clears all data that depends on it, either directly or indirectly.
- ///
- /// The failure mechanism.
- /// All objects that are affected by this operation.
- /// Thrown when
- /// is null.
- public static IEnumerable RemoveAllStructures(HeightStructuresFailureMechanism failureMechanism)
- {
- if (failureMechanism == null)
- {
- throw new ArgumentNullException(nameof(failureMechanism));
- }
-
- StructuresCalculation[] heightStructureCalculations = failureMechanism.Calculations
- .Cast>()
- .ToArray();
- StructuresCalculation[] calculationWithRemovedHeightStructure = heightStructureCalculations
- .Where(c => c.InputParameters.Structure != null)
- .ToArray();
-
- ICollection changedObservables = RemoveStructureDependentData(failureMechanism,
- calculationWithRemovedHeightStructure,
- heightStructureCalculations);
-
- failureMechanism.HeightStructures.Clear();
- changedObservables.Add(failureMechanism.HeightStructures);
-
- return changedObservables;
- }
-
- private static ICollection RemoveStructureDependentData(HeightStructuresFailureMechanism failureMechanism,
- StructuresCalculation[] calculationWithRemovedHeightStructure,
- StructuresCalculation[] heightStructureCalculations)
- {
- var changedObservables = new HashSet();
- foreach (StructuresCalculation calculation in calculationWithRemovedHeightStructure)
- {
- foreach (IObservable calculationWithRemovedOutput in RingtoetsCommonDataSynchronizationService.ClearCalculationOutput(calculation))
- {
- changedObservables.Add(calculationWithRemovedOutput);
- }
-
- calculation.InputParameters.Structure = null;
- changedObservables.Add(calculation.InputParameters);
- }
-
- IEnumerable> affectedSectionResults =
- StructuresHelper.UpdateCalculationToSectionResultAssignments(failureMechanism.SectionResults, heightStructureCalculations);
- foreach (StructuresFailureMechanismSectionResult result in affectedSectionResults)
- {
- changedObservables.Add(result);
- }
- return changedObservables;
- }
-
private static IEnumerable ClearHydraulicBoundaryLocation(HeightStructuresInput input)
{
if (input.HydraulicBoundaryLocation != null)