Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -rbf926725b3c2994fb1f2d7c8b4294ab66691b3d2 -r35c2e5f60d72d56ae51a816c1cb50396f76357a4 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision bf926725b3c2994fb1f2d7c8b4294ab66691b3d2) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 35c2e5f60d72d56ae51a816c1cb50396f76357a4) @@ -2477,6 +2477,18 @@ } /// + /// Looks up a localized string similar to Wanneer het kunstwerk wijzigt als gevolg van het bijwerken, zal het resultaat van deze berekening worden verwijderd. + /// + ///Weet u zeker dat u wilt doorgaan?. + /// + public static string StructuresPlugin_VerifyStructureUpdate_Confirm_calculation_output_cleared_when_updating_Structure_dependent_data { + get { + return ResourceManager.GetString("StructuresPlugin_VerifyStructureUpdate_Confirm_calculation_output_cleared_when_up" + + "dating_Structure_dependent_data", resourceCulture); + } + } + + /// /// Looks up a localized string similar to De ondergrens van de afgekapte normale verdeling.. /// public static string TruncatedNormalDistribution_LowerBoundary_Description { Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx =================================================================== diff -u -rbf926725b3c2994fb1f2d7c8b4294ab66691b3d2 -r35c2e5f60d72d56ae51a816c1cb50396f76357a4 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision bf926725b3c2994fb1f2d7c8b4294ab66691b3d2) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 35c2e5f60d72d56ae51a816c1cb50396f76357a4) @@ -959,4 +959,9 @@ &Bijwerken kunstwerk + + Wanneer het kunstwerk wijzigt als gevolg van het bijwerken, zal het resultaat van deze berekening worden verwijderd. + +Weet u zeker dat u wilt doorgaan? + \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs =================================================================== diff -u -rb9a43faf0727b7a5a1911034afdfd498f872770d -r35c2e5f60d72d56ae51a816c1cb50396f76357a4 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision b9a43faf0727b7a5a1911034afdfd498f872770d) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision 35c2e5f60d72d56ae51a816c1cb50396f76357a4) @@ -889,10 +889,8 @@ RoundedDouble currentDikeHeight = inputParameters.DikeHeight; bool currentUseForeshore = inputParameters.UseForeshore; - DikeProfile currentDikeProfile = inputParameters.DikeProfile; - // Reapply the dike profile will update the derived inputs - inputParameters.DikeProfile = currentDikeProfile; + inputParameters.DikeProfile = inputParameters.DikeProfile; var affectedObjects = new List(); if (IsDerivedInputUpdated(currentUseBreakWater, Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs =================================================================== diff -u -rbf926725b3c2994fb1f2d7c8b4294ab66691b3d2 -r35c2e5f60d72d56ae51a816c1cb50396f76357a4 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision bf926725b3c2994fb1f2d7c8b4294ab66691b3d2) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 35c2e5f60d72d56ae51a816c1cb50396f76357a4) @@ -25,8 +25,10 @@ using System.Linq; using System.Windows.Forms; using Core.Common.Base; +using Core.Common.Base.Data; using Core.Common.Base.IO; using Core.Common.Controls.TreeView; +using Core.Common.Gui; using Core.Common.Gui.ContextMenu; using Core.Common.Gui.Forms.ProgressDialog; using Core.Common.Gui.Plugin; @@ -35,6 +37,7 @@ using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.Probabilistics; using Ringtoets.Common.Data.Probability; using Ringtoets.Common.Data.Structures; using Ringtoets.Common.Forms; @@ -780,9 +783,83 @@ private void UpdateStructureDependentDataOfCalculation(StructuresCalculation calculation) { - // TODO: Implement + string message = + RingtoetsCommonFormsResources.StructuresPlugin_VerifyStructureUpdate_Confirm_calculation_output_cleared_when_updating_Structure_dependent_data; + if (StructureDependentDataShouldUpdate(new[] + { + calculation + }, message)) + { + UpdateStructureDerivedCalculationInput(calculation); + } } + private bool StructureDependentDataShouldUpdate(IEnumerable> calculations, string query) + { + var changeHandler = new CalculationChangeHandler(calculations, + query, + new DialogBasedInquiryHelper(Gui.MainWindow)); + + return !changeHandler.RequireConfirmation() || changeHandler.InquireConfirmation(); + } + + private static void UpdateStructureDerivedCalculationInput(StructuresCalculation calculation) + { + HeightStructuresInput inputParameters = calculation.InputParameters; + + RoundedDouble currentStructureNormalOrientation = inputParameters.StructureNormalOrientation; + NormalDistribution currentLevelCrestStructure = inputParameters.LevelCrestStructure; + LogNormalDistribution currentFlowWidthAtBottomProtection = inputParameters.FlowWidthAtBottomProtection; + VariationCoefficientLogNormalDistribution currentCriticalOvertoppingDischarge = inputParameters.CriticalOvertoppingDischarge; + NormalDistribution currentWidthFlowApertures = inputParameters.WidthFlowApertures; + double currentFailureProbabilityStructureWithErosion = inputParameters.FailureProbabilityStructureWithErosion; + VariationCoefficientLogNormalDistribution currentStorageStructureArea = inputParameters.StorageStructureArea; + LogNormalDistribution currentAllowedLevelIncreaseStorage = inputParameters.AllowedLevelIncreaseStorage; + + // Reapply the structure will update the derived inputs + inputParameters.Structure = inputParameters.Structure; + + var affectedObjects = new List(); + if (IsDerivedInputUpdated(currentStructureNormalOrientation, + currentLevelCrestStructure, + currentFlowWidthAtBottomProtection, + currentCriticalOvertoppingDischarge, + currentWidthFlowApertures, + currentFailureProbabilityStructureWithErosion, + currentStorageStructureArea, + currentAllowedLevelIncreaseStorage, + inputParameters)) + { + affectedObjects.Add(inputParameters); + affectedObjects.AddRange(RingtoetsCommonDataSynchronizationService.ClearCalculationOutput(calculation)); + } + + foreach (IObservable affectedObject in affectedObjects) + { + affectedObject.NotifyObservers(); + } + } + + private static bool IsDerivedInputUpdated(RoundedDouble currentStructureNormalOrientation, + NormalDistribution currentLevelCrestStructure, + LogNormalDistribution currentFlowWidthAtBottomProtection, + VariationCoefficientLogNormalDistribution currentCriticalOvertoppingDischarge, + NormalDistribution currentWidthFlowApertures, + double currentFailureProbabilityStructureWithErosion, + VariationCoefficientLogNormalDistribution currentStorageStructureArea, + LogNormalDistribution currentAllowedLevelIncreaseStorage, + HeightStructuresInput actualInput) + { + return !Equals(currentStructureNormalOrientation, actualInput.StructureNormalOrientation) + || !Equals(currentLevelCrestStructure, actualInput.LevelCrestStructure) + || !Equals(currentFlowWidthAtBottomProtection, actualInput.FlowWidthAtBottomProtection) + || !Equals(currentCriticalOvertoppingDischarge, actualInput.CriticalOvertoppingDischarge) + || !Equals(currentWidthFlowApertures, actualInput.WidthFlowApertures) + || !Equals(currentFailureProbabilityStructureWithErosion, actualInput.FailureProbabilityStructureWithErosion) + || !Equals(currentStorageStructureArea, actualInput.StorageStructureArea) + || !Equals(currentAllowedLevelIncreaseStorage, actualInput.AllowedLevelIncreaseStorage); + } + #endregion #endregion