Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsDataSynchronizationService.cs =================================================================== diff -u -rf1fa2338dda2747f6bb70e82b4527f7b5f1708bf -rc964c048005d93b097a1e6a817dace95b293040f --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsDataSynchronizationService.cs (.../GrassCoverErosionInwardsDataSynchronizationService.cs) (revision f1fa2338dda2747f6bb70e82b4527f7b5f1708bf) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Service/GrassCoverErosionInwardsDataSynchronizationService.cs (.../GrassCoverErosionInwardsDataSynchronizationService.cs) (revision c964c048005d93b097a1e6a817dace95b293040f) @@ -23,6 +23,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; +using Core.Common.Base; using Core.Common.Utils.Extensions; using Ringtoets.GrassCoverErosionInwards.Data; using Ringtoets.HydraRing.Data; @@ -76,7 +77,7 @@ calculation.Output = null; } - + /// /// Clears the and output for all the calculations /// in the . @@ -120,6 +121,34 @@ return affectedItems; } + /// + /// Clears all data dependent, either directly or indirectly, on the parent reference line. + /// + /// The failure mechanism to be cleared. + /// All objects that have been changed. + /// Thrown when + /// is null. + public static IEnumerable ClearReferenceLineDependentData(GrassCoverErosionInwardsFailureMechanism failureMechanism) + { + if (failureMechanism == null) + { + throw new ArgumentNullException("failureMechanism"); + } + + var observables = new List(); + + failureMechanism.ClearAllSections(); + observables.Add(failureMechanism); + + failureMechanism.CalculationsGroup.Children.Clear(); + observables.Add(failureMechanism.CalculationsGroup); + + failureMechanism.DikeProfiles.Clear(); + observables.Add(failureMechanism.DikeProfiles); + + return observables; + } + private static void ClearHydraulicBoundaryLocation(GrassCoverErosionInwardsCalculation calculation) { calculation.InputParameters.HydraulicBoundaryLocation = null;