Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -rb5accd775c390fa85f815ef13c3c3e54a6d10ada -rcc8077f0d935a92dd18a5d551788e3548645a5d2 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision b5accd775c390fa85f815ef13c3c3e54a6d10ada) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision cc8077f0d935a92dd18a5d551788e3548645a5d2) @@ -46,6 +46,7 @@ using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Probability; +using Ringtoets.Common.Data.Structures; using Ringtoets.Common.Forms.GuiServices; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Forms.PropertyClasses; @@ -855,10 +856,10 @@ IFailureMechanism failureMechanism = parentContext.ParentFailureMechanism; return failureMechanism is StabilityStoneCoverFailureMechanism || failureMechanism is WaveImpactAsphaltCoverFailureMechanism || - failureMechanism is GrassCoverErosionOutwardsFailureMechanism /*|| - failureMechanism is HeightStructuresFailureMechanism || - failureMechanism is ClosingStructuresFailureMechanism || - failureMechanism is StabilityPointStructuresFailureMechanism*/; + failureMechanism is GrassCoverErosionOutwardsFailureMechanism || + failureMechanism is HeightStructuresFailureMechanism || + failureMechanism is ClosingStructuresFailureMechanism || + failureMechanism is StabilityPointStructuresFailureMechanism; } private void OnForeshoreProfileRemoved(ForeshoreProfile nodeData, object parentNodeData) @@ -881,14 +882,29 @@ { OnGrassCoverErosionOutwardsForeshoreProfileRemoved(nodeData, parentContext.WrappedData, grassCoverErosionOutwardsFailureMechanism); } + var heightStructuresFailureMechanism = failureMechanism as HeightStructuresFailureMechanism; + if (heightStructuresFailureMechanism != null) + { + OnHeightStructuresForeshoreProfileRemoved(nodeData, parentContext.WrappedData, heightStructuresFailureMechanism); + } + var closingStructuresFailureMechanism = failureMechanism as ClosingStructuresFailureMechanism; + if (closingStructuresFailureMechanism != null) + { + OnClosingStructuresForeshoreProfileRemoved(nodeData, parentContext.WrappedData, closingStructuresFailureMechanism); + } + var stabilityPointStructuresFailureMechanism = failureMechanism as StabilityPointStructuresFailureMechanism; + if (stabilityPointStructuresFailureMechanism != null) + { + OnStabilityPointStructuresForeshoreProfileRemoved(nodeData, parentContext.WrappedData, stabilityPointStructuresFailureMechanism); + } } private static void OnStabilityStoneCoverForeshoreProfileRemoved(ForeshoreProfile nodeData, ObservableList foreshoreProfiles, StabilityStoneCoverFailureMechanism failureMechanism) { var changedObservables = new List(); StabilityStoneCoverWaveConditionsCalculation[] calculations = failureMechanism.Calculations - .Cast() - .ToArray(); + .Cast() + .ToArray(); StabilityStoneCoverWaveConditionsCalculation[] calculationWithRemovedForeshoreProfile = calculations .Where(c => ReferenceEquals(c.InputParameters.ForeshoreProfile, nodeData)) .ToArray(); @@ -911,8 +927,8 @@ { var changedObservables = new List(); WaveImpactAsphaltCoverWaveConditionsCalculation[] calculations = failureMechanism.Calculations - .Cast() - .ToArray(); + .Cast() + .ToArray(); WaveImpactAsphaltCoverWaveConditionsCalculation[] calculationWithRemovedForeshoreProfile = calculations .Where(c => ReferenceEquals(c.InputParameters.ForeshoreProfile, nodeData)) .ToArray(); @@ -935,8 +951,8 @@ { var changedObservables = new List(); GrassCoverErosionOutwardsWaveConditionsCalculation[] calculations = failureMechanism.Calculations - .Cast() - .ToArray(); + .Cast() + .ToArray(); GrassCoverErosionOutwardsWaveConditionsCalculation[] calculationWithRemovedForeshoreProfile = calculations .Where(c => ReferenceEquals(c.InputParameters.ForeshoreProfile, nodeData)) .ToArray(); @@ -955,6 +971,78 @@ } } + private static void OnHeightStructuresForeshoreProfileRemoved(ForeshoreProfile nodeData, ObservableList foreshoreProfiles, HeightStructuresFailureMechanism failureMechanism) + { + var changedObservables = new List(); + StructuresCalculation[] calculations = failureMechanism.Calculations + .Cast>() + .ToArray(); + StructuresCalculation[] calculationWithRemovedForeshoreProfile = calculations + .Where(c => ReferenceEquals(c.InputParameters.ForeshoreProfile, nodeData)) + .ToArray(); + foreach (StructuresCalculation calculation in calculationWithRemovedForeshoreProfile) + { + calculation.InputParameters.ForeshoreProfile = null; + changedObservables.Add(calculation.InputParameters); + } + + foreshoreProfiles.Remove(nodeData); + changedObservables.Add(foreshoreProfiles); + + foreach (IObservable observable in changedObservables) + { + observable.NotifyObservers(); + } + } + + private static void OnClosingStructuresForeshoreProfileRemoved(ForeshoreProfile nodeData, ObservableList foreshoreProfiles, ClosingStructuresFailureMechanism failureMechanism) + { + var changedObservables = new List(); + StructuresCalculation[] calculations = failureMechanism.Calculations + .Cast>() + .ToArray(); + StructuresCalculation[] calculationWithRemovedForeshoreProfile = calculations + .Where(c => ReferenceEquals(c.InputParameters.ForeshoreProfile, nodeData)) + .ToArray(); + foreach (StructuresCalculation calculation in calculationWithRemovedForeshoreProfile) + { + calculation.InputParameters.ForeshoreProfile = null; + changedObservables.Add(calculation.InputParameters); + } + + foreshoreProfiles.Remove(nodeData); + changedObservables.Add(foreshoreProfiles); + + foreach (IObservable observable in changedObservables) + { + observable.NotifyObservers(); + } + } + + private static void OnStabilityPointStructuresForeshoreProfileRemoved(ForeshoreProfile nodeData, ObservableList foreshoreProfiles, StabilityPointStructuresFailureMechanism failureMechanism) + { + var changedObservables = new List(); + StructuresCalculation[] calculations = failureMechanism.Calculations + .Cast>() + .ToArray(); + StructuresCalculation[] calculationWithRemovedForeshoreProfile = calculations + .Where(c => ReferenceEquals(c.InputParameters.ForeshoreProfile, nodeData)) + .ToArray(); + foreach (StructuresCalculation calculation in calculationWithRemovedForeshoreProfile) + { + calculation.InputParameters.ForeshoreProfile = null; + changedObservables.Add(calculation.InputParameters); + } + + foreshoreProfiles.Remove(nodeData); + changedObservables.Add(foreshoreProfiles); + + foreach (IObservable observable in changedObservables) + { + observable.NotifyObservers(); + } + } + #endregion #region DikeProfile TreeNodeInfo