Index: Ringtoets.sln =================================================================== diff -u -r457970572d405d707ca5a96836d6a48babffc3a7 -rc3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f --- Ringtoets.sln (.../Ringtoets.sln) (revision 457970572d405d707ca5a96836d6a48babffc3a7) +++ Ringtoets.sln (.../Ringtoets.sln) (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -298,7 +298,7 @@ {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.Integration.Plugin", "Ringtoets\Integration\src\Ringtoets.Integration.Plugin\Riskeer.Integration.Plugin.csproj", "{C8383B76-B3F1-4E6E-B56C-527B469FA20A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.Integration.Plugin", "Ringtoets\Integration\src\Riskeer.Integration.Plugin\Riskeer.Integration.Plugin.csproj", "{C8383B76-B3F1-4E6E-B56C-527B469FA20A}" ProjectSection(ProjectDependencies) = postProject {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/ForeshoreProfileReplaceDataStrategy.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/ForeshoreProfileUpdateDataStrategy.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateStrategy.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateStrategy.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/MacroStabilityOutwardsFailureMechanismSectionResultUpdateStrategy.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/MicrostabilityFailureMechanismSectionResultUpdateStrategy.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/PipingStructureFailureMechanismSectionResultUpdateStrategy.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateStrategy.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/TechnicalInnovationFailureMechanismSectionResultUpdateStrategy.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateStrategy.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Handlers/AssessmentSectionCompositionChangeHandler.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Handlers/FailureMechanismContributionNormChangeHandler.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Handlers/HydraulicBoundaryDatabaseUpdateHandler.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Handlers/HydraulicLocationConfigurationDatabaseImportHandler.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Handlers/HydraulicLocationConfigurationDatabaseUpdateHandler.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Handlers/ReferenceLineUpdateHandler.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Helpers/HydraulicLocationConfigurationSettingsConstants.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Helpers/HydraulicLocationConfigurationSettingsUpdateHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionMerger.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionProvider.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionProviderException.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/IAssessmentSectionMergeHandler.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/IAssessmentSectionProvider.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/AssemblyInfo.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Resources/AssemblyResultPerSection.png =================================================================== diff -u -r9dbf7bccb39f8f0516c34a816cdec5ad669d440f -rc3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f Binary files differ Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Resources/AssemblyResultPerSectionMap.png =================================================================== diff -u -ra6d8f7c8868a573cb4026770119c5f997039ca2a -rc3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f Binary files differ Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Resources/AssemblyResultTotal.png =================================================================== diff -u -r9dbf7bccb39f8f0516c34a816cdec5ad669d440f -rc3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f Binary files differ Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Resources/Foreshore.png =================================================================== diff -u -r1dddcf22e6d496a00dcfe85cf8d1302a8df121cd -rc3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f Binary files differ Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsRibbon.xaml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsRibbon.xaml.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Riskeer.Integration.Plugin.csproj'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Plugin/packages.config'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/ForeshoreProfileReplaceDataStrategy.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/ForeshoreProfileReplaceDataStrategy.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/ForeshoreProfileReplaceDataStrategy.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,70 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Core.Common.Base; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.UpdateDataStrategies; +using Ringtoets.Common.IO.FileImporters; +using Riskeer.Integration.Service; + +namespace Riskeer.Integration.Plugin.FileImporters +{ + /// + /// A + /// to replace foreshore profiles with imported foreshore profiles. + /// + public class ForeshoreProfileReplaceDataStrategy : ReplaceDataStrategyBase, + IForeshoreProfileUpdateDataStrategy + { + private readonly ForeshoreProfileCollection foreshoreProfileCollection; + + /// + /// Initializes a . + /// + /// The failure mechanism in which the foreshore + /// profiles are updated. + /// The collection containing the foreshore profiles. + /// Thrown when any parameter + /// is null. + public ForeshoreProfileReplaceDataStrategy(IFailureMechanism failureMechanism, ForeshoreProfileCollection foreshoreProfiles) + : base(failureMechanism, foreshoreProfiles) + { + foreshoreProfileCollection = foreshoreProfiles; + } + + public IEnumerable UpdateForeshoreProfilesWithImportedData(IEnumerable importedDataCollection, string sourceFilePath) + { + return ReplaceTargetCollectionWithImportedData(importedDataCollection, sourceFilePath); + } + + protected override IEnumerable ClearData() + { + IEnumerable> calculations = FailureMechanism.Calculations + .Cast>(); + return RingtoetsDataSynchronizationService.RemoveAllForeshoreProfiles(calculations, foreshoreProfileCollection); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/ForeshoreProfileUpdateDataStrategy.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/ForeshoreProfileUpdateDataStrategy.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/ForeshoreProfileUpdateDataStrategy.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,119 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Core.Common.Base; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.UpdateDataStrategies; +using Ringtoets.Common.IO.FileImporters; +using Ringtoets.Common.Service; + +namespace Riskeer.Integration.Plugin.FileImporters +{ + /// + /// An for + /// updating surface lines based on imported data. + /// + public class ForeshoreProfileUpdateDataStrategy : UpdateDataStrategyBase, + IForeshoreProfileUpdateDataStrategy + { + /// + /// Creates a new instance of . + /// + /// The failure mechanism in which the + /// are updated. + /// The foreshore profiles which will be updated. + /// Thrown when any input parameter is null. + public ForeshoreProfileUpdateDataStrategy(IFailureMechanism failureMechanism, ForeshoreProfileCollection foreshoreProfiles) + : base(failureMechanism, foreshoreProfiles, new ForeshoreProfileEqualityComparer()) {} + + public IEnumerable UpdateForeshoreProfilesWithImportedData(IEnumerable importedDataCollection, string sourceFilePath) + { + return UpdateTargetCollectionData(importedDataCollection, sourceFilePath); + } + + protected override IEnumerable RemoveObjectAndDependentData(ForeshoreProfile removedObject) + { + IEnumerable> affectedCalculations = GetAffectedCalculationWithForeshoreProfiles(removedObject); + + var affectedObjects = new List(); + foreach (ICalculation calculation in affectedCalculations) + { + ((IHasForeshoreProfile) calculation.InputParameters).ForeshoreProfile = null; + affectedObjects.Add(calculation.InputParameters); + affectedObjects.AddRange(RingtoetsCommonDataSynchronizationService.ClearCalculationOutput(calculation)); + } + + return affectedObjects; + } + + protected override IEnumerable UpdateObjectAndDependentData(ForeshoreProfile objectToUpdate, ForeshoreProfile objectToUpdateFrom) + { + objectToUpdate.CopyProperties(objectToUpdateFrom); + + var affectedObjects = new List(); + + IEnumerable> affectedCalculations = GetAffectedCalculationWithForeshoreProfiles(objectToUpdate); + + foreach (ICalculation calculation in affectedCalculations) + { + affectedObjects.Add(calculation.InputParameters); + affectedObjects.AddRange(RingtoetsCommonDataSynchronizationService.ClearCalculationOutput(calculation)); + + if (!objectToUpdate.Geometry.Any()) + { + ((IUseForeshore) calculation.InputParameters).UseForeshore = false; + } + } + + return affectedObjects; + } + + private IEnumerable> GetAffectedCalculationWithForeshoreProfiles(ForeshoreProfile foreshoreProfile) + { + IEnumerable> calculations = FailureMechanism.Calculations.Cast>(); + IEnumerable> affectedCalculations = + calculations.Where(calc => ReferenceEquals( + ((IHasForeshoreProfile) calc.InputParameters).ForeshoreProfile, foreshoreProfile)); + return affectedCalculations; + } + + /// + /// Class for comparing he only by ID. + /// + private class ForeshoreProfileEqualityComparer : IEqualityComparer + { + public bool Equals(ForeshoreProfile x, ForeshoreProfile y) + { + return x.Id.Equals(y.Id); + } + + public int GetHashCode(ForeshoreProfile obj) + { + return obj.Id.GetHashCode(); + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateStrategy.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateStrategy.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateStrategy.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,54 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.Common.IO.FileImporters; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Plugin.FileImporters +{ + /// + /// An update strategy that can be used to update a instance with data + /// from an old instance. + /// + public class GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateStrategy + : IFailureMechanismSectionResultUpdateStrategy + { + public void UpdateSectionResult(GrassCoverSlipOffInwardsFailureMechanismSectionResult origin, GrassCoverSlipOffInwardsFailureMechanismSectionResult target) + { + if (origin == null) + { + throw new ArgumentNullException(nameof(origin)); + } + + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + + target.SimpleAssessmentResult = origin.SimpleAssessmentResult; + target.DetailedAssessmentResult = origin.DetailedAssessmentResult; + target.TailorMadeAssessmentResult = origin.TailorMadeAssessmentResult; + target.UseManualAssembly = origin.UseManualAssembly; + target.ManualAssemblyCategoryGroup = origin.ManualAssemblyCategoryGroup; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateStrategy.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateStrategy.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateStrategy.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,54 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.Common.IO.FileImporters; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Plugin.FileImporters +{ + /// + /// An update strategy that can be used to update a instance with data + /// from an old instance. + /// + public class GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateStrategy + : IFailureMechanismSectionResultUpdateStrategy + { + public void UpdateSectionResult(GrassCoverSlipOffOutwardsFailureMechanismSectionResult origin, GrassCoverSlipOffOutwardsFailureMechanismSectionResult target) + { + if (origin == null) + { + throw new ArgumentNullException(nameof(origin)); + } + + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + + target.SimpleAssessmentResult = origin.SimpleAssessmentResult; + target.DetailedAssessmentResult = origin.DetailedAssessmentResult; + target.TailorMadeAssessmentResult = origin.TailorMadeAssessmentResult; + target.UseManualAssembly = origin.UseManualAssembly; + target.ManualAssemblyCategoryGroup = origin.ManualAssemblyCategoryGroup; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/MacroStabilityOutwardsFailureMechanismSectionResultUpdateStrategy.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/MacroStabilityOutwardsFailureMechanismSectionResultUpdateStrategy.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/MacroStabilityOutwardsFailureMechanismSectionResultUpdateStrategy.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,56 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.Common.IO.FileImporters; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Plugin.FileImporters +{ + /// + /// An update strategy that can be used to update a instance with data + /// from an old instance. + /// + public class MacroStabilityOutwardsFailureMechanismSectionResultUpdateStrategy + : IFailureMechanismSectionResultUpdateStrategy + { + public void UpdateSectionResult(MacroStabilityOutwardsFailureMechanismSectionResult origin, MacroStabilityOutwardsFailureMechanismSectionResult target) + { + if (origin == null) + { + throw new ArgumentNullException(nameof(origin)); + } + + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + + target.SimpleAssessmentResult = origin.SimpleAssessmentResult; + target.DetailedAssessmentResult = origin.DetailedAssessmentResult; + target.DetailedAssessmentProbability = origin.DetailedAssessmentProbability; + target.TailorMadeAssessmentResult = origin.TailorMadeAssessmentResult; + target.TailorMadeAssessmentProbability = origin.TailorMadeAssessmentProbability; + target.UseManualAssembly = origin.UseManualAssembly; + target.ManualAssemblyCategoryGroup = origin.ManualAssemblyCategoryGroup; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/MicrostabilityFailureMechanismSectionResultUpdateStrategy.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/MicrostabilityFailureMechanismSectionResultUpdateStrategy.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/MicrostabilityFailureMechanismSectionResultUpdateStrategy.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,54 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.Common.IO.FileImporters; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Plugin.FileImporters +{ + /// + /// An update strategy that can be used to update a instance with data + /// from an old instance. + /// + public class MicrostabilityFailureMechanismSectionResultUpdateStrategy + : IFailureMechanismSectionResultUpdateStrategy + { + public void UpdateSectionResult(MicrostabilityFailureMechanismSectionResult origin, MicrostabilityFailureMechanismSectionResult target) + { + if (origin == null) + { + throw new ArgumentNullException(nameof(origin)); + } + + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + + target.SimpleAssessmentResult = origin.SimpleAssessmentResult; + target.DetailedAssessmentResult = origin.DetailedAssessmentResult; + target.TailorMadeAssessmentResult = origin.TailorMadeAssessmentResult; + target.UseManualAssembly = origin.UseManualAssembly; + target.ManualAssemblyCategoryGroup = origin.ManualAssemblyCategoryGroup; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/PipingStructureFailureMechanismSectionResultUpdateStrategy.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/PipingStructureFailureMechanismSectionResultUpdateStrategy.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/PipingStructureFailureMechanismSectionResultUpdateStrategy.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,54 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.Common.IO.FileImporters; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Plugin.FileImporters +{ + /// + /// An update strategy that can be used to update a instance with data + /// from an old instance. + /// + public class PipingStructureFailureMechanismSectionResultUpdateStrategy + : IFailureMechanismSectionResultUpdateStrategy + { + public void UpdateSectionResult(PipingStructureFailureMechanismSectionResult origin, PipingStructureFailureMechanismSectionResult target) + { + if (origin == null) + { + throw new ArgumentNullException(nameof(origin)); + } + + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + + target.SimpleAssessmentResult = origin.SimpleAssessmentResult; + target.DetailedAssessmentResult = origin.DetailedAssessmentResult; + target.TailorMadeAssessmentResult = origin.TailorMadeAssessmentResult; + target.UseManualAssembly = origin.UseManualAssembly; + target.ManualAssemblyCategoryGroup = origin.ManualAssemblyCategoryGroup; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateStrategy.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateStrategy.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateStrategy.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,53 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.Common.IO.FileImporters; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Plugin.FileImporters +{ + /// + /// An update strategy that can be used to update a instance with data + /// from an old instance. + /// + public class StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateStrategy + : IFailureMechanismSectionResultUpdateStrategy + { + public void UpdateSectionResult(StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult origin, StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult target) + { + if (origin == null) + { + throw new ArgumentNullException(nameof(origin)); + } + + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + + target.SimpleAssessmentResult = origin.SimpleAssessmentResult; + target.TailorMadeAssessmentResult = origin.TailorMadeAssessmentResult; + target.UseManualAssembly = origin.UseManualAssembly; + target.ManualAssemblyCategoryGroup = origin.ManualAssemblyCategoryGroup; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/TechnicalInnovationFailureMechanismSectionResultUpdateStrategy.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/TechnicalInnovationFailureMechanismSectionResultUpdateStrategy.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/TechnicalInnovationFailureMechanismSectionResultUpdateStrategy.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,53 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.Common.IO.FileImporters; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Plugin.FileImporters +{ + /// + /// An update strategy that can be used to update a instance with data + /// from an old instance. + /// + public class TechnicalInnovationFailureMechanismSectionResultUpdateStrategy + : IFailureMechanismSectionResultUpdateStrategy + { + public void UpdateSectionResult(TechnicalInnovationFailureMechanismSectionResult origin, TechnicalInnovationFailureMechanismSectionResult target) + { + if (origin == null) + { + throw new ArgumentNullException(nameof(origin)); + } + + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + + target.SimpleAssessmentResult = origin.SimpleAssessmentResult; + target.TailorMadeAssessmentResult = origin.TailorMadeAssessmentResult; + target.UseManualAssembly = origin.UseManualAssembly; + target.ManualAssemblyCategoryGroup = origin.ManualAssemblyCategoryGroup; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateStrategy.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateStrategy.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/FileImporters/WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateStrategy.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,53 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.Common.IO.FileImporters; +using Riskeer.Integration.Data.StandAlone.SectionResults; + +namespace Riskeer.Integration.Plugin.FileImporters +{ + /// + /// An update strategy that can be used to update a instance with data + /// from an old instance. + /// + public class WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateStrategy + : IFailureMechanismSectionResultUpdateStrategy + { + public void UpdateSectionResult(WaterPressureAsphaltCoverFailureMechanismSectionResult origin, WaterPressureAsphaltCoverFailureMechanismSectionResult target) + { + if (origin == null) + { + throw new ArgumentNullException(nameof(origin)); + } + + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + + target.SimpleAssessmentResult = origin.SimpleAssessmentResult; + target.TailorMadeAssessmentResult = origin.TailorMadeAssessmentResult; + target.UseManualAssembly = origin.UseManualAssembly; + target.ManualAssemblyCategoryGroup = origin.ManualAssemblyCategoryGroup; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/AssessmentSectionCompositionChangeHandler.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/AssessmentSectionCompositionChangeHandler.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/AssessmentSectionCompositionChangeHandler.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,170 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Base; +using Core.Common.Gui.Commands; +using Core.Common.Util; +using log4net; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.DuneErosion.Data; +using Ringtoets.StabilityStoneCover.Data; +using Ringtoets.WaveImpactAsphaltCover.Data; +using Riskeer.Integration.Forms.PropertyClasses; +using Riskeer.Integration.Plugin.Properties; +using Riskeer.Integration.Service; +using CoreCommonBaseResources = Core.Common.Base.Properties.Resources; + +namespace Riskeer.Integration.Plugin.Handlers +{ + /// + /// Class responsible for changing the + /// value clearing all data dependent on the original composition value. + /// + public class AssessmentSectionCompositionChangeHandler : IAssessmentSectionCompositionChangeHandler + { + private readonly IViewCommands viewCommands; + private readonly ILog log = LogManager.GetLogger(typeof(AssessmentSectionCompositionChangeHandler)); + + /// + /// Creates a new instance of . + /// + /// The view commands used to close views for irrelevant + /// failure mechanisms. + /// Thrown when + /// is null. + public AssessmentSectionCompositionChangeHandler(IViewCommands viewCommands) + { + if (viewCommands == null) + { + throw new ArgumentNullException(nameof(viewCommands)); + } + + this.viewCommands = viewCommands; + } + + public bool ConfirmCompositionChange() + { + DialogResult result = MessageBox.Show(Resources.AssessmentSectionCompositionChangeHandler_Confirm_change_composition_and_clear_dependent_data, + CoreCommonBaseResources.Confirm, + MessageBoxButtons.OKCancel); + return result == DialogResult.OK; + } + + public IEnumerable ChangeComposition(IAssessmentSection assessmentSection, AssessmentSectionComposition newComposition) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + Dictionary oldFailureMechanismContributions = assessmentSection.GetFailureMechanisms().ToDictionary(f => f, f => f.Contribution, new ReferenceEqualityComparer()); + Dictionary oldFailureMechanismRelevancies = assessmentSection.GetFailureMechanisms().ToDictionary(f => f, f => f.IsRelevant, new ReferenceEqualityComparer()); + + var affectedObjects = new List(); + if (assessmentSection.Composition != newComposition) + { + assessmentSection.ChangeComposition(newComposition); + + affectedObjects.Add(assessmentSection); + affectedObjects.AddRange(assessmentSection.GetFailureMechanisms()); + + IFailureMechanism[] failureMechanismsToClearOutputFor = GetFailureMechanismsToClearOutputFor(assessmentSection, oldFailureMechanismContributions).ToArray(); + + IObservable[] affectedCalculations = + RingtoetsDataSynchronizationService.ClearFailureMechanismCalculationOutputs(failureMechanismsToClearOutputFor).ToArray(); + + if (affectedCalculations.Length > 0) + { + affectedObjects.AddRange(affectedCalculations); + log.InfoFormat(Resources.ChangeHandler_Results_of_NumberOfCalculations_0_calculations_cleared, + affectedObjects.OfType().Count()); + } + + affectedObjects.AddRange(ClearHydraulicBoundaryLocationCalculationOutput(failureMechanismsToClearOutputFor)); + + CloseViewsForIrrelevantFailureMechanisms(GetFailureMechanismsWithRelevancyUpdated(oldFailureMechanismRelevancies)); + } + + return affectedObjects; + } + + private void CloseViewsForIrrelevantFailureMechanisms(IEnumerable failureMechanisms) + { + foreach (IFailureMechanism failureMechanism in failureMechanisms.Where(fm => !fm.IsRelevant)) + { + viewCommands.RemoveAllViewsForItem(failureMechanism); + } + } + + private static IEnumerable GetFailureMechanismsWithRelevancyUpdated(IDictionary oldFailureMechanismRelevancies) + { + return oldFailureMechanismRelevancies.Where(fmr => fmr.Value != fmr.Key.IsRelevant).Select(fmr => fmr.Key); + } + + private static IEnumerable GetFailureMechanismsToClearOutputFor(IAssessmentSection assessmentSection, + IDictionary oldFailureMechanismContributions) + { + var failureMechanismsToClearOutputFor = new List(); + foreach (IFailureMechanism failureMechanism in assessmentSection.GetFailureMechanisms()) + { + if (failureMechanism is StabilityStoneCoverFailureMechanism || failureMechanism is WaveImpactAsphaltCoverFailureMechanism) + { + continue; + } + + if (failureMechanism is DuneErosionFailureMechanism) + { + failureMechanismsToClearOutputFor.Add(failureMechanism); + } + + if (oldFailureMechanismContributions.ContainsKey(failureMechanism)) + { + double oldContribution = oldFailureMechanismContributions[failureMechanism]; + if (Math.Abs(oldContribution) > 1e-6 && Math.Abs(oldContribution - failureMechanism.Contribution) > 1e-6) + { + failureMechanismsToClearOutputFor.Add(failureMechanism); + } + } + } + + return failureMechanismsToClearOutputFor; + } + + private IEnumerable ClearHydraulicBoundaryLocationCalculationOutput(IEnumerable failureMechanismsToClearOutputFor) + { + IEnumerable affectedObjects = + RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationCalculationOutputOfFailureMechanisms(failureMechanismsToClearOutputFor); + if (affectedObjects.Any()) + { + log.Info(Resources.AssessmentSectionCompositionChangeHandler_Waveheight_and_design_water_level_results_cleared); + return affectedObjects; + } + + return Enumerable.Empty(); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/FailureMechanismContributionNormChangeHandler.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/FailureMechanismContributionNormChangeHandler.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/FailureMechanismContributionNormChangeHandler.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,120 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Base; +using log4net; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.Contribution; +using Ringtoets.Common.Forms.PropertyClasses; +using Riskeer.Integration.Plugin.Properties; +using Riskeer.Integration.Service; +using CoreCommonBaseResources = Core.Common.Base.Properties.Resources; + +namespace Riskeer.Integration.Plugin.Handlers +{ + /// + /// Class responsible for changing the + /// value of the of an + /// and clearing all data dependent on the original norm value. + /// + public class FailureMechanismContributionNormChangeHandler : IObservablePropertyChangeHandler + { + private readonly IAssessmentSection assessmentSection; + private readonly ILog log = LogManager.GetLogger(typeof(FailureMechanismContributionNormChangeHandler)); + + /// + /// Creates a new instance of . + /// + /// The assessment section to change the contribution norm for. + /// Thrown when + /// is null. + public FailureMechanismContributionNormChangeHandler(IAssessmentSection assessmentSection) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + this.assessmentSection = assessmentSection; + } + + public IEnumerable SetPropertyValueAfterConfirmation(SetObservablePropertyValueDelegate setValue) + { + if (setValue == null) + { + throw new ArgumentNullException(nameof(setValue)); + } + + var affectedObjects = new List(); + + if (ConfirmPropertyChange()) + { + setValue(); + + affectedObjects.AddRange(ClearAllNormDependentCalculationOutput()); + affectedObjects.Add(assessmentSection.FailureMechanismContribution); + affectedObjects.AddRange(assessmentSection.GetFailureMechanisms()); + } + + return affectedObjects; + } + + private static bool ConfirmPropertyChange() + { + DialogResult result = MessageBox.Show(Resources.FailureMechanismContributionNormChangeHandler_Confirm_change_norm_and_clear_dependent_data, + CoreCommonBaseResources.Confirm, + MessageBoxButtons.OKCancel); + return result == DialogResult.OK; + } + + private IEnumerable ClearAllNormDependentCalculationOutput() + { + List affectedObjects = RingtoetsDataSynchronizationService.ClearFailureMechanismCalculationOutputs(assessmentSection).ToList(); + if (affectedObjects.Count > 0) + { + log.InfoFormat(Resources.ChangeHandler_Results_of_NumberOfCalculations_0_calculations_cleared, + affectedObjects.OfType().Count()); + } + + affectedObjects.AddRange(ClearAllHydraulicBoundaryLocationCalculationOutput()); + + return affectedObjects; + } + + private IEnumerable ClearAllHydraulicBoundaryLocationCalculationOutput() + { + IEnumerable affectedObjects = RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationCalculationOutput(assessmentSection); + + if (affectedObjects.Any()) + { + log.Info(Resources.FailureMechanismContributionNormChangeHandler_Waveheight_and_design_water_level_results_cleared); + return affectedObjects; + } + + return Enumerable.Empty(); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicBoundaryDatabaseUpdateHandler.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicBoundaryDatabaseUpdateHandler.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicBoundaryDatabaseUpdateHandler.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,241 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Base; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.DuneErosion.Plugin.Handlers; +using Riskeer.HydraRing.IO.HydraulicBoundaryDatabase; +using Riskeer.HydraRing.IO.HydraulicLocationConfigurationDatabase; +using Riskeer.Integration.Data; +using Riskeer.Integration.IO.Handlers; +using Riskeer.Integration.Plugin.Helpers; +using Riskeer.Integration.Plugin.Properties; +using Riskeer.Integration.Service; +using CoreCommonBaseResources = Core.Common.Base.Properties.Resources; + +namespace Riskeer.Integration.Plugin.Handlers +{ + /// + /// Class that can properly update a . + /// + public class HydraulicBoundaryDatabaseUpdateHandler : IHydraulicBoundaryDatabaseUpdateHandler + { + private readonly AssessmentSection assessmentSection; + private readonly IDuneLocationsReplacementHandler duneLocationsReplacementHandler; + private bool updateLocations; + + /// + /// Creates a new instance of . + /// + /// The assessment section to update for. + /// The handler to replace dune locations. + /// Thrown when any parameter is null. + public HydraulicBoundaryDatabaseUpdateHandler(AssessmentSection assessmentSection, + IDuneLocationsReplacementHandler duneLocationsReplacementHandler) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + if (duneLocationsReplacementHandler == null) + { + throw new ArgumentNullException(nameof(duneLocationsReplacementHandler)); + } + + this.assessmentSection = assessmentSection; + this.duneLocationsReplacementHandler = duneLocationsReplacementHandler; + } + + public bool IsConfirmationRequired(HydraulicBoundaryDatabase hydraulicBoundaryDatabase, ReadHydraulicBoundaryDatabase readHydraulicBoundaryDatabase) + { + if (hydraulicBoundaryDatabase == null) + { + throw new ArgumentNullException(nameof(hydraulicBoundaryDatabase)); + } + + if (readHydraulicBoundaryDatabase == null) + { + throw new ArgumentNullException(nameof(readHydraulicBoundaryDatabase)); + } + + return hydraulicBoundaryDatabase.IsLinked() && hydraulicBoundaryDatabase.Version != readHydraulicBoundaryDatabase.Version; + } + + public bool InquireConfirmation() + { + DialogResult result = MessageBox.Show(Resources.HydraulicBoundaryDatabaseUpdateHandler_Confirm_clear_hydraulicBoundaryDatabase_dependent_data, + CoreCommonBaseResources.Confirm, + MessageBoxButtons.OKCancel); + return result == DialogResult.OK; + } + + public IEnumerable Update(HydraulicBoundaryDatabase hydraulicBoundaryDatabase, ReadHydraulicBoundaryDatabase readHydraulicBoundaryDatabase, + ReadHydraulicLocationConfigurationDatabase readHydraulicLocationConfigurationDatabase, + IEnumerable excludedLocationIds, string hydraulicBoundaryDatabaseFilePath, string hlcdFilePath) + { + if (hydraulicBoundaryDatabase == null) + { + throw new ArgumentNullException(nameof(hydraulicBoundaryDatabase)); + } + + if (readHydraulicBoundaryDatabase == null) + { + throw new ArgumentNullException(nameof(readHydraulicBoundaryDatabase)); + } + + if (readHydraulicLocationConfigurationDatabase == null) + { + throw new ArgumentNullException(nameof(readHydraulicLocationConfigurationDatabase)); + } + + if (excludedLocationIds == null) + { + throw new ArgumentNullException(nameof(excludedLocationIds)); + } + + if (hydraulicBoundaryDatabaseFilePath == null) + { + throw new ArgumentNullException(nameof(hydraulicBoundaryDatabaseFilePath)); + } + + if (hlcdFilePath == null) + { + throw new ArgumentNullException(nameof(hlcdFilePath)); + } + + if (!IsValidReadHydraulicLocationConfigurationDatabase(readHydraulicLocationConfigurationDatabase)) + { + string errorMessage = $"{nameof(readHydraulicLocationConfigurationDatabase)} must be null or contain exactly one item for " + + "the collection of hydraulic location configuration database settings."; + throw new ArgumentException(errorMessage); + } + + var changedObjects = new List(); + + updateLocations = !hydraulicBoundaryDatabase.IsLinked() || hydraulicBoundaryDatabase.Version != readHydraulicBoundaryDatabase.Version; + + if (updateLocations) + { + hydraulicBoundaryDatabase.FilePath = hydraulicBoundaryDatabaseFilePath; + hydraulicBoundaryDatabase.Version = readHydraulicBoundaryDatabase.Version; + + SetLocations(hydraulicBoundaryDatabase, readHydraulicBoundaryDatabase.Locations, + readHydraulicLocationConfigurationDatabase.LocationIdMappings, + excludedLocationIds.ToArray()); + + assessmentSection.SetHydraulicBoundaryLocationCalculations(hydraulicBoundaryDatabase.Locations); + assessmentSection.GrassCoverErosionOutwards.SetHydraulicBoundaryLocationCalculations(hydraulicBoundaryDatabase.Locations); + + duneLocationsReplacementHandler.Replace(hydraulicBoundaryDatabase.Locations); + + changedObjects.AddRange(GetLocationsAndCalculationsObservables(hydraulicBoundaryDatabase)); + changedObjects.AddRange(RingtoetsDataSynchronizationService.ClearAllCalculationOutputAndHydraulicBoundaryLocations(assessmentSection)); + } + else + { + if (hydraulicBoundaryDatabase.FilePath != hydraulicBoundaryDatabaseFilePath) + { + hydraulicBoundaryDatabase.FilePath = hydraulicBoundaryDatabaseFilePath; + } + } + + HydraulicLocationConfigurationSettingsUpdateHelper.SetHydraulicLocationConfigurationSettings(hydraulicBoundaryDatabase.HydraulicLocationConfigurationSettings, + readHydraulicLocationConfigurationDatabase.ReadHydraulicLocationConfigurationDatabaseSettings?.Single(), + hlcdFilePath); + + return changedObjects; + } + + public void DoPostUpdateActions() + { + if (updateLocations) + { + duneLocationsReplacementHandler.DoPostReplacementUpdates(); + } + } + + private static bool IsValidReadHydraulicLocationConfigurationDatabase(ReadHydraulicLocationConfigurationDatabase readHydraulicLocationConfigurationDatabase) + { + return readHydraulicLocationConfigurationDatabase.ReadHydraulicLocationConfigurationDatabaseSettings == null + || readHydraulicLocationConfigurationDatabase.ReadHydraulicLocationConfigurationDatabaseSettings.Count() == 1; + } + + private IEnumerable GetLocationsAndCalculationsObservables(HydraulicBoundaryDatabase hydraulicBoundaryDatabase) + { + return new IObservable[] + { + hydraulicBoundaryDatabase.Locations, + assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm, + assessmentSection.WaterLevelCalculationsForSignalingNorm, + assessmentSection.WaterLevelCalculationsForLowerLimitNorm, + assessmentSection.WaterLevelCalculationsForFactorizedLowerLimitNorm, + assessmentSection.WaveHeightCalculationsForFactorizedSignalingNorm, + assessmentSection.WaveHeightCalculationsForSignalingNorm, + assessmentSection.WaveHeightCalculationsForLowerLimitNorm, + assessmentSection.WaveHeightCalculationsForFactorizedLowerLimitNorm, + assessmentSection.GrassCoverErosionOutwards.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm, + assessmentSection.GrassCoverErosionOutwards.WaterLevelCalculationsForMechanismSpecificSignalingNorm, + assessmentSection.GrassCoverErosionOutwards.WaterLevelCalculationsForMechanismSpecificLowerLimitNorm, + assessmentSection.GrassCoverErosionOutwards.WaveHeightCalculationsForMechanismSpecificFactorizedSignalingNorm, + assessmentSection.GrassCoverErosionOutwards.WaveHeightCalculationsForMechanismSpecificSignalingNorm, + assessmentSection.GrassCoverErosionOutwards.WaveHeightCalculationsForMechanismSpecificLowerLimitNorm, + assessmentSection.DuneErosion.DuneLocations, + assessmentSection.DuneErosion.CalculationsForMechanismSpecificFactorizedSignalingNorm, + assessmentSection.DuneErosion.CalculationsForMechanismSpecificSignalingNorm, + assessmentSection.DuneErosion.CalculationsForMechanismSpecificLowerLimitNorm, + assessmentSection.DuneErosion.CalculationsForLowerLimitNorm, + assessmentSection.DuneErosion.CalculationsForFactorizedLowerLimitNorm + }; + } + + private static void SetLocations(HydraulicBoundaryDatabase hydraulicBoundaryDatabase, IEnumerable readLocations, + IEnumerable locationIdMappings, long[] excludedLocationIds) + { + hydraulicBoundaryDatabase.Locations.Clear(); + + Array.Sort(excludedLocationIds); + + foreach (ReadHydraulicBoundaryLocation readLocation in readLocations) + { + long locationConfigurationId = locationIdMappings.Where(m => m.HrdLocationId == readLocation.Id) + .Select(m => m.HlcdLocationId) + .SingleOrDefault(); + + if (locationConfigurationId != 0 && ShouldInclude(excludedLocationIds, locationConfigurationId)) + { + hydraulicBoundaryDatabase.Locations.Add(new HydraulicBoundaryLocation(locationConfigurationId, readLocation.Name, + readLocation.CoordinateX, readLocation.CoordinateY)); + } + } + } + + private static bool ShouldInclude(long[] excludedLocationIds, long locationId) + { + int matchingIndex = Array.BinarySearch(excludedLocationIds, locationId); + return matchingIndex < 0; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicLocationConfigurationDatabaseImportHandler.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicLocationConfigurationDatabaseImportHandler.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicLocationConfigurationDatabaseImportHandler.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,95 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Windows.Forms; +using Core.Common.Base.Service; +using Core.Common.Gui.Forms.ProgressDialog; +using Ringtoets.Common.Data.Hydraulics; +using Riskeer.Integration.Forms.PropertyClasses; +using Riskeer.Integration.IO.Handlers; +using Riskeer.Integration.IO.Importers; +using Riskeer.Integration.Plugin.Properties; + +namespace Riskeer.Integration.Plugin.Handlers +{ + /// + /// Class that can properly import . + /// + public class HydraulicLocationConfigurationDatabaseImportHandler : IHydraulicLocationConfigurationDatabaseImportHandler + { + private readonly IWin32Window viewParent; + private readonly IHydraulicLocationConfigurationDatabaseUpdateHandler updateHandler; + private readonly HydraulicBoundaryDatabase hydraulicBoundaryDatabase; + + /// + /// Creates a new instance of . + /// + /// The parent of the view. + /// The object responsible for updating the . + /// The hydraulic boundary database to import the data to. + /// Thrown when any argument is null. + public HydraulicLocationConfigurationDatabaseImportHandler(IWin32Window viewParent, + IHydraulicLocationConfigurationDatabaseUpdateHandler updateHandler, + HydraulicBoundaryDatabase hydraulicBoundaryDatabase) + { + if (viewParent == null) + { + throw new ArgumentNullException(nameof(viewParent)); + } + + if (updateHandler == null) + { + throw new ArgumentNullException(nameof(updateHandler)); + } + + if (hydraulicBoundaryDatabase == null) + { + throw new ArgumentNullException(nameof(hydraulicBoundaryDatabase)); + } + + this.viewParent = viewParent; + this.updateHandler = updateHandler; + this.hydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + } + + public void ImportHydraulicLocationConfigurationSettings(HydraulicLocationConfigurationSettings hydraulicLocationConfigurationSettings, string hlcdFilePath) + { + if (hydraulicLocationConfigurationSettings == null) + { + throw new ArgumentNullException(nameof(hydraulicLocationConfigurationSettings)); + } + + if (hlcdFilePath == null) + { + throw new ArgumentNullException(nameof(hlcdFilePath)); + } + + var importSettingsActivity = new FileImportActivity( + new HydraulicLocationConfigurationDatabaseImporter(hydraulicLocationConfigurationSettings, + updateHandler, + hydraulicBoundaryDatabase, + hlcdFilePath), + Resources.HydraulicLocationConfigurationDatabaseImportHandler_ImportHydraulicLocationConfigurationSettings_Description); + ActivityProgressDialogRunner.Run(viewParent, importSettingsActivity); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicLocationConfigurationDatabaseUpdateHandler.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicLocationConfigurationDatabaseUpdateHandler.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/HydraulicLocationConfigurationDatabaseUpdateHandler.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,97 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using Core.Common.Base; +using Ringtoets.Common.Data.Hydraulics; +using Riskeer.HydraRing.IO.HydraulicLocationConfigurationDatabase; +using Riskeer.Integration.Data; +using Riskeer.Integration.IO.Handlers; +using Riskeer.Integration.Plugin.Helpers; +using Riskeer.Integration.Plugin.Properties; +using Riskeer.Integration.Service; +using CoreCommonBaseResources = Core.Common.Base.Properties.Resources; + +namespace Riskeer.Integration.Plugin.Handlers +{ + /// + /// Class that can properly update a . + /// + public class HydraulicLocationConfigurationDatabaseUpdateHandler : IHydraulicLocationConfigurationDatabaseUpdateHandler + { + private readonly AssessmentSection assessmentSection; + + /// + /// Creates a new instance of + /// + /// The assessment section to use for clearing data. + /// Thrown when + /// is null. + public HydraulicLocationConfigurationDatabaseUpdateHandler(AssessmentSection assessmentSection) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + this.assessmentSection = assessmentSection; + } + + public bool InquireConfirmation() + { + DialogResult result = MessageBox.Show(Resources.HydraulicLocationConfigurationDatabaseUpdateHandler_Confirm_clear_hydraulicLocationConfigurationDatabase_dependent_data, + CoreCommonBaseResources.Confirm, + MessageBoxButtons.OKCancel); + return result == DialogResult.OK; + } + + public IEnumerable Update(HydraulicBoundaryDatabase hydraulicBoundaryDatabase, + ReadHydraulicLocationConfigurationDatabaseSettings readHydraulicLocationConfigurationDatabaseSettings, + string hlcdFilePath) + { + if (hydraulicBoundaryDatabase == null) + { + throw new ArgumentNullException(nameof(hydraulicBoundaryDatabase)); + } + + if (hlcdFilePath == null) + { + throw new ArgumentNullException(nameof(hlcdFilePath)); + } + + HydraulicLocationConfigurationSettingsUpdateHelper.SetHydraulicLocationConfigurationSettings( + hydraulicBoundaryDatabase.HydraulicLocationConfigurationSettings, + readHydraulicLocationConfigurationDatabaseSettings, hlcdFilePath); + + var changedObjects = new List + { + hydraulicBoundaryDatabase + }; + + changedObjects.AddRange(RingtoetsDataSynchronizationService.ClearHydraulicBoundaryLocationCalculationOutput(assessmentSection)); + changedObjects.AddRange(RingtoetsDataSynchronizationService.ClearFailureMechanismCalculationOutputs(assessmentSection)); + + return changedObjects; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/ReferenceLineUpdateHandler.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/ReferenceLineUpdateHandler.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Handlers/ReferenceLineUpdateHandler.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,107 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using Core.Common.Base; +using Core.Common.Gui.Commands; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.IO.ReferenceLines; +using Ringtoets.Common.Service; +using Riskeer.Integration.Plugin.Properties; +using Riskeer.Integration.Service; +using CoreCommonBaseResources = Core.Common.Base.Properties.Resources; + +namespace Riskeer.Integration.Plugin.Handlers +{ + /// + /// Class responsible for updating a . + /// + public class ReferenceLineUpdateHandler : IReferenceLineUpdateHandler + { + private readonly IAssessmentSection assessmentSection; + private readonly IViewCommands viewCommands; + private readonly Queue removedObjects = new Queue(); + + /// + /// Creates a new instance of . + /// + /// The assessment section to remove data for. + /// The view commands used to close views for removed data. + /// Thrown when any parameter is null. + public ReferenceLineUpdateHandler(IAssessmentSection assessmentSection, IViewCommands viewCommands) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + if (viewCommands == null) + { + throw new ArgumentNullException(nameof(viewCommands)); + } + + this.assessmentSection = assessmentSection; + this.viewCommands = viewCommands; + } + + public bool ConfirmUpdate() + { + DialogResult result = MessageBox.Show(Resources.ReferenceLineUpdateHandler_Confirm_clear_referenceLine_dependent_data, + CoreCommonBaseResources.Confirm, + MessageBoxButtons.OKCancel); + return result == DialogResult.OK; + } + + public IEnumerable Update(ReferenceLine originalReferenceLine, ReferenceLine newReferenceLine) + { + if (originalReferenceLine == null) + { + throw new ArgumentNullException(nameof(originalReferenceLine)); + } + + if (newReferenceLine == null) + { + throw new ArgumentNullException(nameof(newReferenceLine)); + } + + removedObjects.Clear(); + + ClearResults results = RingtoetsDataSynchronizationService.ClearReferenceLineDependentData(assessmentSection); + foreach (object removedObject in results.RemovedObjects) + { + removedObjects.Enqueue(removedObject); + } + + originalReferenceLine.SetGeometry(newReferenceLine.Points); + return results.ChangedObjects; + } + + public void DoPostUpdateActions() + { + while (removedObjects.Count > 0) + { + viewCommands.RemoveAllViewsForItem(removedObjects.Dequeue()); + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Helpers/HydraulicLocationConfigurationSettingsConstants.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Helpers/HydraulicLocationConfigurationSettingsConstants.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Helpers/HydraulicLocationConfigurationSettingsConstants.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,36 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Ringtoets.Common.Data.Hydraulics; + +namespace Riskeer.Integration.Plugin.Helpers +{ + /// + /// Constants for dealing with . + /// + internal static class HydraulicLocationConfigurationSettingsConstants + { + internal const string MandatoryConfigurationPropertyDefaultValue = "WBI2017"; + internal const int YearDefaultValue = 2023; + internal const string OptionalConfigurationPropertyDefaultValue = "Conform WBI2017"; + internal const string AdditionalInformationConfigurationPropertyValue = "Gegenereerd door Ringtoets (conform WBI2017)"; + } +} Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Helpers/HydraulicLocationConfigurationSettingsUpdateHelper.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Helpers/HydraulicLocationConfigurationSettingsUpdateHelper.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Helpers/HydraulicLocationConfigurationSettingsUpdateHelper.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,91 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using log4net; +using Ringtoets.Common.Data.Hydraulics; +using Riskeer.HydraRing.IO.HydraulicLocationConfigurationDatabase; +using Riskeer.Integration.Plugin.Properties; + +namespace Riskeer.Integration.Plugin.Helpers +{ + /// + /// Helper class for dealing with updating + /// + public static class HydraulicLocationConfigurationSettingsUpdateHelper + { + private static readonly ILog log = LogManager.GetLogger(typeof(HydraulicLocationConfigurationSettingsUpdateHelper)); + + /// + /// Sets the hydraulic location configuration settings. + /// + /// The hydraulic location configuration settings to set on. + /// The read settings to set. + /// The hlcd file path. + /// Thrown when + /// or is null. + public static void SetHydraulicLocationConfigurationSettings(HydraulicLocationConfigurationSettings hydraulicLocationConfigurationSettings, + ReadHydraulicLocationConfigurationDatabaseSettings readHydraulicLocationConfigurationDatabaseSettings, + string hlcdFilePath) + { + if (hydraulicLocationConfigurationSettings == null) + { + throw new ArgumentNullException(nameof(hydraulicLocationConfigurationSettings)); + } + + if (hlcdFilePath == null) + { + throw new ArgumentNullException(nameof(hlcdFilePath)); + } + + if (readHydraulicLocationConfigurationDatabaseSettings != null) + { + hydraulicLocationConfigurationSettings.SetValues( + hlcdFilePath, + readHydraulicLocationConfigurationDatabaseSettings.ScenarioName, + readHydraulicLocationConfigurationDatabaseSettings.Year, + readHydraulicLocationConfigurationDatabaseSettings.Scope, + readHydraulicLocationConfigurationDatabaseSettings.SeaLevel, + readHydraulicLocationConfigurationDatabaseSettings.RiverDischarge, + readHydraulicLocationConfigurationDatabaseSettings.LakeLevel, + readHydraulicLocationConfigurationDatabaseSettings.WindDirection, + readHydraulicLocationConfigurationDatabaseSettings.WindSpeed, + readHydraulicLocationConfigurationDatabaseSettings.Comment); + } + else + { + log.Warn(Resources.HydraulicLocationConfigurationSettingsUpdateHelper_ReadHydraulicLocationConfigurationDatabaseSettings_No_ScenarioInformation_entries_present); + + hydraulicLocationConfigurationSettings.SetValues( + hlcdFilePath, + HydraulicLocationConfigurationSettingsConstants.MandatoryConfigurationPropertyDefaultValue, + HydraulicLocationConfigurationSettingsConstants.YearDefaultValue, + HydraulicLocationConfigurationSettingsConstants.MandatoryConfigurationPropertyDefaultValue, + HydraulicLocationConfigurationSettingsConstants.OptionalConfigurationPropertyDefaultValue, + HydraulicLocationConfigurationSettingsConstants.OptionalConfigurationPropertyDefaultValue, + HydraulicLocationConfigurationSettingsConstants.OptionalConfigurationPropertyDefaultValue, + HydraulicLocationConfigurationSettingsConstants.OptionalConfigurationPropertyDefaultValue, + HydraulicLocationConfigurationSettingsConstants.OptionalConfigurationPropertyDefaultValue, + HydraulicLocationConfigurationSettingsConstants.AdditionalInformationConfigurationPropertyValue); + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,400 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Core.Common.Base; +using Core.Common.Gui.Commands; +using Core.Common.Util.Extensions; +using log4net; +using Ringtoets.ClosingStructures.Data; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.Structures; +using Ringtoets.GrassCoverErosionInwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.HeightStructures.Data; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.Piping.Data; +using Ringtoets.Revetment.Data; +using Ringtoets.StabilityPointStructures.Data; +using Ringtoets.StabilityStoneCover.Data; +using Ringtoets.WaveImpactAsphaltCover.Data; +using Riskeer.Integration.Data; +using Riskeer.Integration.Data.Merge; +using Riskeer.Integration.Plugin.Properties; + +namespace Riskeer.Integration.Plugin.Merge +{ + /// + /// Class responsible for handling the merge of data. + /// + public class AssessmentSectionMergeHandler : IAssessmentSectionMergeHandler + { + private static readonly ILog log = LogManager.GetLogger(typeof(AssessmentSectionMergeHandler)); + + private readonly IViewCommands viewCommands; + + /// + /// Creates a new instance of . + /// + /// The view commands used to close views for the target + /// . + /// Thrown when + /// is null. + public AssessmentSectionMergeHandler(IViewCommands viewCommands) + { + if (viewCommands == null) + { + throw new ArgumentNullException(nameof(viewCommands)); + } + + this.viewCommands = viewCommands; + } + + public void PerformMerge(AssessmentSection targetAssessmentSection, AssessmentSectionMergeData mergeData) + { + if (targetAssessmentSection == null) + { + throw new ArgumentNullException(nameof(targetAssessmentSection)); + } + + if (mergeData == null) + { + throw new ArgumentNullException(nameof(mergeData)); + } + + BeforeMerge(targetAssessmentSection, mergeData); + + var changedObjects = new List + { + targetAssessmentSection + }; + + changedObjects.AddRange(MergeHydraulicBoundaryLocations(targetAssessmentSection, mergeData.AssessmentSection)); + MergeFailureMechanisms(targetAssessmentSection, mergeData); + + AfterMerge(changedObjects); + } + + private void BeforeMerge(AssessmentSection assessmentSection, AssessmentSectionMergeData mergeData) + { + CloseViewsForFailureMechanism(mergeData.MergePiping, assessmentSection.Piping); + CloseViewsForFailureMechanism(mergeData.MergeGrassCoverErosionInwards, assessmentSection.GrassCoverErosionInwards); + CloseViewsForFailureMechanism(mergeData.MergeMacroStabilityInwards, assessmentSection.MacroStabilityInwards); + CloseViewsForFailureMechanism(mergeData.MergeMacroStabilityOutwards, assessmentSection.MacroStabilityOutwards); + CloseViewsForFailureMechanism(mergeData.MergeMicrostability, assessmentSection.Microstability); + CloseViewsForFailureMechanism(mergeData.MergeStabilityStoneCover, assessmentSection.StabilityStoneCover); + CloseViewsForFailureMechanism(mergeData.MergeWaveImpactAsphaltCover, assessmentSection.WaveImpactAsphaltCover); + CloseViewsForFailureMechanism(mergeData.MergeWaterPressureAsphaltCover, assessmentSection.WaterPressureAsphaltCover); + CloseViewsForFailureMechanism(mergeData.MergeGrassCoverErosionOutwards, assessmentSection.GrassCoverErosionOutwards); + CloseViewsForFailureMechanism(mergeData.MergeGrassCoverSlipOffOutwards, assessmentSection.GrassCoverSlipOffOutwards); + CloseViewsForFailureMechanism(mergeData.MergeGrassCoverSlipOffInwards, assessmentSection.GrassCoverSlipOffInwards); + CloseViewsForFailureMechanism(mergeData.MergeHeightStructures, assessmentSection.HeightStructures); + CloseViewsForFailureMechanism(mergeData.MergeClosingStructures, assessmentSection.ClosingStructures); + CloseViewsForFailureMechanism(mergeData.MergePipingStructure, assessmentSection.PipingStructure); + CloseViewsForFailureMechanism(mergeData.MergeStabilityPointStructures, assessmentSection.StabilityPointStructures); + CloseViewsForFailureMechanism(mergeData.MergeStrengthStabilityLengthwiseConstruction, assessmentSection.StrengthStabilityLengthwiseConstruction); + CloseViewsForFailureMechanism(mergeData.MergeDuneErosion, assessmentSection.DuneErosion); + CloseViewsForFailureMechanism(mergeData.MergeTechnicalInnovation, assessmentSection.TechnicalInnovation); + } + + private void CloseViewsForFailureMechanism(bool shouldClose, IFailureMechanism failureMechanism) + { + if (shouldClose) + { + viewCommands.RemoveAllViewsForItem(failureMechanism); + } + } + + private static void AfterMerge(IEnumerable changedObjects) + { + changedObjects.ForEachElementDo(co => co.NotifyObservers()); + } + + #region HydraulicBoundaryLocationCalculations + + private static IEnumerable MergeHydraulicBoundaryLocations(IAssessmentSection targetAssessmentSection, IAssessmentSection sourceAssessmentSection) + { + var changedObjects = new List(); + + changedObjects.AddRange(MergeHydraulicBoundaryLocationCalculations(targetAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm, + sourceAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm)); + changedObjects.AddRange(MergeHydraulicBoundaryLocationCalculations(targetAssessmentSection.WaterLevelCalculationsForSignalingNorm, + sourceAssessmentSection.WaterLevelCalculationsForSignalingNorm)); + changedObjects.AddRange(MergeHydraulicBoundaryLocationCalculations(targetAssessmentSection.WaterLevelCalculationsForLowerLimitNorm, + sourceAssessmentSection.WaterLevelCalculationsForLowerLimitNorm)); + changedObjects.AddRange(MergeHydraulicBoundaryLocationCalculations(targetAssessmentSection.WaterLevelCalculationsForFactorizedLowerLimitNorm, + sourceAssessmentSection.WaterLevelCalculationsForFactorizedLowerLimitNorm)); + + changedObjects.AddRange(MergeHydraulicBoundaryLocationCalculations(targetAssessmentSection.WaveHeightCalculationsForFactorizedSignalingNorm, + sourceAssessmentSection.WaveHeightCalculationsForFactorizedSignalingNorm)); + changedObjects.AddRange(MergeHydraulicBoundaryLocationCalculations(targetAssessmentSection.WaveHeightCalculationsForSignalingNorm, + sourceAssessmentSection.WaveHeightCalculationsForSignalingNorm)); + changedObjects.AddRange(MergeHydraulicBoundaryLocationCalculations(targetAssessmentSection.WaveHeightCalculationsForLowerLimitNorm, + sourceAssessmentSection.WaveHeightCalculationsForLowerLimitNorm)); + changedObjects.AddRange(MergeHydraulicBoundaryLocationCalculations(targetAssessmentSection.WaveHeightCalculationsForFactorizedLowerLimitNorm, + sourceAssessmentSection.WaveHeightCalculationsForFactorizedLowerLimitNorm)); + + log.Info(changedObjects.Any() + ? Resources.AssessmentSectionMergeHandler_MergeHydraulicBoundaryLocations_HydraulicBoundaryLocations_merged + : Resources.AssessmentSectionMergeHandler_MergeHydraulicBoundaryLocations_HydraulicBoundaryLocations_not_merged); + + return changedObjects; + } + + private static IEnumerable MergeHydraulicBoundaryLocationCalculations(IEnumerable targetCalculations, + IEnumerable sourceCalculations) + { + for (var i = 0; i < targetCalculations.Count(); i++) + { + HydraulicBoundaryLocationCalculation targetCalculation = targetCalculations.ElementAt(i); + HydraulicBoundaryLocationCalculation sourceCalculation = sourceCalculations.ElementAt(i); + + if (ShouldMerge(targetCalculation, sourceCalculation)) + { + targetCalculation.InputParameters.ShouldIllustrationPointsBeCalculated = sourceCalculation.InputParameters.ShouldIllustrationPointsBeCalculated; + targetCalculation.Output = sourceCalculation.Output; + + yield return targetCalculation; + } + } + } + + private static bool ShouldMerge(HydraulicBoundaryLocationCalculation targetCalculation, HydraulicBoundaryLocationCalculation sourceCalculation) + { + bool targetCalculationHasOutput = targetCalculation.HasOutput; + bool sourceCalculationHasOutput = sourceCalculation.HasOutput; + + if (!targetCalculationHasOutput && !sourceCalculationHasOutput + || targetCalculationHasOutput && !sourceCalculationHasOutput + || targetCalculationHasOutput && !targetCalculation.Output.HasGeneralResult && !sourceCalculation.Output.HasGeneralResult + || targetCalculationHasOutput && targetCalculation.Output.HasGeneralResult && sourceCalculation.Output.HasGeneralResult + || targetCalculationHasOutput && targetCalculation.Output.HasGeneralResult && !sourceCalculation.Output.HasGeneralResult) + { + return false; + } + + return true; + } + + #endregion + + #region FailureMechanisms + + private static void MergeFailureMechanisms(AssessmentSection targetAssessmentSection, AssessmentSectionMergeData mergeData) + { + ObservableList hydraulicBoundaryLocations = targetAssessmentSection.HydraulicBoundaryDatabase.Locations; + AssessmentSection sourceAssessmentSection = mergeData.AssessmentSection; + + if (mergeData.MergePiping) + { + targetAssessmentSection.Piping = sourceAssessmentSection.Piping; + UpdateCalculationHydraulicBoundaryLocationReferences( + targetAssessmentSection.Piping, hydraulicBoundaryLocations); + LogMergeMessage(targetAssessmentSection.Piping); + } + + if (mergeData.MergeGrassCoverErosionInwards) + { + targetAssessmentSection.GrassCoverErosionInwards = sourceAssessmentSection.GrassCoverErosionInwards; + UpdateCalculationHydraulicBoundaryLocationReferences( + targetAssessmentSection.GrassCoverErosionInwards, hydraulicBoundaryLocations); + LogMergeMessage(targetAssessmentSection.GrassCoverErosionInwards); + } + + if (mergeData.MergeMacroStabilityInwards) + { + targetAssessmentSection.MacroStabilityInwards = sourceAssessmentSection.MacroStabilityInwards; + UpdateCalculationHydraulicBoundaryLocationReferences( + targetAssessmentSection.MacroStabilityInwards, hydraulicBoundaryLocations); + LogMergeMessage(targetAssessmentSection.MacroStabilityInwards); + } + + if (mergeData.MergeMacroStabilityOutwards) + { + targetAssessmentSection.MacroStabilityOutwards = sourceAssessmentSection.MacroStabilityOutwards; + LogMergeMessage(targetAssessmentSection.MacroStabilityOutwards); + } + + if (mergeData.MergeMicrostability) + { + targetAssessmentSection.Microstability = sourceAssessmentSection.Microstability; + LogMergeMessage(targetAssessmentSection.Microstability); + } + + if (mergeData.MergeStabilityStoneCover) + { + targetAssessmentSection.StabilityStoneCover = sourceAssessmentSection.StabilityStoneCover; + UpdateCalculationHydraulicBoundaryLocationReferences( + targetAssessmentSection.StabilityStoneCover, hydraulicBoundaryLocations); + LogMergeMessage(targetAssessmentSection.StabilityStoneCover); + } + + if (mergeData.MergeWaveImpactAsphaltCover) + { + targetAssessmentSection.WaveImpactAsphaltCover = sourceAssessmentSection.WaveImpactAsphaltCover; + UpdateCalculationHydraulicBoundaryLocationReferences( + targetAssessmentSection.WaveImpactAsphaltCover, hydraulicBoundaryLocations); + LogMergeMessage(targetAssessmentSection.WaveImpactAsphaltCover); + } + + if (mergeData.MergeWaterPressureAsphaltCover) + { + targetAssessmentSection.WaterPressureAsphaltCover = sourceAssessmentSection.WaterPressureAsphaltCover; + LogMergeMessage(targetAssessmentSection.WaterPressureAsphaltCover); + } + + if (mergeData.MergeGrassCoverErosionOutwards) + { + targetAssessmentSection.GrassCoverErosionOutwards = sourceAssessmentSection.GrassCoverErosionOutwards; + UpdateLocationCalculationHydraulicBoundaryLocationReferences(targetAssessmentSection.GrassCoverErosionOutwards, hydraulicBoundaryLocations); + UpdateCalculationHydraulicBoundaryLocationReferences( + targetAssessmentSection.GrassCoverErosionOutwards, hydraulicBoundaryLocations); + LogMergeMessage(targetAssessmentSection.GrassCoverErosionOutwards); + } + + if (mergeData.MergeGrassCoverSlipOffOutwards) + { + targetAssessmentSection.GrassCoverSlipOffOutwards = sourceAssessmentSection.GrassCoverSlipOffOutwards; + LogMergeMessage(targetAssessmentSection.GrassCoverSlipOffOutwards); + } + + if (mergeData.MergeGrassCoverSlipOffInwards) + { + targetAssessmentSection.GrassCoverSlipOffInwards = sourceAssessmentSection.GrassCoverSlipOffInwards; + LogMergeMessage(targetAssessmentSection.GrassCoverSlipOffInwards); + } + + if (mergeData.MergeHeightStructures) + { + targetAssessmentSection.HeightStructures = sourceAssessmentSection.HeightStructures; + UpdateCalculationHydraulicBoundaryLocationReferences, HeightStructuresInput>( + targetAssessmentSection.HeightStructures, hydraulicBoundaryLocations); + LogMergeMessage(targetAssessmentSection.HeightStructures); + } + + if (mergeData.MergeClosingStructures) + { + targetAssessmentSection.ClosingStructures = sourceAssessmentSection.ClosingStructures; + UpdateCalculationHydraulicBoundaryLocationReferences, ClosingStructuresInput>( + targetAssessmentSection.ClosingStructures, hydraulicBoundaryLocations); + LogMergeMessage(targetAssessmentSection.ClosingStructures); + } + + if (mergeData.MergePipingStructure) + { + targetAssessmentSection.PipingStructure = sourceAssessmentSection.PipingStructure; + LogMergeMessage(targetAssessmentSection.PipingStructure); + } + + if (mergeData.MergeStabilityPointStructures) + { + targetAssessmentSection.StabilityPointStructures = sourceAssessmentSection.StabilityPointStructures; + UpdateCalculationHydraulicBoundaryLocationReferences, StabilityPointStructuresInput>( + targetAssessmentSection.StabilityPointStructures, hydraulicBoundaryLocations); + LogMergeMessage(targetAssessmentSection.StabilityPointStructures); + } + + if (mergeData.MergeStrengthStabilityLengthwiseConstruction) + { + targetAssessmentSection.StrengthStabilityLengthwiseConstruction = sourceAssessmentSection.StrengthStabilityLengthwiseConstruction; + LogMergeMessage(targetAssessmentSection.StrengthStabilityLengthwiseConstruction); + } + + if (mergeData.MergeDuneErosion) + { + targetAssessmentSection.DuneErosion = sourceAssessmentSection.DuneErosion; + LogMergeMessage(targetAssessmentSection.DuneErosion); + } + + if (mergeData.MergeTechnicalInnovation) + { + targetAssessmentSection.TechnicalInnovation = sourceAssessmentSection.TechnicalInnovation; + LogMergeMessage(targetAssessmentSection.TechnicalInnovation); + } + } + + private static void LogMergeMessage(IFailureMechanism failureMechanism) + { + log.InfoFormat(Resources.AssessmentSectionMergeHandler_TryMergeFailureMechanism_FailureMechanism_0_replaced, failureMechanism.Name); + } + + private static void UpdateCalculationHydraulicBoundaryLocationReferences( + TFailureMechanism failureMechanism, IEnumerable locations) + where TFailureMechanism : IFailureMechanism + where TCalculation : ICalculation + where TCalculationInput : class, ICalculationInputWithHydraulicBoundaryLocation + { + foreach (TCalculation calculation in failureMechanism.Calculations.Cast()) + { + if (calculation.InputParameters.HydraulicBoundaryLocation != null) + { + calculation.InputParameters.HydraulicBoundaryLocation = GetHydraulicBoundaryLocation(calculation.InputParameters.HydraulicBoundaryLocation, + locations); + } + } + } + + private static HydraulicBoundaryLocation GetHydraulicBoundaryLocation(HydraulicBoundaryLocation location, IEnumerable locations) + { + return locations.Single(l => l.Name == location.Name && l.Id == location.Id && l.Location.Equals(location.Location)); + } + + private static void UpdateLocationCalculationHydraulicBoundaryLocationReferences(GrassCoverErosionOutwardsFailureMechanism targetFailureMechanism, + IEnumerable locations) + { + HydraulicBoundaryLocationCalculation[] oldWaterLevelForMechanismSpecificFactorizedSignalingNorm = targetFailureMechanism.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm.ToArray(); + HydraulicBoundaryLocationCalculation[] oldWaterLevelForMechanismSpecificSignalingNorm = targetFailureMechanism.WaterLevelCalculationsForMechanismSpecificSignalingNorm.ToArray(); + HydraulicBoundaryLocationCalculation[] oldWaterLevelForMechanismSpecificLowerLimitNorm = targetFailureMechanism.WaterLevelCalculationsForMechanismSpecificLowerLimitNorm.ToArray(); + HydraulicBoundaryLocationCalculation[] oldWaveHeightForMechanismSpecificFactorizedSignalingNorm = targetFailureMechanism.WaveHeightCalculationsForMechanismSpecificFactorizedSignalingNorm.ToArray(); + HydraulicBoundaryLocationCalculation[] oldWaveHeightForMechanismSpecificSignalingNorm = targetFailureMechanism.WaveHeightCalculationsForMechanismSpecificSignalingNorm.ToArray(); + HydraulicBoundaryLocationCalculation[] oldWaveHeightForMechanismSpecificLowerLimitNorm = targetFailureMechanism.WaveHeightCalculationsForMechanismSpecificLowerLimitNorm.ToArray(); + targetFailureMechanism.SetHydraulicBoundaryLocationCalculations(locations); + + ReplaceHydraulicBoundaryLocationCalculationData(oldWaterLevelForMechanismSpecificFactorizedSignalingNorm, targetFailureMechanism.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm); + ReplaceHydraulicBoundaryLocationCalculationData(oldWaterLevelForMechanismSpecificSignalingNorm, targetFailureMechanism.WaterLevelCalculationsForMechanismSpecificSignalingNorm); + ReplaceHydraulicBoundaryLocationCalculationData(oldWaterLevelForMechanismSpecificLowerLimitNorm, targetFailureMechanism.WaterLevelCalculationsForMechanismSpecificLowerLimitNorm); + + ReplaceHydraulicBoundaryLocationCalculationData(oldWaveHeightForMechanismSpecificFactorizedSignalingNorm, targetFailureMechanism.WaveHeightCalculationsForMechanismSpecificFactorizedSignalingNorm); + ReplaceHydraulicBoundaryLocationCalculationData(oldWaveHeightForMechanismSpecificSignalingNorm, targetFailureMechanism.WaveHeightCalculationsForMechanismSpecificSignalingNorm); + ReplaceHydraulicBoundaryLocationCalculationData(oldWaveHeightForMechanismSpecificLowerLimitNorm, targetFailureMechanism.WaveHeightCalculationsForMechanismSpecificLowerLimitNorm); + } + + private static void ReplaceHydraulicBoundaryLocationCalculationData(IEnumerable oldCalculations, + IEnumerable newCalculations) + { + for (var i = 0; i < newCalculations.Count(); i++) + { + HydraulicBoundaryLocationCalculation newCalculation = newCalculations.ElementAt(i); + HydraulicBoundaryLocationCalculation oldCalculation = oldCalculations.ElementAt(i); + + newCalculation.InputParameters.ShouldIllustrationPointsBeCalculated = oldCalculation.InputParameters.ShouldIllustrationPointsBeCalculated; + newCalculation.Output = oldCalculation.Output; + } + } + + #endregion + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionMerger.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionMerger.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionMerger.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,170 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using log4net; +using Riskeer.Integration.Data; +using Riskeer.Integration.Data.Merge; +using Riskeer.Integration.Forms.Merge; +using Riskeer.Integration.Plugin.Properties; +using Riskeer.Integration.Service.Comparers; +using CoreCommonGuiResources = Core.Common.Gui.Properties.Resources; + +namespace Riskeer.Integration.Plugin.Merge +{ + /// + /// Class responsible for merging . + /// + public class AssessmentSectionMerger + { + private static readonly ILog log = LogManager.GetLogger(typeof(AssessmentSectionMerger)); + + private readonly IAssessmentSectionMergeFilePathProvider filePathProvider; + private readonly IAssessmentSectionProvider assessmentSectionProvider; + private readonly IAssessmentSectionMergeComparer mergeComparer; + private readonly IAssessmentSectionMergeDataProvider mergeDataProvider; + private readonly IAssessmentSectionMergeHandler mergeHandler; + + /// + /// Creates a new instance of . + /// + /// The provider to get the file path of the file to merge. + /// The provider to get the assessment sections to merge. + /// The comparer to compare the assessment sections with. + /// The provider to get the data to merge from. + /// The handler to perform the merge. + /// Thrown when any parameter is null. + public AssessmentSectionMerger(IAssessmentSectionMergeFilePathProvider filePathProvider, IAssessmentSectionProvider assessmentSectionProvider, + IAssessmentSectionMergeComparer mergeComparer, IAssessmentSectionMergeDataProvider mergeDataProvider, IAssessmentSectionMergeHandler mergeHandler) + { + if (filePathProvider == null) + { + throw new ArgumentNullException(nameof(filePathProvider)); + } + + if (assessmentSectionProvider == null) + { + throw new ArgumentNullException(nameof(assessmentSectionProvider)); + } + + if (mergeComparer == null) + { + throw new ArgumentNullException(nameof(mergeComparer)); + } + + if (mergeDataProvider == null) + { + throw new ArgumentNullException(nameof(mergeDataProvider)); + } + + if (mergeHandler == null) + { + throw new ArgumentNullException(nameof(mergeHandler)); + } + + this.filePathProvider = filePathProvider; + this.assessmentSectionProvider = assessmentSectionProvider; + this.mergeComparer = mergeComparer; + this.mergeDataProvider = mergeDataProvider; + this.mergeHandler = mergeHandler; + } + + /// + /// Performs the merge of . + /// + /// The assessment section to perform the merge on. + /// Thrown when + /// is null. + public void StartMerge(AssessmentSection assessmentSection) + { + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + string filePath = filePathProvider.GetFilePath(); + + if (filePath == null) + { + LogCancelMessage(); + return; + } + + IEnumerable assessmentSections; + + try + { + assessmentSections = assessmentSectionProvider.GetAssessmentSections(filePath); + } + catch (AssessmentSectionProviderException) + { + return; + } + + if (!assessmentSections.Any()) + { + log.Error(Resources.AssessmentSectionMerger_No_matching_AssessmentSections); + return; + } + + IEnumerable matchingAssessmentSections = assessmentSections.Where(section => mergeComparer.Compare(assessmentSection, section)); + + if (!matchingAssessmentSections.Any()) + { + log.Error(Resources.AssessmentSectionMerger_No_matching_AssessmentSections); + return; + } + + AssessmentSectionMergeData mergeData = mergeDataProvider.GetMergeData(matchingAssessmentSections); + + if (mergeData == null) + { + LogCancelMessage(); + return; + } + + PerformMerge(assessmentSection, mergeData); + } + + private void PerformMerge(AssessmentSection assessmentSection, AssessmentSectionMergeData mergeData) + { + log.Info(Resources.AssessmentSectionMerger_PerformMerge_Merging_AssessmentSections_started); + + try + { + mergeHandler.PerformMerge(assessmentSection, mergeData); + log.Info(Resources.AssessmentSectionMerger_PerformMerge_Merging_AssessmentSections_successful); + } + catch (Exception e) + { + log.Error(Resources.AssessmentSectionMerger_PerformMerge_Unexpected_error_occurred_during_merge, e); + log.Error(Resources.AssessmentSectionMerger_PerformMerge_Merging_AssessmentSections_failed); + } + } + + private static void LogCancelMessage() + { + log.Warn(CoreCommonGuiResources.GuiImportHandler_ImportItemsUsingDialog_Importing_cancelled); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionProvider.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionProvider.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionProvider.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,78 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using Core.Common.Gui.Forms.ProgressDialog; +using Riskeer.Integration.Data; +using Riskeer.Integration.Data.Merge; +using Riskeer.Integration.Service.Merge; +using Riskeer.Storage.Core; + +namespace Riskeer.Integration.Plugin.Merge +{ + /// + /// Class for providing instances. + /// + public class AssessmentSectionProvider : IAssessmentSectionProvider + { + private readonly IWin32Window viewParent; + + /// + /// Initializes a new instance of . + /// + /// The parent of the view. + /// Thrown when + /// is null. + public AssessmentSectionProvider(IWin32Window viewParent) + { + if (viewParent == null) + { + throw new ArgumentNullException(nameof(viewParent)); + } + + this.viewParent = viewParent; + } + + public IEnumerable GetAssessmentSections(string filePath) + { + if (filePath == null) + { + throw new ArgumentNullException(nameof(filePath)); + } + + var assessmentSectionsOwner = new AssessmentSectionsOwner(); + + ActivityProgressDialogRunner.Run(viewParent, + LoadAssessmentSectionsActivityFactory.CreateLoadAssessmentSectionsActivity( + assessmentSectionsOwner, new LoadAssessmentSectionService(new StorageSqLite()), + filePath)); + + if (assessmentSectionsOwner.AssessmentSections == null) + { + throw new AssessmentSectionProviderException(); + } + + return assessmentSectionsOwner.AssessmentSections; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionProviderException.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionProviderException.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/AssessmentSectionProviderException.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,68 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Runtime.Serialization; + +namespace Riskeer.Integration.Plugin.Merge +{ + /// + /// The exception that is thrown when something fails while providing assessment sections. + /// + [Serializable] + public class AssessmentSectionProviderException : Exception + { + /// + /// Initializes a new instance of the class. + /// + public AssessmentSectionProviderException() {} + + /// + /// Initializes a new instance of the class + /// with a specified error message. + /// + /// The error message that explains the reason for the exception. + public AssessmentSectionProviderException(string message) : base(message) {} + + /// + /// Initializes a new instance of the class + /// with a specified error message and a reference to the inner exception that is + /// the cause of this exception. + /// + /// The error message that explains the reason for the exception. + /// The exception that is the cause of the current exception, + /// or a null reference if no inner exception is specified. + public AssessmentSectionProviderException(string message, Exception inner) : base(message, inner) {} + + /// + /// Initializes a new instance of with + /// serialized data. + /// The that holds the serialized + /// object data about the exception being thrown. + /// The that contains contextual + /// information about the source or destination. + /// The parameter is + /// null. + /// The class name is null or + /// is zero (0). + protected AssessmentSectionProviderException(SerializationInfo info, StreamingContext context) : base(info, context) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/IAssessmentSectionMergeHandler.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/IAssessmentSectionMergeHandler.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/IAssessmentSectionMergeHandler.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,41 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Riskeer.Integration.Data; +using Riskeer.Integration.Data.Merge; + +namespace Riskeer.Integration.Plugin.Merge +{ + /// + /// Interface for handling the merge of data. + /// + public interface IAssessmentSectionMergeHandler + { + /// + /// Performs the merge. + /// + /// The assessment section to merge to. + /// The data to merge. + /// Thrown when any parameter is null. + void PerformMerge(AssessmentSection targetAssessmentSection, AssessmentSectionMergeData mergeData); + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/IAssessmentSectionProvider.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/IAssessmentSectionProvider.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Merge/IAssessmentSectionProvider.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,44 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using Riskeer.Integration.Data; + +namespace Riskeer.Integration.Plugin.Merge +{ + /// + /// Interface for providing instances. + /// + public interface IAssessmentSectionProvider + { + /// + /// Gets the assessment sections from the given . + /// + /// The file path to read the assessment sections from. + /// A collection of . + /// Thrown when + /// is null. + /// Thrown when something went wrong + /// while getting the assessment sections. + IEnumerable GetAssessmentSections(string filePath); + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Properties/AssemblyInfo.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Properties/AssemblyInfo.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Properties/AssemblyInfo.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,27 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle("Riskeer.Integration.Plugin")] +[assembly: AssemblyProduct("Riskeer.Integration.Plugin")] +[assembly: InternalsVisibleTo("Ringtoets.Integration.Plugin.Test")] \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.Designer.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.Designer.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.Designer.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,439 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Riskeer.Integration.Plugin.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Riskeer.Integration.Plugin.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to gml. + /// + public static string AssemblyResult_file_filter_Extension { + get { + return ResourceManager.GetString("AssemblyResult_file_filter_Extension", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap AssemblyResultPerSection { + get { + object obj = ResourceManager.GetObject("AssemblyResultPerSection", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized string similar to Assemblagekaart. + /// + public static string AssemblyResultPerSection_Map_DisplayName { + get { + return ResourceManager.GetString("AssemblyResultPerSection_Map_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap AssemblyResultPerSectionMap { + get { + object obj = ResourceManager.GetObject("AssemblyResultPerSectionMap", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized string similar to Assemblage. + /// + public static string AssemblyResultsCategoryTreeFolder_DisplayName { + get { + return ResourceManager.GetString("AssemblyResultsCategoryTreeFolder_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap AssemblyResultTotal { + get { + object obj = ResourceManager.GetObject("AssemblyResultTotal", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized string similar to Voer alle berekeningen binnen dit traject uit.. + /// + public static string AssessmentSection_Calculate_All_ToolTip { + get { + return ResourceManager.GetString("AssessmentSection_Calculate_All_ToolTip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Als u het trajecttype aanpast, dan worden alle rekenresultaten van alle relevante toetssporen verwijderd. + /// + ///Weet u zeker dat u wilt doorgaan?. + /// + public static string AssessmentSectionCompositionChangeHandler_Confirm_change_composition_and_clear_dependent_data { + get { + return ResourceManager.GetString("AssessmentSectionCompositionChangeHandler_Confirm_change_composition_and_clear_de" + + "pendent_data", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Alle berekende hydraulische belastingen van de relevante toetssporen zijn verwijderd.. + /// + public static string AssessmentSectionCompositionChangeHandler_Waveheight_and_design_water_level_results_cleared { + get { + return ResourceManager.GetString("AssessmentSectionCompositionChangeHandler_Waveheight_and_design_water_level_resul" + + "ts_cleared", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Hydraulische belastingen zijn samengevoegd.. + /// + public static string AssessmentSectionMergeHandler_MergeHydraulicBoundaryLocations_HydraulicBoundaryLocations_merged { + get { + return ResourceManager.GetString("AssessmentSectionMergeHandler_MergeHydraulicBoundaryLocations_HydraulicBoundaryLo" + + "cations_merged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Hydraulische belastingen zijn niet samengevoegd omdat het huidige traject meer gegevens bevat.. + /// + public static string AssessmentSectionMergeHandler_MergeHydraulicBoundaryLocations_HydraulicBoundaryLocations_not_merged { + get { + return ResourceManager.GetString("AssessmentSectionMergeHandler_MergeHydraulicBoundaryLocations_HydraulicBoundaryLo" + + "cations_not_merged", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Gegevens van toetsspoor '{0}' zijn vervangen.. + /// + public static string AssessmentSectionMergeHandler_TryMergeFailureMechanism_FailureMechanism_0_replaced { + get { + return ResourceManager.GetString("AssessmentSectionMergeHandler_TryMergeFailureMechanism_FailureMechanism_0_replace" + + "d", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Er zijn geen trajecten gevonden die samengevoegd kunnen worden.. + /// + public static string AssessmentSectionMerger_No_matching_AssessmentSections { + get { + return ResourceManager.GetString("AssessmentSectionMerger_No_matching_AssessmentSections", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Samenvoegen van trajectinformatie is mislukt.. + /// + public static string AssessmentSectionMerger_PerformMerge_Merging_AssessmentSections_failed { + get { + return ResourceManager.GetString("AssessmentSectionMerger_PerformMerge_Merging_AssessmentSections_failed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Samenvoegen van trajectinformatie is gestart.. + /// + public static string AssessmentSectionMerger_PerformMerge_Merging_AssessmentSections_started { + get { + return ResourceManager.GetString("AssessmentSectionMerger_PerformMerge_Merging_AssessmentSections_started", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Samenvoegen van trajectinformatie is gelukt.. + /// + public static string AssessmentSectionMerger_PerformMerge_Merging_AssessmentSections_successful { + get { + return ResourceManager.GetString("AssessmentSectionMerger_PerformMerge_Merging_AssessmentSections_successful", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Er is een onverwachte fout opgetreden tijdens het samenvoegen van de trajecten.. + /// + public static string AssessmentSectionMerger_PerformMerge_Unexpected_error_occurred_during_merge { + get { + return ResourceManager.GetString("AssessmentSectionMerger_PerformMerge_Unexpected_error_occurred_during_merge", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to &Selecteren.... + /// + public static string BackgroundData_SelectMapData { + get { + return ResourceManager.GetString("BackgroundData_SelectMapData", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Selecteer een achtergrondkaart.. + /// + public static string BackgroundData_SelectMapData_Tooltip { + get { + return ResourceManager.GetString("BackgroundData_SelectMapData_Tooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De resultaten van {0} berekeningen zijn verwijderd.. + /// + public static string ChangeHandler_Results_of_NumberOfCalculations_0_calculations_cleared { + get { + return ResourceManager.GetString("ChangeHandler_Results_of_NumberOfCalculations_0_calculations_cleared", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Opmerkingen. + /// + public static string Comment_DisplayName { + get { + return ResourceManager.GetString("Comment_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Als u de norm aanpast, dan worden alle rekenresultaten van alle hydraulische belastingenlocaties en toetssporen verwijderd. + /// + ///Weet u zeker dat u wilt doorgaan?. + /// + public static string FailureMechanismContributionNormChangeHandler_Confirm_change_norm_and_clear_dependent_data { + get { + return ResourceManager.GetString("FailureMechanismContributionNormChangeHandler_Confirm_change_norm_and_clear_depen" + + "dent_data", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Alle berekende hydraulische belastingen zijn verwijderd.. + /// + public static string FailureMechanismContributionNormChangeHandler_Waveheight_and_design_water_level_results_cleared { + get { + return ResourceManager.GetString("FailureMechanismContributionNormChangeHandler_Waveheight_and_design_water_level_r" + + "esults_cleared", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap Foreshore { + get { + object obj = ResourceManager.GetObject("Foreshore", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized string similar to Voorlandprofiellocaties. + /// + public static string ForeshoreProfilesImporter_DisplayName { + get { + return ResourceManager.GetString("ForeshoreProfilesImporter_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Hydraulische belastingendatabase. + /// + public static string HydraulicBoundaryDatabase_file_filter_Description { + get { + return ResourceManager.GetString("HydraulicBoundaryDatabase_file_filter_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to sqlite. + /// + public static string HydraulicBoundaryDatabase_FilePath_Extension { + get { + return ResourceManager.GetString("HydraulicBoundaryDatabase_FilePath_Extension", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to U heeft een ander hydraulische belastingendatabase bestand geselecteerd. Als gevolg hiervan moet de uitvoer van alle ervan afhankelijke berekeningen verwijderd worden. + /// + ///Wilt u doorgaan?. + /// + public static string HydraulicBoundaryDatabaseUpdateHandler_Confirm_clear_hydraulicBoundaryDatabase_dependent_data { + get { + return ResourceManager.GetString("HydraulicBoundaryDatabaseUpdateHandler_Confirm_clear_hydraulicBoundaryDatabase_de" + + "pendent_data", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Importeren van het HLCD bestand. + /// + public static string HydraulicLocationConfigurationDatabaseImportHandler_ImportHydraulicLocationConfigurationSettings_Description { + get { + return ResourceManager.GetString("HydraulicLocationConfigurationDatabaseImportHandler_ImportHydraulicLocationConfig" + + "urationSettings_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Als u het gekoppelde HLCD bestand wijzigt, zal de uitvoer van al de berekeningen verwijderd worden. + /// + ///Wilt u doorgaan?. + /// + public static string HydraulicLocationConfigurationDatabaseUpdateHandler_Confirm_clear_hydraulicLocationConfigurationDatabase_dependent_data { + get { + return ResourceManager.GetString("HydraulicLocationConfigurationDatabaseUpdateHandler_Confirm_clear_hydraulicLocati" + + "onConfigurationDatabase_dependent_data", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De tabel 'ScenarioInformation' in het HLCD bestand is niet aanwezig, er worden standaardwaarden conform WBI2017 voor de HLCD bestand informatie gebruikt.. + /// + public static string HydraulicLocationConfigurationSettingsUpdateHelper_ReadHydraulicLocationConfigurationDatabaseSettings_No_ScenarioInformation_entries_present { + get { + return ResourceManager.GetString("HydraulicLocationConfigurationSettingsUpdateHelper_ReadHydraulicLocationConfigura" + + "tionDatabaseSettings_No_ScenarioInformation_entries_present", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Na het importeren van een aangepaste ligging van de referentielijn zullen alle geïmporteerde en berekende gegevens van alle toetssporen worden gewist. + /// + ///Wilt u doorgaan?. + /// + public static string ReferenceLineUpdateHandler_Confirm_clear_referenceLine_dependent_data { + get { + return ResourceManager.GetString("ReferenceLineUpdateHandler_Confirm_clear_referenceLine_dependent_data", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Achtergrondkaart. + /// + public static string RingtoetsPlugin_BackgroundDataContext_Text { + get { + return ResourceManager.GetString("RingtoetsPlugin_BackgroundDataContext_Text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Als u voorlandprofielen importeert, dan worden de resultaten van alle berekeningen in dit toetsspoor die voorlandprofielen gebruiken verwijderd. + /// + ///Weet u zeker dat u wilt doorgaan?. + /// + public static string RingtoetsPlugin_VerifyForeshoreProfileUpdates_When_importing_ForeshoreProfile_definitions_assigned_to_calculations_output_will_be_cleared_confirm { + get { + return ResourceManager.GetString("RingtoetsPlugin_VerifyForeshoreProfileUpdates_When_importing_ForeshoreProfile_def" + + "initions_assigned_to_calculations_output_will_be_cleared_confirm", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Als voorlandprofielen wijzigen door het bijwerken, dan worden de resultaten van berekeningen die deze voorlandprofielen gebruiken verwijderd. + /// + ///Weet u zeker dat u wilt doorgaan?. + /// + public static string RingtoetsPlugin_VerifyForeshoreProfileUpdates_When_updating_ForeshoreProfile_definitions_assigned_to_calculations_output_will_be_cleared_confirm { + get { + return ResourceManager.GetString("RingtoetsPlugin_VerifyForeshoreProfileUpdates_When_updating_ForeshoreProfile_defi" + + "nitions_assigned_to_calculations_output_will_be_cleared_confirm", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Nieuw. + /// + public static string RingtoetsRibbon_GroupBox_New { + get { + return ResourceManager.GetString("RingtoetsRibbon_GroupBox_New", resourceCulture); + } + } + } +} Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.resx =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.resx (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Properties/Resources.resx (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Opmerkingen + + + Nieuw + + + Voorlandprofiellocaties + + + + ..\Resources\Foreshore.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Na het importeren van een aangepaste ligging van de referentielijn zullen alle geïmporteerde en berekende gegevens van alle toetssporen worden gewist. + +Wilt u doorgaan? + + + De resultaten van {0} berekeningen zijn verwijderd. + + + Alle berekende hydraulische belastingen zijn verwijderd. + + + Als u de norm aanpast, dan worden alle rekenresultaten van alle hydraulische belastingenlocaties en toetssporen verwijderd. + +Weet u zeker dat u wilt doorgaan? + + + Achtergrondkaart + + + Alle berekende hydraulische belastingen van de relevante toetssporen zijn verwijderd. + + + Als u het trajecttype aanpast, dan worden alle rekenresultaten van alle relevante toetssporen verwijderd. + +Weet u zeker dat u wilt doorgaan? + + + &Selecteren... + + + Selecteer een achtergrondkaart. + + + Als u voorlandprofielen importeert, dan worden de resultaten van alle berekeningen in dit toetsspoor die voorlandprofielen gebruiken verwijderd. + +Weet u zeker dat u wilt doorgaan? + + + Als voorlandprofielen wijzigen door het bijwerken, dan worden de resultaten van berekeningen die deze voorlandprofielen gebruiken verwijderd. + +Weet u zeker dat u wilt doorgaan? + + + ..\Resources\AssemblyResultPerSection.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\AssemblyResultTotal.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Er zijn geen trajecten gevonden die samengevoegd kunnen worden. + + + Samenvoegen van trajectinformatie is gelukt. + + + Samenvoegen van trajectinformatie is gestart. + + + Er is een onverwachte fout opgetreden tijdens het samenvoegen van de trajecten. + + + Samenvoegen van trajectinformatie is mislukt. + + + Voer alle berekeningen binnen dit traject uit. + + + Hydraulische belastingen zijn samengevoegd. + + + Gegevens van toetsspoor '{0}' zijn vervangen. + + + Hydraulische belastingen zijn niet samengevoegd omdat het huidige traject meer gegevens bevat. + + + gml + + + Assemblage + + + Assemblagekaart + + + ..\Resources\AssemblyResultPerSectionMap.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + U heeft een ander hydraulische belastingendatabase bestand geselecteerd. Als gevolg hiervan moet de uitvoer van alle ervan afhankelijke berekeningen verwijderd worden. + +Wilt u doorgaan? + + + sqlite + + + Hydraulische belastingendatabase + + + Als u het gekoppelde HLCD bestand wijzigt, zal de uitvoer van al de berekeningen verwijderd worden. + +Wilt u doorgaan? + + + Importeren van het HLCD bestand + + + De tabel 'ScenarioInformation' in het HLCD bestand is niet aanwezig, er worden standaardwaarden conform WBI2017 voor de HLCD bestand informatie gebruikt. + + \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Resources/AssemblyResultPerSection.png =================================================================== diff -u Binary files differ Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Resources/AssemblyResultPerSectionMap.png =================================================================== diff -u Binary files differ Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Resources/AssemblyResultTotal.png =================================================================== diff -u Binary files differ Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Resources/Foreshore.png =================================================================== diff -u Binary files differ Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/RingtoetsPlugin.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/RingtoetsPlugin.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,2446 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.ContextMenu; +using Core.Common.Gui.Forms; +using Core.Common.Gui.Forms.ProgressDialog; +using Core.Common.Gui.Plugin; +using Core.Common.Util; +using Core.Common.Util.Extensions; +using Core.Components.Gis.Data; +using log4net; +using Ringtoets.ClosingStructures.Data; +using Ringtoets.ClosingStructures.Forms.PresentationObjects; +using Ringtoets.Common.Data; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.Contribution; +using Ringtoets.Common.Data.DikeProfiles; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Data.Probability; +using Ringtoets.Common.Data.Structures; +using Ringtoets.Common.Forms.ChangeHandlers; +using Ringtoets.Common.Forms.Controls; +using Ringtoets.Common.Forms.GuiServices; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Common.Forms.PropertyClasses; +using Ringtoets.Common.Forms.TreeNodeInfos; +using Ringtoets.Common.Forms.UpdateInfos; +using Ringtoets.Common.Forms.Views; +using Ringtoets.Common.IO.FileImporters; +using Ringtoets.Common.IO.FileImporters.MessageProviders; +using Ringtoets.Common.IO.HydraRing; +using Ringtoets.Common.IO.ReferenceLines; +using Ringtoets.Common.Plugin; +using Ringtoets.Common.Service; +using Ringtoets.Common.Util.TypeConverters; +using Ringtoets.DuneErosion.Data; +using Ringtoets.DuneErosion.Forms.PresentationObjects; +using Ringtoets.DuneErosion.Plugin.Handlers; +using Ringtoets.GrassCoverErosionInwards.Data; +using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; +using Ringtoets.HeightStructures.Data; +using Ringtoets.HeightStructures.Forms.PresentationObjects; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Forms.PresentationObjects; +using Ringtoets.Piping.Data; +using Ringtoets.Piping.Forms.PresentationObjects; +using Ringtoets.StabilityPointStructures.Data; +using Ringtoets.StabilityPointStructures.Forms.PresentationObjects; +using Ringtoets.StabilityStoneCover.Data; +using Ringtoets.StabilityStoneCover.Forms.PresentationObjects; +using Ringtoets.WaveImpactAsphaltCover.Data; +using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects; +using Riskeer.Integration.Data; +using Riskeer.Integration.Data.StandAlone; +using Riskeer.Integration.Data.StandAlone.Input; +using Riskeer.Integration.Data.StandAlone.SectionResults; +using Riskeer.Integration.Forms.Commands; +using Riskeer.Integration.Forms.Dialogs; +using Riskeer.Integration.Forms.Factories; +using Riskeer.Integration.Forms.Merge; +using Riskeer.Integration.Forms.PresentationObjects; +using Riskeer.Integration.Forms.PresentationObjects.StandAlone; +using Riskeer.Integration.Forms.PropertyClasses; +using Riskeer.Integration.Forms.PropertyClasses.StandAlone; +using Riskeer.Integration.Forms.Views; +using Riskeer.Integration.Forms.Views.SectionResultRows; +using Riskeer.Integration.Forms.Views.SectionResultViews; +using Riskeer.Integration.IO.Exporters; +using Riskeer.Integration.IO.Importers; +using Riskeer.Integration.Plugin.FileImporters; +using Riskeer.Integration.Plugin.Handlers; +using Riskeer.Integration.Plugin.Merge; +using Riskeer.Integration.Plugin.Properties; +using Riskeer.Integration.Service; +using Riskeer.Integration.Service.Comparers; +using RingtoetsDataResources = Riskeer.Integration.Data.Properties.Resources; +using RingtoetsFormsResources = Riskeer.Integration.Forms.Properties.Resources; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; +using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; +using RingtoetsCommonServiceResources = Ringtoets.Common.Service.Properties.Resources; +using GuiResources = Core.Common.Gui.Properties.Resources; + +namespace Riskeer.Integration.Plugin +{ + /// + /// The plug-in for the Ringtoets application. + /// + public class RingtoetsPlugin : PluginBase + { + private static readonly ILog log = LogManager.GetLogger(typeof(PluginBase)); + + #region Failure mechanism associations + + private static readonly IEnumerable failureMechanismAssociations = new[] + { + new FailureMechanismContextAssociation( + typeof(PipingFailureMechanism), + (mechanism, assessmentSection) => new PipingFailureMechanismContext( + (PipingFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(GrassCoverErosionInwardsFailureMechanism), + (mechanism, assessmentSection) => new GrassCoverErosionInwardsFailureMechanismContext( + (GrassCoverErosionInwardsFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(HeightStructuresFailureMechanism), + (mechanism, assessmentSection) => new HeightStructuresFailureMechanismContext( + (HeightStructuresFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(DuneErosionFailureMechanism), + (mechanism, assessmentSection) => new DuneErosionFailureMechanismContext( + (DuneErosionFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(GrassCoverErosionOutwardsFailureMechanism), + (mechanism, assessmentSection) => new GrassCoverErosionOutwardsFailureMechanismContext( + (GrassCoverErosionOutwardsFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(GrassCoverSlipOffInwardsFailureMechanism), + (mechanism, assessmentSection) => new GrassCoverSlipOffInwardsFailureMechanismContext( + (GrassCoverSlipOffInwardsFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(GrassCoverSlipOffOutwardsFailureMechanism), + (mechanism, assessmentSection) => new GrassCoverSlipOffOutwardsFailureMechanismContext( + (GrassCoverSlipOffOutwardsFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(MicrostabilityFailureMechanism), + (mechanism, assessmentSection) => new MicrostabilityFailureMechanismContext( + (MicrostabilityFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(PipingStructureFailureMechanism), + (mechanism, assessmentSection) => new PipingStructureFailureMechanismContext( + (PipingStructureFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(StabilityStoneCoverFailureMechanism), + (mechanism, assessmentSection) => new StabilityStoneCoverFailureMechanismContext( + (StabilityStoneCoverFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(TechnicalInnovationFailureMechanism), + (mechanism, assessmentSection) => new TechnicalInnovationFailureMechanismContext( + (TechnicalInnovationFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(StrengthStabilityLengthwiseConstructionFailureMechanism), + (mechanism, assessmentSection) => new StrengthStabilityLengthwiseConstructionFailureMechanismContext( + (StrengthStabilityLengthwiseConstructionFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(WaveImpactAsphaltCoverFailureMechanism), + (mechanism, assessmentSection) => new WaveImpactAsphaltCoverFailureMechanismContext( + (WaveImpactAsphaltCoverFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(WaterPressureAsphaltCoverFailureMechanism), + (mechanism, assessmentSection) => new WaterPressureAsphaltCoverFailureMechanismContext( + (WaterPressureAsphaltCoverFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(ClosingStructuresFailureMechanism), + (mechanism, assessmentSection) => new ClosingStructuresFailureMechanismContext( + (ClosingStructuresFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(MacroStabilityInwardsFailureMechanism), + (mechanism, assessmentSection) => new MacroStabilityInwardsFailureMechanismContext( + (MacroStabilityInwardsFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(MacroStabilityOutwardsFailureMechanism), + (mechanism, assessmentSection) => new MacroStabilityOutwardsFailureMechanismContext( + (MacroStabilityOutwardsFailureMechanism) mechanism, + assessmentSection) + ), + new FailureMechanismContextAssociation( + typeof(StabilityPointStructuresFailureMechanism), + (mechanism, assessmentSection) => new StabilityPointStructuresFailureMechanismContext( + (StabilityPointStructuresFailureMechanism) mechanism, + assessmentSection) + ) + }; + + #endregion + + private RingtoetsRibbon ribbonCommandHandler; + + private IAssessmentSectionFromFileCommandHandler assessmentSectionFromFileCommandHandler; + private IHydraulicBoundaryLocationCalculationGuiService hydraulicBoundaryLocationCalculationGuiService; + private AssessmentSectionMerger assessmentSectionMerger; + + public override IRibbonCommandHandler RibbonCommandHandler + { + get + { + return ribbonCommandHandler; + } + } + + public override IGui Gui + { + get + { + return base.Gui; + } + set + { + RemoveOnOpenProjectListener(base.Gui); + base.Gui = value; + AddOnOpenProjectListener(value); + } + } + + public override void Activate() + { + base.Activate(); + + if (Gui == null) + { + throw new InvalidOperationException("Gui cannot be null"); + } + + assessmentSectionFromFileCommandHandler = new AssessmentSectionFromFileCommandHandler(Gui.MainWindow, Gui, Gui.DocumentViewController); + hydraulicBoundaryLocationCalculationGuiService = new HydraulicBoundaryLocationCalculationGuiService(Gui.MainWindow); + assessmentSectionMerger = new AssessmentSectionMerger(new AssessmentSectionMergeFilePathProvider(new DialogBasedInquiryHelper(Gui.MainWindow)), + new AssessmentSectionProvider(Gui.MainWindow), + new AssessmentSectionMergeComparer(), + new AssessmentSectionMergeDataProviderDialog(Gui.MainWindow), + new AssessmentSectionMergeHandler(Gui.ViewCommands)); + + ribbonCommandHandler = new RingtoetsRibbon + { + AddAssessmentSectionButtonCommand = new AddAssessmentSectionCommand(assessmentSectionFromFileCommandHandler) + }; + } + + /// + /// Returns all instances provided for data of . + /// + public override IEnumerable GetPropertyInfos() + { + yield return new PropertyInfo(); + yield return new PropertyInfo(); + yield return new PropertyInfo + { + CreateInstance = data => new BackgroundDataProperties(data) + }; + yield return new PropertyInfo + { + CreateInstance = context => new HydraulicBoundaryDatabaseProperties( + context.WrappedData, + new HydraulicLocationConfigurationDatabaseImportHandler( + Gui.MainWindow, + new HydraulicLocationConfigurationDatabaseUpdateHandler(context.AssessmentSection), context.WrappedData)) + }; + yield return new PropertyInfo + { + CreateInstance = context => new AssessmentSectionCompositionProperties( + context.Parent, + new AssessmentSectionCompositionChangeHandler(Gui.ViewCommands)) + }; + yield return new PropertyInfo + { + CreateInstance = context => new NormProperties( + context.WrappedData, + new FailureMechanismContributionNormChangeHandler(context.AssessmentSection)) + }; + yield return new PropertyInfo, StandAloneFailureMechanismProperties> + { + CreateInstance = context => new StandAloneFailureMechanismProperties(context.WrappedData, context.Parent) + }; + yield return new PropertyInfo + { + CreateInstance = context => new MacroStabilityOutwardsFailureMechanismProperties(context.WrappedData, context.Parent) + }; + yield return new PropertyInfo + { + CreateInstance = context => new PipingStructureFailureMechanismProperties(context.WrappedData) + }; + yield return new PropertyInfo, CalculationGroupContextProperties> + { + CreateInstance = context => new CalculationGroupContextProperties(context) + }; + yield return new PropertyInfo, CalculationContextProperties>(); + yield return new PropertyInfo + { + CreateInstance = context => new DesignWaterLevelCalculationsProperties(context.WrappedData) + }; + yield return new PropertyInfo + { + CreateInstance = context => new DesignWaterLevelCalculationProperties(context.WrappedData) + }; + yield return new PropertyInfo + { + CreateInstance = context => new WaveHeightCalculationsProperties(context.WrappedData) + }; + yield return new PropertyInfo + { + CreateInstance = context => new WaveHeightCalculationProperties(context.WrappedData) + }; + yield return new PropertyInfo(); + yield return new PropertyInfo + { + CreateInstance = context => new ForeshoreProfileCollectionProperties(context.WrappedData) + }; + yield return new PropertyInfo + { + CreateInstance = selected => new TopLevelSubMechanismIllustrationPointProperties(selected.TopLevelSubMechanismIllustrationPoint, + selected.ClosingSituations) + }; + yield return new PropertyInfo + { + CreateInstance = CreateTopLevelFaultTreeIllustrationPointProperties + }; + yield return new PropertyInfo, FaultTreeIllustrationPointProperties> + { + CreateInstance = context => new FaultTreeIllustrationPointProperties(context.IllustrationPoint, + context.IllustrationPointNode.Children, + context.WindDirectionName, + context.ClosingSituation) + }; + yield return new PropertyInfo, SubMechanismIllustrationPointProperties> + { + CreateInstance = context => new SubMechanismIllustrationPointProperties(context.IllustrationPoint, + context.WindDirectionName, + context.ClosingSituation) + }; + yield return new PropertyInfo + { + CreateInstance = context => new FailureMechanismSectionsProperties(context.WrappedData) + }; + yield return new PropertyInfo + { + CreateInstance = context => new ReferenceLineProperties(context.WrappedData) + }; + yield return new PropertyInfo + { + CreateInstance = context => new FailureMechanismAssemblyCategoriesProperties(context.GetFailureMechanismCategoriesFunc(), + context.GetFailureMechanismSectionAssemblyCategoriesFunc()) + }; + yield return new PropertyInfo + { + CreateInstance = context => new FailureMechanismSectionAssemblyCategoriesProperties(context.GetFailureMechanismSectionAssemblyCategoriesFunc()) + }; + yield return new PropertyInfo + { + CreateInstance = context => + { + IEnumerable>> calculationsPerCategoryBoundary = + DesignWaterLevelCalculationsGroupContextChildNodeObjects(context) + .Cast() + .Select(childContext => new Tuple>(childContext.CategoryBoundaryName, + childContext.WrappedData)); + return new DesignWaterLevelCalculationsGroupProperties(context.WrappedData, calculationsPerCategoryBoundary); + } + }; + yield return new PropertyInfo + { + CreateInstance = context => + { + IEnumerable>> calculationsPerCategoryBoundary = + WaveHeightCalculationsGroupContextChildNodeObjects(context) + .Cast() + .Select(childContext => new Tuple>(childContext.CategoryBoundaryName, + childContext.WrappedData)); + return new WaveHeightCalculationsGroupProperties(context.WrappedData, calculationsPerCategoryBoundary); + } + }; + yield return new PropertyInfo + { + CreateInstance = context => new AssemblyResultCategoriesProperties(context.GetAssemblyCategoriesFunc(), context.WrappedData) + }; + } + + /// + /// Returns all instances provided for data of . + /// + public override IEnumerable GetViewInfos() + { + yield return new ViewInfo + { + GetViewName = (view, context) => RingtoetsDataResources.FailureMechanismContribution_DisplayName, + GetViewData = context => context.WrappedData, + Image = RingtoetsCommonFormsResources.FailureMechanismContributionIcon, + CloseForData = CloseFailureMechanismContributionViewForData, + CreateInstance = context => new FailureMechanismContributionView(context.Parent, Gui.ViewCommands) + }; + + yield return new ViewInfo + { + GetViewName = (view, context) => RingtoetsCommonFormsResources.Norms_DisplayName, + Image = RingtoetsCommonFormsResources.NormsIcon, + CloseForData = CloseAssessmentSectionCategoriesViewForData, + CreateInstance = context => new AssessmentSectionAssemblyCategoriesView(context.AssessmentSection.FailureMechanismContribution) + }; + + yield return new ViewInfo, DesignWaterLevelCalculationsView> + { + GetViewName = (view, context) => $"{RingtoetsCommonFormsResources.WaterLevelCalculations_DisplayName} - " + + $"{RingtoetsPluginHelper.FormatCategoryBoundaryName(context.CategoryBoundaryName)}", + GetViewData = context => context.WrappedData, + Image = RingtoetsCommonFormsResources.GenericInputOutputIcon, + CloseForData = CloseHydraulicBoundaryCalculationsViewForData, + CreateInstance = context => new DesignWaterLevelCalculationsView(context.WrappedData, + context.AssessmentSection, + context.GetNormFunc, + context.CategoryBoundaryName), + AfterCreate = (view, context) => + { + view.CalculationGuiService = hydraulicBoundaryLocationCalculationGuiService; + } + }; + + yield return new ViewInfo, WaveHeightCalculationsView> + { + GetViewName = (view, context) => $"{RingtoetsCommonFormsResources.WaveHeightCalculations_DisplayName} - " + + $"{RingtoetsPluginHelper.FormatCategoryBoundaryName(context.CategoryBoundaryName)}", + GetViewData = context => context.WrappedData, + Image = RingtoetsCommonFormsResources.GenericInputOutputIcon, + CloseForData = CloseHydraulicBoundaryCalculationsViewForData, + CreateInstance = context => new WaveHeightCalculationsView(context.WrappedData, + context.AssessmentSection, + context.GetNormFunc, + context.CategoryBoundaryName), + AfterCreate = (view, context) => + { + view.CalculationGuiService = hydraulicBoundaryLocationCalculationGuiService; + } + }; + + yield return new ViewInfo + { + GetViewName = (view, section) => RingtoetsFormsResources.AssessmentSectionMap_DisplayName, + Image = RingtoetsFormsResources.Map, + CreateInstance = section => new AssessmentSectionView(section) + }; + + yield return CreateFailureMechanismWithDetailedAssessmentViewInfo( + context => new FailureMechanismWithDetailedAssessmentView( + context.WrappedData, + context.Parent, + () => MacroStabilityOutwardsAssemblyMapDataFeaturesFactory.CreateSimpleAssemblyFeatures(context.WrappedData), + () => MacroStabilityOutwardsAssemblyMapDataFeaturesFactory.CreateDetailedAssemblyFeatures(context.WrappedData, context.Parent), + () => MacroStabilityOutwardsAssemblyMapDataFeaturesFactory.CreateTailorMadeAssemblyFeatures(context.WrappedData, context.Parent), + () => MacroStabilityOutwardsAssemblyMapDataFeaturesFactory.CreateCombinedAssemblyFeatures(context.WrappedData, context.Parent))); + + yield return CreateFailureMechanismWithDetailedAssessmentViewInfo( + context => new FailureMechanismWithDetailedAssessmentView( + context.WrappedData, + context.Parent, + () => MicrostabilityAssemblyMapDataFeaturesFactory.CreateSimpleAssemblyFeatures(context.WrappedData), + () => MicrostabilityAssemblyMapDataFeaturesFactory.CreateDetailedAssemblyFeatures(context.WrappedData), + () => MicrostabilityAssemblyMapDataFeaturesFactory.CreateTailorMadeAssemblyFeatures(context.WrappedData), + () => MicrostabilityAssemblyMapDataFeaturesFactory.CreateCombinedAssemblyFeatures(context.WrappedData))); + + yield return CreateFailureMechanismWithDetailedAssessmentViewInfo( + context => new FailureMechanismWithDetailedAssessmentView( + context.WrappedData, + context.Parent, + () => GrassCoverSlipOffOutwardsAssemblyMapDataFeaturesFactory.CreateSimpleAssemblyFeatures(context.WrappedData), + () => GrassCoverSlipOffOutwardsAssemblyMapDataFeaturesFactory.CreateDetailedAssemblyFeatures(context.WrappedData), + () => GrassCoverSlipOffOutwardsAssemblyMapDataFeaturesFactory.CreateTailorMadeAssemblyFeatures(context.WrappedData), + () => GrassCoverSlipOffOutwardsAssemblyMapDataFeaturesFactory.CreateCombinedAssemblyFeatures(context.WrappedData))); + + yield return CreateFailureMechanismWithDetailedAssessmentViewInfo( + context => new FailureMechanismWithDetailedAssessmentView( + context.WrappedData, + context.Parent, + () => GrassCoverSlipOffInwardsAssemblyMapDataFeaturesFactory.CreateSimpleAssemblyFeatures(context.WrappedData), + () => GrassCoverSlipOffInwardsAssemblyMapDataFeaturesFactory.CreateDetailedAssemblyFeatures(context.WrappedData), + () => GrassCoverSlipOffInwardsAssemblyMapDataFeaturesFactory.CreateTailorMadeAssemblyFeatures(context.WrappedData), + () => GrassCoverSlipOffInwardsAssemblyMapDataFeaturesFactory.CreateCombinedAssemblyFeatures(context.WrappedData))); + + yield return CreateFailureMechanismWithDetailedAssessmentViewInfo( + context => new FailureMechanismWithDetailedAssessmentView( + context.WrappedData, + context.Parent, + () => PipingStructureAssemblyMapDataFeaturesFactory.CreateSimpleAssemblyFeatures(context.WrappedData), + () => PipingStructureAssemblyMapDataFeaturesFactory.CreateDetailedAssemblyFeatures(context.WrappedData), + () => PipingStructureAssemblyMapDataFeaturesFactory.CreateTailorMadeAssemblyFeatures(context.WrappedData), + () => PipingStructureAssemblyMapDataFeaturesFactory.CreateCombinedAssemblyFeatures(context.WrappedData))); + + yield return CreateFailureMechanismWithoutDetailedAssessmentViewInfo( + context => new FailureMechanismWithoutDetailedAssessmentView( + context.WrappedData, + context.Parent, + () => StrengthStabilityLengthwiseConstructionAssemblyMapDataFeaturesFactory.CreateSimpleAssemblyFeatures(context.WrappedData), + () => StrengthStabilityLengthwiseConstructionAssemblyMapDataFeaturesFactory.CreateTailorMadeAssemblyFeatures(context.WrappedData), + () => StrengthStabilityLengthwiseConstructionAssemblyMapDataFeaturesFactory.CreateCombinedAssemblyFeatures(context.WrappedData))); + + yield return CreateFailureMechanismWithoutDetailedAssessmentViewInfo( + context => new FailureMechanismWithoutDetailedAssessmentView( + context.WrappedData, + context.Parent, + () => TechnicalInnovationAssemblyMapDataFeaturesFactory.CreateSimpleAssemblyFeatures(context.WrappedData), + () => TechnicalInnovationAssemblyMapDataFeaturesFactory.CreateTailorMadeAssemblyFeatures(context.WrappedData), + () => TechnicalInnovationAssemblyMapDataFeaturesFactory.CreateCombinedAssemblyFeatures(context.WrappedData))); + + yield return CreateFailureMechanismWithoutDetailedAssessmentViewInfo( + context => new FailureMechanismWithoutDetailedAssessmentView( + context.WrappedData, + context.Parent, + () => WaterPressureAsphaltCoverAssemblyMapDataFeaturesFactory.CreateSimpleAssemblyFeatures(context.WrappedData), + () => WaterPressureAsphaltCoverAssemblyMapDataFeaturesFactory.CreateTailorMadeAssemblyFeatures(context.WrappedData), + () => WaterPressureAsphaltCoverAssemblyMapDataFeaturesFactory.CreateCombinedAssemblyFeatures(context.WrappedData))); + + yield return CreateFailureMechanismResultViewInfo< + GrassCoverSlipOffInwardsFailureMechanism, + GrassCoverSlipOffInwardsFailureMechanismSectionResult, + GrassCoverSlipOffInwardsResultView, + GrassCoverSlipOffInwardsSectionResultRow, + FailureMechanismAssemblyCategoryGroupControl>( + context => new GrassCoverSlipOffInwardsResultView( + context.WrappedData, + (GrassCoverSlipOffInwardsFailureMechanism) context.FailureMechanism)); + + yield return CreateFailureMechanismResultViewInfo< + GrassCoverSlipOffOutwardsFailureMechanism, + GrassCoverSlipOffOutwardsFailureMechanismSectionResult, + GrassCoverSlipOffOutwardsResultView, + GrassCoverSlipOffOutwardsSectionResultRow, + FailureMechanismAssemblyCategoryGroupControl>( + context => new GrassCoverSlipOffOutwardsResultView( + context.WrappedData, + (GrassCoverSlipOffOutwardsFailureMechanism) context.FailureMechanism)); + + yield return CreateFailureMechanismResultViewInfo< + MicrostabilityFailureMechanism, + MicrostabilityFailureMechanismSectionResult, + MicrostabilityResultView, + MicrostabilitySectionResultRow, + FailureMechanismAssemblyCategoryGroupControl>( + context => new MicrostabilityResultView( + context.WrappedData, + (MicrostabilityFailureMechanism) context.FailureMechanism)); + + yield return CreateFailureMechanismResultViewInfo< + PipingStructureFailureMechanism, + PipingStructureFailureMechanismSectionResult, + PipingStructureResultView, + PipingStructureSectionResultRow, + FailureMechanismAssemblyCategoryGroupControl>( + context => new PipingStructureResultView( + context.WrappedData, + (PipingStructureFailureMechanism) context.FailureMechanism)); + + yield return CreateFailureMechanismResultViewInfo< + TechnicalInnovationFailureMechanism, + TechnicalInnovationFailureMechanismSectionResult, + TechnicalInnovationResultView, + TechnicalInnovationSectionResultRow, + FailureMechanismAssemblyCategoryGroupControl>( + context => new TechnicalInnovationResultView( + context.WrappedData, + (TechnicalInnovationFailureMechanism) context.FailureMechanism)); + + yield return CreateFailureMechanismResultViewInfo< + StrengthStabilityLengthwiseConstructionFailureMechanism, + StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult, + StrengthStabilityLengthwiseConstructionResultView, + StrengthStabilityLengthwiseConstructionSectionResultRow, + FailureMechanismAssemblyCategoryGroupControl>( + context => new StrengthStabilityLengthwiseConstructionResultView( + context.WrappedData, + (StrengthStabilityLengthwiseConstructionFailureMechanism) context.FailureMechanism)); + + yield return CreateFailureMechanismResultViewInfo< + WaterPressureAsphaltCoverFailureMechanism, + WaterPressureAsphaltCoverFailureMechanismSectionResult, + WaterPressureAsphaltCoverResultView, + WaterPressureAsphaltCoverSectionResultRow, + FailureMechanismAssemblyCategoryGroupControl>( + context => new WaterPressureAsphaltCoverResultView( + context.WrappedData, + (WaterPressureAsphaltCoverFailureMechanism) context.FailureMechanism)); + + yield return new ViewInfo< + ProbabilityFailureMechanismSectionResultContext, + IObservableEnumerable, + MacroStabilityOutwardsResultView> + { + GetViewName = (view, context) => RingtoetsCommonFormsResources.FailureMechanism_AssessmentResult_DisplayName, + Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, + CloseForData = CloseFailureMechanismResultViewForData, + GetViewData = context => context.WrappedData, + CreateInstance = context => new MacroStabilityOutwardsResultView( + context.WrappedData, + (MacroStabilityOutwardsFailureMechanism) context.FailureMechanism, + context.AssessmentSection) + }; + + yield return new ViewInfo + { + GetViewName = (view, comment) => Resources.Comment_DisplayName, + GetViewData = comment => comment, + Image = RingtoetsCommonFormsResources.EditDocumentIcon, + CloseForData = CloseCommentViewForData + }; + + yield return new ViewInfo, FailureMechanismSectionsView> + { + GetViewName = (view, context) => RingtoetsCommonFormsResources.FailureMechanismSections_DisplayName, + Image = RingtoetsCommonFormsResources.SectionsIcon, + CloseForData = RingtoetsPluginHelper.ShouldCloseForFailureMechanismView, + CreateInstance = context => new FailureMechanismSectionsView(context.WrappedData.Sections, context.WrappedData), + GetViewData = context => context.WrappedData.Sections + }; + + yield return new ViewInfo + { + Image = RingtoetsCommonFormsResources.GeneralOutputIcon, + GetViewName = (view, context) => RingtoetsCommonFormsResources.CalculationOutput_DisplayName, + GetViewData = context => context.WrappedData, + CloseForData = RingtoetsPluginHelper.ShouldCloseViewWithCalculationData, + CreateInstance = context => new GeneralResultFaultTreeIllustrationPointView(() => context.WrappedData.Output?.GeneralResult) + }; + + yield return new ViewInfo + { + GetViewName = (view, context) => RingtoetsCommonFormsResources.CombinedAssembly_DisplayName, + Image = Resources.AssemblyResultTotal, + CloseForData = CloseAssemblyResultTotalViewForData, + CreateInstance = context => new AssemblyResultTotalView(context.WrappedData) + }; + + yield return new ViewInfo + { + GetViewName = (view, context) => RingtoetsFormsResources.AssemblyResultPerSection_DisplayName, + Image = Resources.AssemblyResultPerSection, + CloseForData = CloseAssemblyResultPerSectionViewForData, + CreateInstance = context => new AssemblyResultPerSectionView(context.WrappedData) + }; + + yield return new ViewInfo + { + GetViewName = (view, context) => RingtoetsCommonFormsResources.AssemblyCategories_DisplayName, + Image = RingtoetsCommonFormsResources.NormsIcon, + CloseForData = RingtoetsPluginHelper.ShouldCloseForFailureMechanismView, + CreateInstance = context => new FailureMechanismAssemblyCategoriesView(context.WrappedData, + context.AssessmentSection, + context.GetFailureMechanismCategoriesFunc, + context.GetFailureMechanismSectionAssemblyCategoriesFunc) + }; + + yield return new ViewInfo + { + GetViewName = (view, context) => RingtoetsCommonFormsResources.AssemblyCategories_DisplayName, + Image = RingtoetsCommonFormsResources.NormsIcon, + CloseForData = RingtoetsPluginHelper.ShouldCloseForFailureMechanismView, + CreateInstance = context => new MacroStabilityOutwardsAssemblyCategoriesView((MacroStabilityOutwardsFailureMechanism) context.WrappedData, + context.AssessmentSection, + context.GetFailureMechanismSectionAssemblyCategoriesFunc) + }; + yield return new ViewInfo + { + GetViewName = (view, context) => RingtoetsCommonFormsResources.AssemblyCategories_DisplayName, + Image = RingtoetsCommonFormsResources.NormsIcon, + CloseForData = CloseAssemblyResultCategoriesViewForData, + CreateInstance = context => new AssemblyResultCategoriesView(context.WrappedData, + context.GetAssemblyCategoriesFunc) + }; + yield return new ViewInfo + { + GetViewName = (view, context) => RingtoetsFormsResources.AssemblyResultPerSectionMapView_DisplayName, + Image = Resources.AssemblyResultPerSectionMap, + CloseForData = CloseAssemblyResultPerSectionMapViewForData, + CreateInstance = context => new AssemblyResultPerSectionMapView(context.WrappedData) + }; + } + + public override IEnumerable GetImportInfos() + { + yield return new ImportInfo + { + Name = RingtoetsCommonDataResources.ReferenceLine_DisplayName, + Category = RingtoetsCommonFormsResources.Ringtoets_Category, + Image = RingtoetsCommonFormsResources.ReferenceLineIcon, + FileFilterGenerator = new FileFilterGenerator(RingtoetsCommonIOResources.Shape_file_filter_Extension, + RingtoetsCommonIOResources.Shape_file_filter_Description), + CreateFileImporter = (context, filePath) => new ReferenceLineImporter(context.WrappedData, + new ReferenceLineUpdateHandler(context.AssessmentSection, Gui.ViewCommands), + filePath) + }; + + yield return new ImportInfo + { + Name = RingtoetsCommonFormsResources.FailureMechanismSections_DisplayName, + Category = RingtoetsCommonFormsResources.Ringtoets_Category, + Image = RingtoetsCommonFormsResources.SectionsIcon, + FileFilterGenerator = new FileFilterGenerator(RingtoetsCommonIOResources.Shape_file_filter_Extension, + RingtoetsCommonIOResources.Shape_file_filter_Description), + IsEnabled = context => HasGeometry(context.AssessmentSection.ReferenceLine), + CreateFileImporter = (context, filePath) => new FailureMechanismSectionsImporter(context.WrappedData, + context.AssessmentSection.ReferenceLine, + filePath, + new FailureMechanismSectionReplaceStrategy(context.WrappedData), + new ImportMessageProvider()) + }; + + yield return new ImportInfo + { + CreateFileImporter = (context, filePath) => + new ForeshoreProfilesImporter(context.WrappedData, + context.ParentAssessmentSection.ReferenceLine, + filePath, + new ForeshoreProfileReplaceDataStrategy(context.ParentFailureMechanism, + context.WrappedData), + new ImportMessageProvider()), + Name = Resources.ForeshoreProfilesImporter_DisplayName, + Category = RingtoetsCommonFormsResources.Ringtoets_Category, + Image = Resources.Foreshore, + FileFilterGenerator = CreateForeshoreProfileFileFilterGenerator, + IsEnabled = context => HasGeometry(context.ParentAssessmentSection.ReferenceLine), + VerifyUpdates = context => VerifyForeshoreProfileUpdates(context, Resources.RingtoetsPlugin_VerifyForeshoreProfileUpdates_When_importing_ForeshoreProfile_definitions_assigned_to_calculations_output_will_be_cleared_confirm) + }; + + yield return new ImportInfo + { + Name = RingtoetsCommonDataResources.HydraulicBoundaryConditions_DisplayName, + Image = RingtoetsCommonFormsResources.DatabaseIcon, + Category = RingtoetsCommonFormsResources.Ringtoets_Category, + FileFilterGenerator = new FileFilterGenerator(Resources.HydraulicBoundaryDatabase_FilePath_Extension, + Resources.HydraulicBoundaryDatabase_file_filter_Description), + CreateFileImporter = (context, filePath) => new HydraulicBoundaryDatabaseImporter( + context.WrappedData, new HydraulicBoundaryDatabaseUpdateHandler(context.AssessmentSection, + new DuneLocationsReplacementHandler( + Gui.ViewCommands, context.AssessmentSection.DuneErosion)), + filePath) + }; + } + + public override IEnumerable GetExportInfos() + { + yield return new ExportInfo + { + Name = RingtoetsCommonDataResources.ReferenceLine_DisplayName, + CreateFileExporter = (context, filePath) => new ReferenceLineExporter(context.WrappedData, context.AssessmentSection.Id, filePath), + IsEnabled = context => HasGeometry(context.AssessmentSection.ReferenceLine), + FileFilterGenerator = new FileFilterGenerator(RingtoetsCommonIOResources.Shape_file_filter_Extension, + RingtoetsCommonIOResources.Shape_file_filter_Description) + }; + + yield return new ExportInfo + { + Name = RingtoetsCommonDataResources.HydraulicBoundaryConditions_DisplayName, + CreateFileExporter = (context, filePath) => new HydraulicBoundaryLocationsExporter(context.AssessmentSection, filePath), + IsEnabled = context => context.WrappedData.IsLinked(), + FileFilterGenerator = new FileFilterGenerator(RingtoetsCommonIOResources.Shape_file_filter_Extension, + RingtoetsCommonIOResources.Shape_file_filter_Description) + }; + + yield return new ExportInfo + { + Name = RingtoetsCommonFormsResources.AssemblyResult_DisplayName, + CreateFileExporter = (context, filePath) => new AssemblyExporter(context.WrappedData, filePath), + IsEnabled = context => HasGeometry(context.WrappedData.ReferenceLine), + FileFilterGenerator = new FileFilterGenerator(Resources.AssemblyResult_file_filter_Extension, + RingtoetsCommonFormsResources.AssemblyResult_DisplayName) + }; + } + + public override IEnumerable GetUpdateInfos() + { + yield return new UpdateInfo + { + CreateFileImporter = (context, filePath) => + new ForeshoreProfilesImporter(context.WrappedData, + context.ParentAssessmentSection.ReferenceLine, + filePath, + new ForeshoreProfileUpdateDataStrategy(context.ParentFailureMechanism, context.WrappedData), + new UpdateMessageProvider()), + Name = Resources.ForeshoreProfilesImporter_DisplayName, + Category = RingtoetsCommonFormsResources.Ringtoets_Category, + Image = Resources.Foreshore, + FileFilterGenerator = CreateForeshoreProfileFileFilterGenerator, + CurrentPath = context => context.WrappedData.SourcePath, + IsEnabled = context => context.WrappedData.SourcePath != null, + VerifyUpdates = context => VerifyForeshoreProfileUpdates(context, Resources.RingtoetsPlugin_VerifyForeshoreProfileUpdates_When_updating_ForeshoreProfile_definitions_assigned_to_calculations_output_will_be_cleared_confirm) + }; + + yield return RingtoetsUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo< + GrassCoverSlipOffInwardsFailureMechanismSectionsContext, GrassCoverSlipOffInwardsFailureMechanism, GrassCoverSlipOffInwardsFailureMechanismSectionResult>( + new GrassCoverSlipOffInwardsFailureMechanismSectionResultUpdateStrategy()); + + yield return RingtoetsUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo< + GrassCoverSlipOffOutwardsFailureMechanismSectionsContext, GrassCoverSlipOffOutwardsFailureMechanism, GrassCoverSlipOffOutwardsFailureMechanismSectionResult>( + new GrassCoverSlipOffOutwardsFailureMechanismSectionResultUpdateStrategy()); + + yield return RingtoetsUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo< + MacroStabilityOutwardsFailureMechanismSectionsContext, MacroStabilityOutwardsFailureMechanism, MacroStabilityOutwardsFailureMechanismSectionResult>( + new MacroStabilityOutwardsFailureMechanismSectionResultUpdateStrategy()); + + yield return RingtoetsUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo< + MicrostabilityFailureMechanismSectionsContext, MicrostabilityFailureMechanism, MicrostabilityFailureMechanismSectionResult>( + new MicrostabilityFailureMechanismSectionResultUpdateStrategy()); + + yield return RingtoetsUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo< + PipingStructureFailureMechanismSectionsContext, PipingStructureFailureMechanism, PipingStructureFailureMechanismSectionResult>( + new PipingStructureFailureMechanismSectionResultUpdateStrategy()); + + yield return RingtoetsUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo< + StrengthStabilityLengthwiseConstructionFailureMechanismSectionsContext, StrengthStabilityLengthwiseConstructionFailureMechanism, StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult>( + new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultUpdateStrategy()); + + yield return RingtoetsUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo< + TechnicalInnovationFailureMechanismSectionsContext, TechnicalInnovationFailureMechanism, TechnicalInnovationFailureMechanismSectionResult>( + new TechnicalInnovationFailureMechanismSectionResultUpdateStrategy()); + + yield return RingtoetsUpdateInfoFactory.CreateFailureMechanismSectionsUpdateInfo< + WaterPressureAsphaltCoverFailureMechanismSectionsContext, WaterPressureAsphaltCoverFailureMechanism, WaterPressureAsphaltCoverFailureMechanismSectionResult>( + new WaterPressureAsphaltCoverFailureMechanismSectionResultUpdateStrategy()); + } + + /// + /// Gets the child data instances that have definitions of some parent data object. + /// + /// The parent data object. + /// Sequence of child data. + public override IEnumerable GetChildDataWithViewDefinitions(object viewData) + { + var project = viewData as RingtoetsProject; + if (project != null) + { + foreach (AssessmentSection item in project.AssessmentSections) + { + yield return item; + } + } + + var assessmentSection = viewData as IAssessmentSection; + if (assessmentSection != null) + { + yield return assessmentSection.FailureMechanismContribution; + } + } + + /// + /// Returns all instances provided for data of . + /// + public override IEnumerable GetTreeNodeInfos() + { + yield return new TreeNodeInfo + { + Text = assessmentSection => assessmentSection.Name, + Image = assessmentSection => RingtoetsFormsResources.AssessmentSectionFolderIcon, + EnsureVisibleOnCreate = (assessmentSection, parent) => true, + ExpandOnCreate = assessmentSection => true, + ChildNodeObjects = AssessmentSectionChildNodeObjects, + ContextMenuStrip = AssessmentSectionContextMenuStrip, + CanRename = (assessmentSection, parentData) => true, + OnNodeRenamed = AssessmentSectionOnNodeRenamed, + CanRemove = (assessmentSection, parentNodeData) => true, + OnNodeRemoved = AssessmentSectionOnNodeRemoved + }; + + yield return new TreeNodeInfo + { + Text = data => Resources.RingtoetsPlugin_BackgroundDataContext_Text, + Image = data => RingtoetsFormsResources.Map, + ContextMenuStrip = BackgroundDataMenuStrip, + ForeColor = data => + { + var configuration = data.Configuration as WmtsBackgroundDataConfiguration; + return configuration != null + && configuration.IsConfigured + ? Color.FromKnownColor(KnownColor.ControlText) + : Color.FromKnownColor(configuration == null + ? KnownColor.ControlText + : KnownColor.GrayText); + } + }; + + yield return new TreeNodeInfo + { + Text = context => RingtoetsCommonDataResources.ReferenceLine_DisplayName, + Image = context => RingtoetsCommonFormsResources.ReferenceLineIcon, + ForeColor = context => HasGeometry(context.WrappedData) + ? Color.FromKnownColor(KnownColor.ControlText) + : Color.FromKnownColor(KnownColor.GrayText), + ContextMenuStrip = ReferenceLineContextMenuStrip + }; + + yield return new TreeNodeInfo + { + Text = context => RingtoetsCommonFormsResources.Norms_DisplayName, + Image = context => RingtoetsCommonFormsResources.NormsIcon, + ContextMenuStrip = NormContextMenuStrip + }; + + yield return RingtoetsTreeNodeInfoFactory.CreateFailureMechanismContextTreeNodeInfo( + GrassCoverSlipOffInwardsFailureMechanismEnabledChildNodeObjects, + StandAloneFailureMechanismDisabledChildNodeObjects, + StandAloneFailureMechanismEnabledContextMenuStrip, + StandAloneFailureMechanismDisabledContextMenuStrip); + + yield return RingtoetsTreeNodeInfoFactory.CreateFailureMechanismContextTreeNodeInfo( + GrassCoverSlipOffOutwardsFailureMechanismEnabledChildNodeObjects, + StandAloneFailureMechanismDisabledChildNodeObjects, + StandAloneFailureMechanismEnabledContextMenuStrip, + StandAloneFailureMechanismDisabledContextMenuStrip); + + yield return RingtoetsTreeNodeInfoFactory.CreateFailureMechanismContextTreeNodeInfo( + MacroStabilityOutwardsFailureMechanismEnabledChildNodeObjects, + StandAloneFailureMechanismDisabledChildNodeObjects, + StandAloneFailureMechanismEnabledContextMenuStrip, + StandAloneFailureMechanismDisabledContextMenuStrip); + + yield return RingtoetsTreeNodeInfoFactory.CreateFailureMechanismContextTreeNodeInfo( + MicrostabilityFailureMechanismEnabledChildNodeObjects, + StandAloneFailureMechanismDisabledChildNodeObjects, + StandAloneFailureMechanismEnabledContextMenuStrip, + StandAloneFailureMechanismDisabledContextMenuStrip); + + yield return RingtoetsTreeNodeInfoFactory.CreateFailureMechanismContextTreeNodeInfo( + PipingStructureFailureMechanismEnabledChildNodeObjects, + StandAloneFailureMechanismDisabledChildNodeObjects, + StandAloneFailureMechanismEnabledContextMenuStrip, + StandAloneFailureMechanismDisabledContextMenuStrip); + + yield return RingtoetsTreeNodeInfoFactory.CreateFailureMechanismContextTreeNodeInfo( + StrengthStabilityLengthwiseConstructionFailureMechanismEnabledChildNodeObjects, + StandAloneFailureMechanismDisabledChildNodeObjects, + StandAloneFailureMechanismEnabledContextMenuStrip, + StandAloneFailureMechanismDisabledContextMenuStrip); + + yield return RingtoetsTreeNodeInfoFactory.CreateFailureMechanismContextTreeNodeInfo( + TechnicalInnovationFailureMechanismEnabledChildNodeObjects, + StandAloneFailureMechanismDisabledChildNodeObjects, + StandAloneFailureMechanismEnabledContextMenuStrip, + StandAloneFailureMechanismDisabledContextMenuStrip); + + yield return RingtoetsTreeNodeInfoFactory.CreateFailureMechanismContextTreeNodeInfo( + WaterPressureAsphaltCoverFailureMechanismEnabledChildNodeObjects, + StandAloneFailureMechanismDisabledChildNodeObjects, + StandAloneFailureMechanismEnabledContextMenuStrip, + StandAloneFailureMechanismDisabledContextMenuStrip); + + yield return new TreeNodeInfo + { + Text = context => RingtoetsCommonFormsResources.FailureMechanismSections_DisplayName, + Image = context => RingtoetsCommonFormsResources.SectionsIcon, + ForeColor = context => context.WrappedData.Sections.Any() + ? Color.FromKnownColor(KnownColor.ControlText) + : Color.FromKnownColor(KnownColor.GrayText), + ContextMenuStrip = FailureMechanismSectionsContextMenuStrip + }; + + yield return new TreeNodeInfo + { + Text = categoryTreeFolder => categoryTreeFolder.Name, + Image = categoryTreeFolder => GetFolderIcon(categoryTreeFolder.Category), + ChildNodeObjects = categoryTreeFolder => categoryTreeFolder.Contents.ToArray(), + ContextMenuStrip = CategoryTreeFolderContextMenu + }; + + yield return new TreeNodeInfo + { + Text = failureMechanismContribution => RingtoetsDataResources.FailureMechanismContribution_DisplayName, + Image = failureMechanismContribution => RingtoetsCommonFormsResources.FailureMechanismContributionIcon, + ContextMenuStrip = (failureMechanismContribution, parentData, treeViewControl) => Gui.Get(failureMechanismContribution, treeViewControl) + .AddOpenItem() + .AddSeparator() + .AddPropertiesItem() + .Build() + }; + + yield return new TreeNodeInfo + { + Text = hydraulicBoundaryDatabase => RingtoetsCommonDataResources.HydraulicBoundaryConditions_DisplayName, + Image = hydraulicBoundaryDatabase => RingtoetsCommonFormsResources.GeneralFolderIcon, + ForeColor = context => context.WrappedData.IsLinked() + ? Color.FromKnownColor(KnownColor.ControlText) + : Color.FromKnownColor(KnownColor.GrayText), + ChildNodeObjects = HydraulicBoundaryDatabaseChildNodeObjects, + ContextMenuStrip = HydraulicBoundaryDatabaseContextMenuStrip + }; + + yield return new TreeNodeInfo + { + Text = context => RingtoetsCommonFormsResources.WaterLevelCalculations_DisplayName, + Image = context => RingtoetsCommonFormsResources.GeneralFolderIcon, + ContextMenuStrip = DesignWaterLevelCalculationsGroupContextMenuStrip, + ChildNodeObjects = DesignWaterLevelCalculationsGroupContextChildNodeObjects + }; + + yield return new TreeNodeInfo + { + Text = context => RingtoetsPluginHelper.FormatCategoryBoundaryName(context.CategoryBoundaryName), + Image = context => RingtoetsCommonFormsResources.GenericInputOutputIcon, + ContextMenuStrip = DesignWaterLevelCalculationsContextMenuStrip + }; + + yield return new TreeNodeInfo + { + Text = context => RingtoetsCommonFormsResources.WaveHeightCalculations_DisplayName, + Image = context => RingtoetsCommonFormsResources.GeneralFolderIcon, + ContextMenuStrip = WaveHeightCalculationsGroupContextMenuStrip, + ChildNodeObjects = WaveHeightCalculationsGroupContextChildNodeObjects + }; + + yield return new TreeNodeInfo + { + Text = context => RingtoetsPluginHelper.FormatCategoryBoundaryName(context.CategoryBoundaryName), + Image = context => RingtoetsCommonFormsResources.GenericInputOutputIcon, + ContextMenuStrip = WaveHeightCalculationsContextMenuStrip + }; + + yield return new TreeNodeInfo + { + Text = context => RingtoetsCommonFormsResources.ForeshoreProfiles_DisplayName, + Image = context => RingtoetsCommonFormsResources.GeneralFolderIcon, + ForeColor = context => context.WrappedData.Any() + ? Color.FromKnownColor(KnownColor.ControlText) + : Color.FromKnownColor(KnownColor.GrayText), + ChildNodeObjects = context => context.WrappedData + .Cast() + .ToArray(), + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddImportItem() + .AddUpdateItem() + .AddSeparator() + .AddCollapseAllItem() + .AddExpandAllItem() + .AddSeparator() + .AddPropertiesItem() + .Build() + }; + + yield return new TreeNodeInfo + { + Text = dikeProfile => dikeProfile.Name, + Image = context => RingtoetsCommonFormsResources.DikeProfile, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddPropertiesItem() + .Build() + }; + + yield return new TreeNodeInfo + { + Text = foreshoreProfile => foreshoreProfile.Name, + Image = context => Resources.Foreshore, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddPropertiesItem() + .Build() + }; + + yield return CreateFailureMechanismSectionResultTreeNodeInfo(); + yield return CreateFailureMechanismSectionResultTreeNodeInfo(); + yield return CreateFailureMechanismSectionResultTreeNodeInfo(); + yield return CreateFailureMechanismSectionResultTreeNodeInfo(); + yield return CreateFailureMechanismSectionResultTreeNodeInfo(); + yield return CreateFailureMechanismSectionResultTreeNodeInfo(); + yield return CreateFailureMechanismSectionResultTreeNodeInfo(); + + yield return new TreeNodeInfo> + { + Text = context => RingtoetsCommonFormsResources.FailureMechanism_AssessmentResult_DisplayName, + Image = context => RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .Build() + }; + + yield return new TreeNodeInfo + { + Text = comment => Resources.Comment_DisplayName, + Image = context => RingtoetsCommonFormsResources.EditDocumentIcon, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .Build() + }; + + yield return new TreeNodeInfo + { + Text = project => project.Name, + Image = project => GuiResources.ProjectIcon, + ChildNodeObjects = nodeData => nodeData.AssessmentSections.Cast().ToArray(), + ContextMenuStrip = (nodeData, parentData, treeViewControl) => + { + var addItem = new StrictContextMenuItem( + RingtoetsFormsResources.AddAssessmentSection_DisplayName, + RingtoetsCommonFormsResources.RingtoetsProject_ToolTip, + RingtoetsFormsResources.AddAssessmentSectionFolder, + (s, e) => assessmentSectionFromFileCommandHandler.AddAssessmentSectionFromFile()); + + return Gui.Get(nodeData, treeViewControl) + .AddCustomItem(addItem) + .AddSeparator() + .AddCollapseAllItem() + .AddExpandAllItem() + .AddSeparator() + .AddPropertiesItem() + .Build(); + } + }; + + yield return new TreeNodeInfo + { + Text = output => RingtoetsCommonFormsResources.CalculationOutput_DisplayName, + ForeColor = context => context.WrappedData.HasOutput + ? Color.FromKnownColor(KnownColor.ControlText) + : Color.FromKnownColor(KnownColor.GrayText), + Image = output => RingtoetsCommonFormsResources.GeneralOutputIcon, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .AddSeparator() + .AddPropertiesItem() + .Build() + }; + + yield return new TreeNodeInfo + { + Text = context => RingtoetsCommonFormsResources.CombinedAssembly_DisplayName, + Image = context => Resources.AssemblyResultTotal, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .Build() + }; + + yield return new TreeNodeInfo + { + Text = context => RingtoetsFormsResources.AssemblyResultPerSection_DisplayName, + Image = context => Resources.AssemblyResultPerSection, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .Build() + }; + + yield return new TreeNodeInfo + { + Text = context => RingtoetsCommonFormsResources.AssemblyCategories_DisplayName, + Image = context => RingtoetsCommonFormsResources.NormsIcon, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .AddSeparator() + .AddPropertiesItem() + .Build() + }; + + yield return new TreeNodeInfo + { + Text = context => RingtoetsCommonFormsResources.AssemblyCategories_DisplayName, + Image = context => RingtoetsCommonFormsResources.NormsIcon, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .AddSeparator() + .AddPropertiesItem() + .Build() + }; + + yield return new TreeNodeInfo + { + Text = context => Resources.AssemblyResultsCategoryTreeFolder_DisplayName, + Image = context => RingtoetsCommonFormsResources.GeneralFolderIcon, + ChildNodeObjects = AssemblyResultsContextChildNodeObjects, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddExportItem() + .AddSeparator() + .AddCollapseAllItem() + .AddExpandAllItem() + .Build() + }; + + yield return new TreeNodeInfo + { + Text = context => RingtoetsCommonFormsResources.AssemblyCategories_DisplayName, + Image = context => RingtoetsCommonFormsResources.NormsIcon, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .AddSeparator() + .AddPropertiesItem() + .Build() + }; + + yield return new TreeNodeInfo + { + Text = context => Resources.AssemblyResultPerSection_Map_DisplayName, + Image = context => Resources.AssemblyResultPerSectionMap, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .Build() + }; + } + + private static ViewInfo, IObservableEnumerable, TView> CreateFailureMechanismResultViewInfo< + TFailureMechanism, TResult, TView, TResultRow, TAssemblyResultControl>( + Func, TView> createInstanceFunc) + where TResult : FailureMechanismSectionResult + where TView : FailureMechanismResultView + where TFailureMechanism : FailureMechanismBase, IHasSectionResults + where TResultRow : FailureMechanismSectionResultRow + where TAssemblyResultControl : AssemblyResultControl, new() + { + return new ViewInfo< + FailureMechanismSectionResultContext, + IObservableEnumerable, + TView> + { + GetViewName = (view, context) => RingtoetsCommonFormsResources.FailureMechanism_AssessmentResult_DisplayName, + Image = RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, + CloseForData = CloseFailureMechanismResultViewForData, + GetViewData = context => context.WrappedData, + CreateInstance = createInstanceFunc + }; + } + + private TreeNodeInfo> CreateFailureMechanismSectionResultTreeNodeInfo() + where T : FailureMechanismSectionResult + { + return new TreeNodeInfo> + { + Text = context => RingtoetsCommonFormsResources.FailureMechanism_AssessmentResult_DisplayName, + Image = context => RingtoetsCommonFormsResources.FailureMechanismSectionResultIcon, + ContextMenuStrip = (nodeData, parentData, treeViewControl) => Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .Build() + }; + } + + private static void RemoveOnOpenProjectListener(IProjectOwner projectOwner) + { + if (projectOwner != null) + { + projectOwner.ProjectOpened -= VerifyHydraulicBoundaryDatabasePath; + } + } + + private static void AddOnOpenProjectListener(IProjectOwner projectOwner) + { + if (projectOwner != null) + { + projectOwner.ProjectOpened += VerifyHydraulicBoundaryDatabasePath; + } + } + + private static void VerifyHydraulicBoundaryDatabasePath(IProject project) + { + var ringtoetsProject = project as RingtoetsProject; + if (ringtoetsProject == null) + { + return; + } + + IEnumerable sectionsWithHydraulicBoundaryDatabaseLinked = ringtoetsProject.AssessmentSections.Where(i => i.HydraulicBoundaryDatabase.IsLinked()); + foreach (AssessmentSection section in sectionsWithHydraulicBoundaryDatabaseLinked) + { + string validationProblem = HydraulicBoundaryDatabaseHelper.ValidateFilesForCalculation(section.HydraulicBoundaryDatabase.FilePath, + section.HydraulicBoundaryDatabase.EffectivePreprocessorDirectory()); + if (validationProblem != null) + { + log.WarnFormat( + RingtoetsCommonServiceResources.Hydraulic_boundary_database_connection_failed_0_, + validationProblem); + } + } + } + + private static bool HasGeometry(ReferenceLine referenceLine) + { + return referenceLine.Points.Any(); + } + + #region PropertyInfos + + private static TopLevelFaultTreeIllustrationPointProperties CreateTopLevelFaultTreeIllustrationPointProperties(SelectedTopLevelFaultTreeIllustrationPoint point) + { + return new TopLevelFaultTreeIllustrationPointProperties(point.TopLevelFaultTreeIllustrationPoint, + !point.ClosingSituations.HasMultipleUniqueValues(cs => cs)); + } + + #endregion + + private class FailureMechanismContextAssociation + { + private readonly Func createFailureMechanismContext; + private readonly Type failureMechanismType; + + public FailureMechanismContextAssociation(Type failureMechanismType, Func createFailureMechanismContext) + { + this.createFailureMechanismContext = createFailureMechanismContext; + this.failureMechanismType = failureMechanismType; + } + + public bool Match(IFailureMechanism failureMechanism) + { + return failureMechanism.GetType() == failureMechanismType; + } + + public object Create(IFailureMechanism failureMechanism, IAssessmentSection assessmentSection) + { + return createFailureMechanismContext(failureMechanism, assessmentSection); + } + } + + #region ViewInfos + + #region FailureMechanismWithDetailedAssessmentView ViewInfo + + private static ViewInfo> CreateFailureMechanismWithDetailedAssessmentViewInfo< + TFailureMechanismContext, TFailureMechanism, TSectionResult>( + Func> createInstanceFunc) + where TSectionResult : FailureMechanismSectionResult + where TFailureMechanism : FailureMechanismBase, IHasSectionResults + where TFailureMechanismContext : IFailureMechanismContext + { + return new ViewInfo> + { + GetViewName = (view, context) => context.WrappedData.Name, + Image = RingtoetsCommonFormsResources.CalculationIcon, + CloseForData = CloseFailureMechanismWithDetailedAssessmentViewForData, + AdditionalDataCheck = context => context.WrappedData.IsRelevant, + CreateInstance = createInstanceFunc + }; + } + + private static bool CloseFailureMechanismWithDetailedAssessmentViewForData( + FailureMechanismWithDetailedAssessmentView view, object o) + where TFailureMechanism : IHasSectionResults + where TSectionResult : FailureMechanismSectionResult + { + var assessmentSection = o as IAssessmentSection; + var failureMechanism = o as IFailureMechanism; + + return assessmentSection != null + ? ReferenceEquals(view.AssessmentSection, assessmentSection) + : ReferenceEquals(view.FailureMechanism, failureMechanism); + } + + #endregion + + #region FailureMechanismWithoutDetailedAssessmentView ViewInfo + + private static ViewInfo> CreateFailureMechanismWithoutDetailedAssessmentViewInfo< + TFailureMechanismContext, TFailureMechanism, TSectionResult>( + Func> createInstanceFunc) + where TSectionResult : FailureMechanismSectionResult + where TFailureMechanism : FailureMechanismBase, IHasSectionResults + where TFailureMechanismContext : IFailureMechanismContext + { + return new ViewInfo> + { + GetViewName = (view, context) => context.WrappedData.Name, + Image = RingtoetsCommonFormsResources.CalculationIcon, + CloseForData = CloseFailureMechanismWithoutDetailedAssessmentViewForData, + AdditionalDataCheck = context => context.WrappedData.IsRelevant, + CreateInstance = createInstanceFunc + }; + } + + private static bool CloseFailureMechanismWithoutDetailedAssessmentViewForData( + FailureMechanismWithoutDetailedAssessmentView view, object o) + where TFailureMechanism : IHasSectionResults + where TSectionResult : FailureMechanismSectionResult + { + var assessmentSection = o as IAssessmentSection; + var failureMechanism = o as IFailureMechanism; + + return assessmentSection != null + ? ReferenceEquals(view.AssessmentSection, assessmentSection) + : ReferenceEquals(view.FailureMechanism, failureMechanism); + } + + #endregion + + #region FailureMechanismContributionContext ViewInfo + + private static bool CloseFailureMechanismContributionViewForData(FailureMechanismContributionView view, object o) + { + var assessmentSection = o as IAssessmentSection; + return assessmentSection != null && assessmentSection == view.AssessmentSection; + } + + #endregion + + #region NormContext ViewInfo + + private static bool CloseAssessmentSectionCategoriesViewForData(AssessmentSectionAssemblyCategoriesView view, object o) + { + var assessmentSection = o as IAssessmentSection; + return assessmentSection != null && assessmentSection.FailureMechanismContribution == view.FailureMechanismContribution; + } + + #endregion + + #region FailureMechanismResults ViewInfo + + private static bool CloseFailureMechanismResultViewForData(TView view, object dataToCloseFor) + where TView : FailureMechanismResultView + where TFailureMechanism : FailureMechanismBase, IHasSectionResults + where TResult : FailureMechanismSectionResult + where TResultRow : FailureMechanismSectionResultRow + where TAssemblyResultControl : AssemblyResultControl, new() + { + var assessmentSection = dataToCloseFor as IAssessmentSection; + var failureMechanism = dataToCloseFor as IFailureMechanism; + var failureMechanismContext = dataToCloseFor as IFailureMechanismContext; + + if (assessmentSection != null) + { + return assessmentSection + .GetFailureMechanisms() + .OfType>() + .Any(fm => ReferenceEquals(view.FailureMechanism.SectionResults, fm.SectionResults)); + } + + if (failureMechanismContext != null) + { + failureMechanism = failureMechanismContext.WrappedData; + } + + var failureMechanismWithSectionResults = failureMechanism as IHasSectionResults; + + return failureMechanism != null && + failureMechanismWithSectionResults != null && + ReferenceEquals(view.FailureMechanism.SectionResults, failureMechanismWithSectionResults.SectionResults); + } + + #endregion + + #region HydraulicBoundaryCalculationsView ViewInfo + + private static bool CloseHydraulicBoundaryCalculationsViewForData(HydraulicBoundaryCalculationsView view, object dataToCloseFor) + { + IAssessmentSection viewData = view.AssessmentSection; + var assessmentSection = dataToCloseFor as IAssessmentSection; + + return assessmentSection != null && ReferenceEquals(viewData, assessmentSection); + } + + #endregion + + #region Comment ViewInfo + + private static bool CloseCommentViewForData(CommentView commentView, object o) + { + var calculationGroupContext = o as ICalculationContext; + if (calculationGroupContext != null) + { + return GetCommentElements(calculationGroupContext.WrappedData) + .Any(commentElement => ReferenceEquals(commentView.Data, commentElement)); + } + + var calculationContext = o as ICalculationContext; + var calculation = calculationContext?.WrappedData as ICalculation; + if (calculation != null) + { + return ReferenceEquals(commentView.Data, calculation.Comments); + } + + var failureMechanism = o as IFailureMechanism; + + var failureMechanismContext = o as IFailureMechanismContext; + if (failureMechanismContext != null) + { + failureMechanism = failureMechanismContext.WrappedData; + } + + if (failureMechanism != null) + { + return GetCommentElements(failureMechanism) + .Any(commentElement => ReferenceEquals(commentView.Data, commentElement)); + } + + var assessmentSection = o as IAssessmentSection; + if (assessmentSection != null) + { + return GetCommentElements(assessmentSection) + .Any(commentElement => ReferenceEquals(commentView.Data, commentElement)); + } + + return false; + } + + private static IEnumerable GetCommentElements(CalculationGroup calculationGroup) + { + return calculationGroup.GetCalculations().Select(c => c.Comments); + } + + private static IEnumerable GetCommentElements(IAssessmentSection assessmentSection) + { + yield return assessmentSection.Comments; + foreach (Comment comment in assessmentSection.GetFailureMechanisms().SelectMany(GetCommentElements)) + { + yield return comment; + } + } + + private static IEnumerable GetCommentElements(IFailureMechanism failureMechanism) + { + yield return failureMechanism.InputComments; + yield return failureMechanism.OutputComments; + yield return failureMechanism.NotRelevantComments; + foreach (ICalculation calculation in failureMechanism.Calculations) + { + yield return calculation.Comments; + } + } + + #endregion + + #region AssemblyResultTotalContext ViewInfo + + private static bool CloseAssemblyResultTotalViewForData(AssemblyResultTotalView view, object o) + { + var assessmentSection = o as AssessmentSection; + return assessmentSection != null && assessmentSection == view.AssessmentSection; + } + + #endregion + + #region AssemblyResultPerSectionContext ViewInfo + + private static bool CloseAssemblyResultPerSectionViewForData(AssemblyResultPerSectionView view, object o) + { + var assessmentSection = o as AssessmentSection; + return assessmentSection != null && assessmentSection == view.AssessmentSection; + } + + #endregion + + #region AssemblyResultCategoriesContext ViewInfo + + private bool CloseAssemblyResultCategoriesViewForData(AssemblyResultCategoriesView view, object o) + { + var assessmentSection = o as AssessmentSection; + return assessmentSection != null && assessmentSection == view.AssessmentSection; + } + + #endregion + + #region AssemblyResultPerSectionMapContext ViewInfo + + private static bool CloseAssemblyResultPerSectionMapViewForData(AssemblyResultPerSectionMapView view, object o) + { + var assessmentSection = o as AssessmentSection; + return assessmentSection != null && assessmentSection == view.AssessmentSection; + } + + #endregion + + #endregion + + #region TreeNodeInfos + + #region FailureMechanismSectionsContext TreeNodeInfo + + private ContextMenuStrip FailureMechanismSectionsContextMenuStrip(FailureMechanismSectionsContext nodeData, object parentData, TreeViewControl treeViewControl) + { + return Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .AddSeparator() + .AddImportItem() + .AddUpdateItem() + .AddSeparator() + .AddPropertiesItem() + .Build(); + } + + #endregion + + #region ReferenceLineContext TreeNodeInfo + + private ContextMenuStrip ReferenceLineContextMenuStrip(ReferenceLineContext nodeData, object parentData, TreeViewControl treeViewControl) + { + return Gui.Get(nodeData, treeViewControl) + .AddImportItem() + .AddExportItem() + .AddSeparator() + .AddPropertiesItem() + .Build(); + } + + #endregion + + #region NormContext TreeNodeInfo + + private ContextMenuStrip NormContextMenuStrip(NormContext nodeData, object parentData, TreeViewControl treeViewControl) + { + return Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .AddSeparator() + .AddPropertiesItem() + .Build(); + } + + #endregion + + #region BackgroundData treeNodeInfo + + private ContextMenuStrip BackgroundDataMenuStrip(BackgroundData nodeData, object parentData, TreeViewControl treeViewControl) + { + var assessmentSection = parentData as IAssessmentSection; + + var mapDataItem = new StrictContextMenuItem( + Resources.BackgroundData_SelectMapData, + Resources.BackgroundData_SelectMapData_Tooltip, + RingtoetsCommonFormsResources.MapsIcon, (sender, args) => SelectMapData(assessmentSection, nodeData)); + + return Gui.Get(nodeData, treeViewControl) + .AddCustomItem(mapDataItem) + .AddSeparator() + .AddPropertiesItem() + .Build(); + } + + private void SelectMapData(IAssessmentSection assessmentSection, BackgroundData backgroundData) + { + if (assessmentSection == null) + { + return; + } + + ImageBasedMapData currentData = BackgroundDataConverter.ConvertFrom(backgroundData); + using (var dialog = new BackgroundMapDataSelectionDialog(Gui.MainWindow, currentData)) + { + if (dialog.ShowDialog() == DialogResult.OK) + { + SetSelectedMapData(assessmentSection, dialog.SelectedMapData); + } + } + } + + private static void SetSelectedMapData(IAssessmentSection assessmentSection, ImageBasedMapData selectedMapData) + { + BackgroundData newBackgroundData = BackgroundDataConverter.ConvertTo(selectedMapData); + + assessmentSection.BackgroundData.IsVisible = newBackgroundData.IsVisible; + assessmentSection.BackgroundData.Name = newBackgroundData.Name; + assessmentSection.BackgroundData.Transparency = newBackgroundData.Transparency; + assessmentSection.BackgroundData.Configuration = newBackgroundData.Configuration; + + assessmentSection.BackgroundData.NotifyObservers(); + } + + #endregion + + #region AssessmentSection TreeNodeInfo + + private static object[] AssessmentSectionChildNodeObjects(AssessmentSection nodeData) + { + var childNodes = new List + { + new ReferenceLineContext(nodeData.ReferenceLine, nodeData), + new NormContext(nodeData.FailureMechanismContribution, nodeData), + new FailureMechanismContributionContext(nodeData.FailureMechanismContribution, nodeData), + new HydraulicBoundaryDatabaseContext(nodeData.HydraulicBoundaryDatabase, nodeData), + nodeData.BackgroundData, + nodeData.Comments + }; + + childNodes.AddRange(WrapFailureMechanismsInContexts(nodeData)); + childNodes.Add(new AssemblyResultsContext(nodeData)); + + return childNodes.ToArray(); + } + + private static IEnumerable WrapFailureMechanismsInContexts(IAssessmentSection assessmentSection) + { + return assessmentSection + .GetFailureMechanisms() + .Select(failureMechanism => failureMechanismAssociations + .First(a => a.Match(failureMechanism)) + .Create(failureMechanism, assessmentSection)) + .ToArray(); + } + + private static void AssessmentSectionOnNodeRenamed(IAssessmentSection nodeData, string newName) + { + nodeData.Name = newName; + nodeData.NotifyObservers(); + } + + private static void AssessmentSectionOnNodeRemoved(IAssessmentSection nodeData, object parentNodeData) + { + var parentProject = (RingtoetsProject) parentNodeData; + var assessmentSection = (AssessmentSection) nodeData; + parentProject.AssessmentSections.Remove(assessmentSection); + parentProject.NotifyObservers(); + } + + private ContextMenuStrip AssessmentSectionContextMenuStrip(AssessmentSection nodeData, object parentData, TreeViewControl treeViewControl) + { + var calculateAllItem = new StrictContextMenuItem( + RingtoetsCommonFormsResources.Calculate_All, + Resources.AssessmentSection_Calculate_All_ToolTip, + RingtoetsCommonFormsResources.CalculateAllIcon, + (sender, args) => + { + ActivityProgressDialogRunner.Run(Gui.MainWindow, AssessmentSectionCalculationActivityFactory.CreateActivities(nodeData)); + }); + + var importItem = new StrictContextMenuItem( + GuiResources.Import, + GuiResources.Import_ToolTip, + GuiResources.ImportIcon, + (sender, args) => assessmentSectionMerger.StartMerge(nodeData)); + + return Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .AddSeparator() + .AddCustomItem(importItem) + .AddSeparator() + .AddRenameItem() + .AddSeparator() + .AddCustomItem(calculateAllItem) + .AddSeparator() + .AddDeleteItem() + .AddSeparator() + .AddCollapseAllItem() + .AddExpandAllItem() + .AddSeparator() + .AddPropertiesItem() + .Build(); + } + + #endregion + + #region StandAloneFailureMechanism TreeNodeInfo + + private static object[] StandAloneFailureMechanismDisabledChildNodeObjects(IFailureMechanismContext nodeData) + { + return new object[] + { + nodeData.WrappedData.NotRelevantComments + }; + } + + private ContextMenuStrip StandAloneFailureMechanismEnabledContextMenuStrip(IFailureMechanismContext nodeData, object parentData, TreeViewControl treeViewControl) + { + var builder = new RingtoetsContextMenuBuilder(Gui.Get(nodeData, treeViewControl)); + + return builder.AddOpenItem() + .AddSeparator() + .AddToggleRelevancyOfFailureMechanismItem(nodeData, RemoveAllViewsForItem) + .AddSeparator() + .AddCollapseAllItem() + .AddExpandAllItem() + .AddSeparator() + .AddPropertiesItem() + .Build(); + } + + private void RemoveAllViewsForItem(IFailureMechanismContext failureMechanismContext) + { + Gui.ViewCommands.RemoveAllViewsForItem(failureMechanismContext); + } + + private ContextMenuStrip StandAloneFailureMechanismDisabledContextMenuStrip(IFailureMechanismContext nodeData, + object parentData, + TreeViewControl treeViewControl) + { + var builder = new RingtoetsContextMenuBuilder(Gui.Get(nodeData, treeViewControl)); + + return builder.AddToggleRelevancyOfFailureMechanismItem(nodeData, RemoveAllViewsForItem) + .AddSeparator() + .AddCollapseAllItem() + .AddExpandAllItem() + .AddSeparator() + .AddPropertiesItem() + .Build(); + } + + #endregion + + #region GrassCoverSlipOffInwardsFailureMechanismContext TreeNodeInfo + + private static object[] GrassCoverSlipOffInwardsFailureMechanismEnabledChildNodeObjects(GrassCoverSlipOffInwardsFailureMechanismContext nodeData) + { + return new object[] + { + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Inputs_DisplayName, + GetInputs(nodeData.WrappedData, nodeData.Parent), + TreeFolderCategory.Input), + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Outputs_DisplayName, + GetOutputs(nodeData.WrappedData), + TreeFolderCategory.Output) + }; + } + + private static IEnumerable GetInputs(GrassCoverSlipOffInwardsFailureMechanism nodeData, IAssessmentSection assessmentSection) + { + return new object[] + { + new GrassCoverSlipOffInwardsFailureMechanismSectionsContext(nodeData, assessmentSection), + nodeData.InputComments + }; + } + + private static IEnumerable GetOutputs(GrassCoverSlipOffInwardsFailureMechanism nodeData) + { + return new object[] + { + new FailureMechanismSectionResultContext( + nodeData.SectionResults, nodeData), + nodeData.OutputComments + }; + } + + #endregion + + #region GrassCoverSlipOffOutwardsFailureMechanismContext TreeNodeInfo + + private static object[] GrassCoverSlipOffOutwardsFailureMechanismEnabledChildNodeObjects(GrassCoverSlipOffOutwardsFailureMechanismContext nodeData) + { + return new object[] + { + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Inputs_DisplayName, + GetInputs(nodeData.WrappedData, nodeData.Parent), + TreeFolderCategory.Input), + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Outputs_DisplayName, + GetOutputs(nodeData.WrappedData), + TreeFolderCategory.Output) + }; + } + + private static IEnumerable GetInputs(GrassCoverSlipOffOutwardsFailureMechanism nodeData, IAssessmentSection assessmentSection) + { + return new object[] + { + new GrassCoverSlipOffOutwardsFailureMechanismSectionsContext(nodeData, assessmentSection), + nodeData.InputComments + }; + } + + private static IEnumerable GetOutputs(GrassCoverSlipOffOutwardsFailureMechanism nodeData) + { + return new object[] + { + new FailureMechanismSectionResultContext( + nodeData.SectionResults, nodeData), + nodeData.OutputComments + }; + } + + #endregion + + #region MacroStabilityOutwardsFailureMechanismContext TreeNodeInfo + + private static object[] MacroStabilityOutwardsFailureMechanismEnabledChildNodeObjects(MacroStabilityOutwardsFailureMechanismContext nodeData) + { + return new object[] + { + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Inputs_DisplayName, + GetInputs(nodeData.WrappedData, nodeData.Parent), + TreeFolderCategory.Input), + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Outputs_DisplayName, + GetOutputs(nodeData.WrappedData, nodeData.Parent), + TreeFolderCategory.Output) + }; + } + + private static IEnumerable GetInputs(MacroStabilityOutwardsFailureMechanism nodeData, IAssessmentSection assessmentSection) + { + return new object[] + { + new MacroStabilityOutwardsFailureMechanismSectionsContext(nodeData, assessmentSection), + nodeData.InputComments + }; + } + + private static IEnumerable GetOutputs(MacroStabilityOutwardsFailureMechanism nodeData, + IAssessmentSection assessmentSection) + { + MacroStabilityOutwardsProbabilityAssessmentInput probabilityAssessmentInput = nodeData.MacroStabilityOutwardsProbabilityAssessmentInput; + return new object[] + { + new MacroStabilityOutwardsAssemblyCategoriesContext(nodeData, + assessmentSection, + () => probabilityAssessmentInput.GetN(assessmentSection.ReferenceLine.Length)), + new ProbabilityFailureMechanismSectionResultContext( + nodeData.SectionResults, nodeData, assessmentSection), + nodeData.OutputComments + }; + } + + #endregion + + #region MicrostabilityFailureMechanismContext TreeNodeInfo + + private static object[] MicrostabilityFailureMechanismEnabledChildNodeObjects(MicrostabilityFailureMechanismContext nodeData) + { + return new object[] + { + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Inputs_DisplayName, + GetInputs(nodeData.WrappedData, nodeData.Parent), + TreeFolderCategory.Input), + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Outputs_DisplayName, + GetOutputs(nodeData.WrappedData), + TreeFolderCategory.Output) + }; + } + + private static IEnumerable GetInputs(MicrostabilityFailureMechanism nodeData, IAssessmentSection assessmentSection) + { + return new object[] + { + new MicrostabilityFailureMechanismSectionsContext(nodeData, assessmentSection), + nodeData.InputComments + }; + } + + private static IEnumerable GetOutputs(MicrostabilityFailureMechanism nodeData) + { + return new object[] + { + new FailureMechanismSectionResultContext( + nodeData.SectionResults, nodeData), + nodeData.OutputComments + }; + } + + #endregion + + #region PipingStructureFailureMechanismContext TreeNodeInfo + + private static object[] PipingStructureFailureMechanismEnabledChildNodeObjects(PipingStructureFailureMechanismContext nodeData) + { + return new object[] + { + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Inputs_DisplayName, + GetInputs(nodeData.WrappedData, nodeData.Parent), + TreeFolderCategory.Input), + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Outputs_DisplayName, + GetOutputs(nodeData.WrappedData, nodeData.Parent), + TreeFolderCategory.Output) + }; + } + + private static IEnumerable GetInputs(PipingStructureFailureMechanism nodeData, IAssessmentSection assessmentSection) + { + return new object[] + { + new PipingStructureFailureMechanismSectionsContext(nodeData, assessmentSection), + nodeData.InputComments + }; + } + + private static IEnumerable GetOutputs(PipingStructureFailureMechanism nodeData, + IAssessmentSection assessmentSection) + { + return new object[] + { + new FailureMechanismAssemblyCategoriesContext(nodeData, + assessmentSection, + () => nodeData.N), + new ProbabilityFailureMechanismSectionResultContext( + nodeData.SectionResults, nodeData, assessmentSection), + nodeData.OutputComments + }; + } + + #endregion + + #region StrengthStabilityLengthwiseConstructionFailureMechanismContext TreeNodeInfo + + private static object[] StrengthStabilityLengthwiseConstructionFailureMechanismEnabledChildNodeObjects( + StrengthStabilityLengthwiseConstructionFailureMechanismContext nodeData) + { + return new object[] + { + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Inputs_DisplayName, + GetInputs(nodeData.WrappedData, nodeData.Parent), + TreeFolderCategory.Input), + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Outputs_DisplayName, + GetOutputs(nodeData.WrappedData), + TreeFolderCategory.Output) + }; + } + + private static IEnumerable GetInputs(StrengthStabilityLengthwiseConstructionFailureMechanism nodeData, IAssessmentSection assessmentSection) + { + return new object[] + { + new StrengthStabilityLengthwiseConstructionFailureMechanismSectionsContext(nodeData, assessmentSection), + nodeData.InputComments + }; + } + + private static IEnumerable GetOutputs(StrengthStabilityLengthwiseConstructionFailureMechanism nodeData) + { + return new object[] + { + new FailureMechanismSectionResultContext( + nodeData.SectionResults, nodeData), + nodeData.OutputComments + }; + } + + #endregion + + #region TechnicalInnovationFailureMechanismContext TreeNodeInfo + + private static object[] TechnicalInnovationFailureMechanismEnabledChildNodeObjects(TechnicalInnovationFailureMechanismContext nodeData) + { + return new object[] + { + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Inputs_DisplayName, + GetInputs(nodeData.WrappedData, nodeData.Parent), + TreeFolderCategory.Input), + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Outputs_DisplayName, + GetOutputs(nodeData.WrappedData), + TreeFolderCategory.Output) + }; + } + + private static IEnumerable GetInputs(TechnicalInnovationFailureMechanism nodeData, IAssessmentSection assessmentSection) + { + return new object[] + { + new TechnicalInnovationFailureMechanismSectionsContext(nodeData, assessmentSection), + nodeData.InputComments + }; + } + + private static IEnumerable GetOutputs(TechnicalInnovationFailureMechanism nodeData) + { + return new object[] + { + new FailureMechanismSectionResultContext( + nodeData.SectionResults, nodeData), + nodeData.OutputComments + }; + } + + #endregion + + #region WaterPressureAsphaltCoverFailureMechanismContext TreeNodeInfo + + private static object[] WaterPressureAsphaltCoverFailureMechanismEnabledChildNodeObjects(WaterPressureAsphaltCoverFailureMechanismContext nodeData) + { + return new object[] + { + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Inputs_DisplayName, + GetInputs(nodeData.WrappedData, nodeData.Parent), + TreeFolderCategory.Input), + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Outputs_DisplayName, + GetOutputs(nodeData.WrappedData), + TreeFolderCategory.Output) + }; + } + + private static IEnumerable GetInputs(WaterPressureAsphaltCoverFailureMechanism nodeData, IAssessmentSection assessmentSection) + { + return new object[] + { + new WaterPressureAsphaltCoverFailureMechanismSectionsContext(nodeData, assessmentSection), + nodeData.InputComments + }; + } + + private static IEnumerable GetOutputs(WaterPressureAsphaltCoverFailureMechanism nodeData) + { + return new object[] + { + new FailureMechanismSectionResultContext( + nodeData.SectionResults, nodeData), + nodeData.OutputComments + }; + } + + #endregion + + #region CategoryTreeFolder TreeNodeInfo + + /// + /// Gets an based on . + /// + /// The tree folder category to retrieve the image for. + /// An based on . + /// Thrown when + /// is an invalid value of . + /// Thrown when + /// is an unsupported value of . + private static Image GetFolderIcon(TreeFolderCategory category) + { + if (!Enum.IsDefined(typeof(TreeFolderCategory), category)) + { + throw new InvalidEnumArgumentException(nameof(category), + (int) category, + typeof(TreeFolderCategory)); + } + + switch (category) + { + case TreeFolderCategory.General: + return RingtoetsCommonFormsResources.GeneralFolderIcon; + case TreeFolderCategory.Input: + return RingtoetsCommonFormsResources.InputFolderIcon; + case TreeFolderCategory.Output: + return RingtoetsCommonFormsResources.OutputFolderIcon; + default: + throw new NotSupportedException(); + } + } + + private ContextMenuStrip CategoryTreeFolderContextMenu(CategoryTreeFolder nodeData, object parentData, TreeViewControl treeViewControl) + { + return Gui.Get(nodeData, treeViewControl) + .AddCollapseAllItem() + .AddExpandAllItem() + .Build(); + } + + #endregion + + #region HydraulicBoundaryDatabase TreeNodeInfo + + private static object[] HydraulicBoundaryDatabaseChildNodeObjects(HydraulicBoundaryDatabaseContext nodeData) + { + if (nodeData.WrappedData.IsLinked()) + { + return new object[] + { + new DesignWaterLevelCalculationsGroupContext(nodeData.WrappedData.Locations, + nodeData.AssessmentSection), + new WaveHeightCalculationsGroupContext(nodeData.WrappedData.Locations, + nodeData.AssessmentSection) + }; + } + + return new object[0]; + } + + private ContextMenuStrip DesignWaterLevelCalculationsContextMenuStrip(DesignWaterLevelCalculationsContext nodeData, object parentData, TreeViewControl treeViewControl) + { + var designWaterLevelItem = new StrictContextMenuItem( + RingtoetsCommonFormsResources.Calculate_All, + RingtoetsCommonFormsResources.DesignWaterLevel_Calculate_All_ToolTip, + RingtoetsCommonFormsResources.CalculateAllIcon, + (sender, args) => + { + if (hydraulicBoundaryLocationCalculationGuiService == null) + { + return; + } + + IAssessmentSection assessmentSection = nodeData.AssessmentSection; + hydraulicBoundaryLocationCalculationGuiService.CalculateDesignWaterLevels(nodeData.WrappedData, + assessmentSection, + nodeData.GetNormFunc(), + nodeData.CategoryBoundaryName); + }); + + SetHydraulicsMenuItemEnabledStateAndTooltip(nodeData.AssessmentSection, + nodeData.GetNormFunc(), + designWaterLevelItem); + + return Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .AddSeparator() + .AddCustomItem(designWaterLevelItem) + .AddSeparator() + .AddPropertiesItem() + .Build(); + } + + private ContextMenuStrip WaveHeightCalculationsContextMenuStrip(WaveHeightCalculationsContext nodeData, object parentData, TreeViewControl treeViewControl) + { + var waveHeightItem = new StrictContextMenuItem( + RingtoetsCommonFormsResources.Calculate_All, + RingtoetsCommonFormsResources.WaveHeight_Calculate_All_ToolTip, + RingtoetsCommonFormsResources.CalculateAllIcon, + (sender, args) => + { + if (hydraulicBoundaryLocationCalculationGuiService == null) + { + return; + } + + IAssessmentSection assessmentSection = nodeData.AssessmentSection; + hydraulicBoundaryLocationCalculationGuiService.CalculateWaveHeights(nodeData.WrappedData, + assessmentSection, + nodeData.GetNormFunc(), + nodeData.CategoryBoundaryName); + }); + + SetHydraulicsMenuItemEnabledStateAndTooltip(nodeData.AssessmentSection, + nodeData.GetNormFunc(), + waveHeightItem); + + return Gui.Get(nodeData, treeViewControl) + .AddOpenItem() + .AddSeparator() + .AddCustomItem(waveHeightItem) + .AddSeparator() + .AddPropertiesItem() + .Build(); + } + + private static void SetHydraulicsMenuItemEnabledStateAndTooltip(IAssessmentSection assessmentSection, StrictContextMenuItem menuItem) + { + string validationText = HydraulicBoundaryDatabaseConnectionValidator.Validate(assessmentSection.HydraulicBoundaryDatabase); + if (!string.IsNullOrEmpty(validationText)) + { + menuItem.Enabled = false; + menuItem.ToolTipText = validationText; + } + } + + private static void SetHydraulicsMenuItemEnabledStateAndTooltip(IAssessmentSection assessmentSection, double norm, StrictContextMenuItem menuItem) + { + SetHydraulicsMenuItemEnabledStateAndTooltip(assessmentSection, menuItem); + if (!menuItem.Enabled) + { + return; + } + + TargetProbabilityCalculationServiceHelper.ValidateTargetProbability(norm, logMessage => + { + menuItem.Enabled = false; + menuItem.ToolTipText = logMessage; + }); + } + + private ContextMenuStrip HydraulicBoundaryDatabaseContextMenuStrip(HydraulicBoundaryDatabaseContext nodeData, object parentData, TreeViewControl treeViewControl) + { + var calculateAllItem = new StrictContextMenuItem( + RingtoetsCommonFormsResources.Calculate_All, + RingtoetsCommonFormsResources.HydraulicLoads_Calculate_All_ToolTip, + RingtoetsCommonFormsResources.CalculateAllIcon, + (sender, args) => + { + ActivityProgressDialogRunner.Run( + Gui.MainWindow, + AssessmentSectionHydraulicBoundaryLocationCalculationActivityFactory.CreateHydraulicBoundaryLocationCalculationActivities(nodeData.AssessmentSection)); + }); + + SetHydraulicsMenuItemEnabledStateAndTooltip(nodeData.AssessmentSection, + calculateAllItem); + + return Gui.Get(nodeData, treeViewControl) + .AddCustomImportItem(RingtoetsFormsResources.HydraulicBoundaryDatabase_Connect, + RingtoetsFormsResources.HydraulicBoundaryDatabase_Connect_ToolTip, + RingtoetsCommonFormsResources.DatabaseIcon) + .AddExportItem() + .AddSeparator() + .AddCustomItem(calculateAllItem) + .AddSeparator() + .AddCollapseAllItem() + .AddExpandAllItem() + .AddSeparator() + .AddPropertiesItem() + .Build(); + } + + private ContextMenuStrip DesignWaterLevelCalculationsGroupContextMenuStrip(DesignWaterLevelCalculationsGroupContext nodeData, object parentData, TreeViewControl treeViewControl) + { + IAssessmentSection assessmentSection = nodeData.AssessmentSection; + + var designWaterLevelItem = new StrictContextMenuItem( + RingtoetsCommonFormsResources.Calculate_All, + RingtoetsCommonFormsResources.DesignWaterLevel_Calculate_All_ToolTip, + RingtoetsCommonFormsResources.CalculateAllIcon, + (sender, args) => + { + ActivityProgressDialogRunner.Run( + Gui.MainWindow, + AssessmentSectionHydraulicBoundaryLocationCalculationActivityFactory.CreateDesignWaterLevelCalculationActivities(assessmentSection)); + }); + + SetHydraulicsMenuItemEnabledStateAndTooltip(assessmentSection, designWaterLevelItem); + + return Gui.Get(nodeData, treeViewControl) + .AddCustomItem(designWaterLevelItem) + .AddSeparator() + .AddCollapseAllItem() + .AddExpandAllItem() + .Build(); + } + + private ContextMenuStrip WaveHeightCalculationsGroupContextMenuStrip(WaveHeightCalculationsGroupContext nodeData, object parentData, TreeViewControl treeViewControl) + { + IAssessmentSection assessmentSection = nodeData.AssessmentSection; + + var waveHeightItem = new StrictContextMenuItem( + RingtoetsCommonFormsResources.Calculate_All, + RingtoetsCommonFormsResources.WaveHeight_Calculate_All_ToolTip, + RingtoetsCommonFormsResources.CalculateAllIcon, + (sender, args) => + { + ActivityProgressDialogRunner.Run( + Gui.MainWindow, + AssessmentSectionHydraulicBoundaryLocationCalculationActivityFactory.CreateWaveHeightCalculationActivities(assessmentSection)); + }); + + SetHydraulicsMenuItemEnabledStateAndTooltip(assessmentSection, waveHeightItem); + + return Gui.Get(nodeData, treeViewControl) + .AddCustomItem(waveHeightItem) + .AddSeparator() + .AddCollapseAllItem() + .AddExpandAllItem() + .Build(); + } + + private static object[] DesignWaterLevelCalculationsGroupContextChildNodeObjects(DesignWaterLevelCalculationsGroupContext context) + { + return new object[] + { + new DesignWaterLevelCalculationsContext(context.AssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm, + context.AssessmentSection, + () => context.AssessmentSection.GetNorm(AssessmentSectionCategoryType.FactorizedSignalingNorm), + RingtoetsCommonDataResources.AssessmentSectionCategoryType_FactorizedSignalingNorm_DisplayName), + new DesignWaterLevelCalculationsContext(context.AssessmentSection.WaterLevelCalculationsForSignalingNorm, + context.AssessmentSection, + () => context.AssessmentSection.GetNorm(AssessmentSectionCategoryType.SignalingNorm), + RingtoetsCommonDataResources.AssessmentSectionCategoryType_SignalingNorm_DisplayName), + new DesignWaterLevelCalculationsContext(context.AssessmentSection.WaterLevelCalculationsForLowerLimitNorm, + context.AssessmentSection, + () => context.AssessmentSection.GetNorm(AssessmentSectionCategoryType.LowerLimitNorm), + RingtoetsCommonDataResources.AssessmentSectionCategoryType_LowerLimitNorm_DisplayName), + new DesignWaterLevelCalculationsContext(context.AssessmentSection.WaterLevelCalculationsForFactorizedLowerLimitNorm, + context.AssessmentSection, + () => context.AssessmentSection.GetNorm(AssessmentSectionCategoryType.FactorizedLowerLimitNorm), + RingtoetsCommonDataResources.AssessmentSectionCategoryType_FactorizedLowerLimitNorm_DisplayName) + }; + } + + private static object[] WaveHeightCalculationsGroupContextChildNodeObjects(WaveHeightCalculationsGroupContext context) + { + return new object[] + { + new WaveHeightCalculationsContext(context.AssessmentSection.WaveHeightCalculationsForFactorizedSignalingNorm, + context.AssessmentSection, + () => context.AssessmentSection.GetNorm(AssessmentSectionCategoryType.FactorizedSignalingNorm), + RingtoetsCommonDataResources.AssessmentSectionCategoryType_FactorizedSignalingNorm_DisplayName), + new WaveHeightCalculationsContext(context.AssessmentSection.WaveHeightCalculationsForSignalingNorm, + context.AssessmentSection, + () => context.AssessmentSection.GetNorm(AssessmentSectionCategoryType.SignalingNorm), + RingtoetsCommonDataResources.AssessmentSectionCategoryType_SignalingNorm_DisplayName), + new WaveHeightCalculationsContext(context.AssessmentSection.WaveHeightCalculationsForLowerLimitNorm, + context.AssessmentSection, + () => context.AssessmentSection.GetNorm(AssessmentSectionCategoryType.LowerLimitNorm), + RingtoetsCommonDataResources.AssessmentSectionCategoryType_LowerLimitNorm_DisplayName), + new WaveHeightCalculationsContext(context.AssessmentSection.WaveHeightCalculationsForFactorizedLowerLimitNorm, + context.AssessmentSection, + () => context.AssessmentSection.GetNorm(AssessmentSectionCategoryType.FactorizedLowerLimitNorm), + RingtoetsCommonDataResources.AssessmentSectionCategoryType_FactorizedLowerLimitNorm_DisplayName) + }; + } + + #endregion + + #region AssemblyResults TreeNodeInfo + + private static object[] AssemblyResultsContextChildNodeObjects(AssemblyResultsContext context) + { + AssessmentSection assessmentSection = context.WrappedData; + return new object[] + { + new AssemblyResultCategoriesContext(assessmentSection), + new AssemblyResultTotalContext(assessmentSection), + new AssemblyResultPerSectionContext(assessmentSection), + new AssemblyResultPerSectionMapContext(assessmentSection) + }; + } + + #endregion + + #endregion + + #region Foreshore Profile Update and ImportInfo + + private static FileFilterGenerator CreateForeshoreProfileFileFilterGenerator + { + get + { + return new FileFilterGenerator(RingtoetsCommonIOResources.Shape_file_filter_Extension, + RingtoetsCommonIOResources.Shape_file_filter_Description); + } + } + + private bool VerifyForeshoreProfileUpdates(ForeshoreProfilesContext context, string query) + { + var changeHandler = new FailureMechanismCalculationChangeHandler(context.ParentFailureMechanism, + query, + new DialogBasedInquiryHelper(Gui.MainWindow)); + + return !changeHandler.RequireConfirmation() || changeHandler.InquireConfirmation(); + } + + #endregion + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/RingtoetsRibbon.xaml =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/RingtoetsRibbon.xaml (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/RingtoetsRibbon.xaml (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,44 @@ + + + + + + + + + + + + + Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/RingtoetsRibbon.xaml.cs =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/RingtoetsRibbon.xaml.cs (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/RingtoetsRibbon.xaml.cs (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,61 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Windows; +using Core.Common.Controls.Commands; +using Core.Common.Gui.Forms; +using Fluent; + +namespace Riskeer.Integration.Plugin +{ + /// + /// Interaction logic for RingtoetsRibbon.xaml + /// + public partial class RingtoetsRibbon : IRibbonCommandHandler + { + /// + /// Initializes a new instance of the class. + /// + public RingtoetsRibbon() + { + InitializeComponent(); + } + + /// + /// Sets the command used to control the add assessment section button. + /// + public ICommand AddAssessmentSectionButtonCommand { set; private get; } + + public Ribbon GetRibbonControl() + { + return RingtoetsRibbonControl; + } + + public void ValidateItems() {} + + private void ButtonAddAssessmentSectionToolWindowClick(object sender, RoutedEventArgs e) + { + AddAssessmentSectionButtonCommand.Execute(); + + ValidateItems(); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/Riskeer.Integration.Plugin.csproj =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/Riskeer.Integration.Plugin.csproj (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/Riskeer.Integration.Plugin.csproj (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,316 @@ + + + + {C8383B76-B3F1-4E6E-B56C-527B469FA20A} + Riskeer.Integration.Plugin + Riskeer.Integration.Plugin + + + + + ..\..\..\..\packages\Fluent.Ribbon.3.4.0\lib\net40\Fluent.dll + True + + + ..\..\..\..\packages\log4net.2.0.4\lib\net40-full\log4net.dll + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + RingtoetsRibbon.xaml + + + + + {3bbfd65b-b277-4e50-ae6d-bd24c3434609} + Core.Common.Base + False + + + {1d27f91f-4e62-4eaf-a0a8-a32708b9a9b1} + Core.Common.Controls.TreeView + False + + + {9a2d67e6-26ac-4d17-b11a-2b4372f2f572} + Core.Common.Controls + False + + + {30e4c2ae-719e-4d70-9fa9-668a9767fbfa} + Core.Common.Gui + False + + + {f49bd8b2-332a-4c91-a196-8cce0a2c7d98} + Core.Common.Util + False + + + {4a06df0d-5d75-4bad-a95a-a3db9b7c4ad5} + Core.Components.Gis.Forms + False + + + {318ba582-88c9-4816-a54a-a7e431461de3} + Core.Components.Gis + False + + + {420ed9c3-0c33-47ea-b893-121a9c0db4f1} + Riskeer.AssemblyTool.Data + False + + + {C6309704-D67B-434C-BC98-9F8910BC1D10} + Ringtoets.ClosingStructures.Data + False + + + {22E191F2-B2E3-413C-9511-4C2CDEDB2EFF} + Ringtoets.ClosingStructures.Forms + False + + + {8513B8D6-79C8-4173-B663-59C91AC65E5F} + Ringtoets.Common.Plugin + False + + + {78AA56F5-431D-465C-AC50-3173D7E90AC1} + Ringtoets.Common.Primitives + False + + + {6A074D65-A81C-4C1C-8E24-F36C916E4ED7} + Ringtoets.Common.Util + False + + + {D1068432-C172-4AA6-847B-D9DEB4C6DE26} + Ringtoets.DuneErosion.Data + False + + + {EC2DEF03-71FE-48A0-AB85-31E13112E4A1} + Ringtoets.DuneErosion.Forms + False + + + {83885FB9-A87B-4D43-AF27-43EA44A84E42} + Ringtoets.DuneErosion.Plugin + False + + + {B69D5B6C-6E14-4FA9-9EBC-8F97678CDB70} + Ringtoets.HydraRing.IO + False + + + {83D6B73E-91D5-46B0-9218-955DA1F75F7C} + Ringtoets.MacroStabilityInwards.Data + False + + + {69EBF07F-20E5-4B5A-8620-C2638191AFED} + Ringtoets.MacroStabilityInwards.Forms + False + + + {e9b39743-2dc9-4922-9e0f-6ba3e0e54189} + Ringtoets.MacroStabilityInwards.Primitives + False + + + {87C2C553-C0BC-40BF-B1EA-B83BFF357F27} + Ringtoets.Revetment.Data + False + + + {3D4B9740-8348-4434-8D77-B611FC6EE57F} + Ringtoets.StabilityPointStructures.Data + False + + + {D5F0A6B0-8710-4345-ABA1-D934C8E6783D} + Ringtoets.StabilityPointStructures.Forms + False + + + {50963f12-448c-41ba-a62c-cdb0ab8d21e0} + Riskeer.Storage.Core + False + + + {567E0B69-5280-41CE-ADD6-443725A61C86} + Ringtoets.WaveImpactAsphaltCover.Data + False + + + {1AC97B51-88C2-437D-89E6-65C69AB3CCAD} + Ringtoets.WaveImpactAsphaltCover.Forms + False + + + {d4200f43-3f72-4f42-af0a-8ced416a38ec} + Ringtoets.Common.Data + False + + + {4d840673-3812-4338-a352-84854e32b8a0} + Ringtoets.Common.Forms + False + + + {52ba7627-cbab-4209-be77-3b5f31378277} + Ringtoets.Common.IO + False + + + {d951d6da-fe83-4920-9fdb-63bf96480b54} + Ringtoets.Common.Service + False + + + {90DE728E-48EF-4665-AB38-3D88E41D9F4D} + Ringtoets.GrassCoverErosionInwards.Data + False + + + {C540E627-B95B-4CC0-A1B6-A0BDF74936C7} + Ringtoets.GrassCoverErosionInwards.Forms + False + + + {E7225477-577F-4A17-B7EC-6721158E1543} + Ringtoets.GrassCoverErosionOutwards.Data + False + + + {41B829C1-630F-40B0-8BEE-B1C4C94EC8C4} + Ringtoets.GrassCoverErosionOutwards.Forms + False + + + {1C0017D8-35B5-4CA0-8FC7-A83F46DBDC99} + Ringtoets.HeightStructures.Data + False + + + {F0BCF06A-3D01-4D65-A249-E2A14AEC6EFD} + Ringtoets.HeightStructures.Forms + False + + + {ce994cc9-6f6a-48ac-b4be-02c30a21f4db} + Ringtoets.Piping.Data + False + + + {7cd038e1-e111-4969-aced-22c5bd2974e1} + Ringtoets.Piping.Forms + False + + + {b479e3af-7c34-488c-bb73-d324100d36c9} + Ringtoets.StabilityStoneCover.Data + False + + + {8e4e1877-697a-45d3-81cf-169efdf65aa0} + Ringtoets.StabilityStoneCover.Forms + False + + + {11F1F874-45AF-43E4-8AE5-15A5C9593E28} + Riskeer.Integration.Data + False + + + {AD0CDC89-0A00-4068-AEEC-9838863C2FE8} + Riskeer.Integration.Forms + False + + + {D693D18E-C257-4FDE-96BC-F6E6FB043ECF} + Riskeer.Integration.IO + False + + + {28811c4a-6c18-42c1-88b2-a03a3784e2d0} + Riskeer.Integration.Service + False + + + + + Designer + MSBuild:Compile + + + + + Copying.licenseheader + + + + + + PublicResXFileCodeGenerator + Resources.Designer.cs + Designer + + + + + + + + + + + + + + + \ No newline at end of file Index: Ringtoets/Integration/src/Riskeer.Integration.Plugin/packages.config =================================================================== diff -u --- Ringtoets/Integration/src/Riskeer.Integration.Plugin/packages.config (revision 0) +++ Ringtoets/Integration/src/Riskeer.Integration.Plugin/packages.config (revision c3c7ffbc66ae3cf26bc0c086593ceec3f1173f3f) @@ -0,0 +1,26 @@ + + + + + \ No newline at end of file