Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneErosionFailureMechanismExtensions.cs =================================================================== diff -u -r32061d48745c5325becd9adac3118d976587b3b6 -r1842c5be2441b5fe3b19867ff69a30194d9534d0 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneErosionFailureMechanismExtensions.cs (.../DuneErosionFailureMechanismExtensions.cs) (revision 32061d48745c5325becd9adac3118d976587b3b6) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneErosionFailureMechanismExtensions.cs (.../DuneErosionFailureMechanismExtensions.cs) (revision 1842c5be2441b5fe3b19867ff69a30194d9534d0) @@ -20,11 +20,7 @@ // All rights reserved. using System; -using System.Collections.Generic; -using System.Linq; -using Core.Common.Base.Geometry; using Ringtoets.Common.Data.AssessmentSection; -using Ringtoets.Common.Data.Hydraulics; using Ringtoets.DuneErosion.Data.Properties; namespace Ringtoets.DuneErosion.Data @@ -35,39 +31,6 @@ public static class DuneErosionFailureMechanismExtensions { /// - /// Sets based upon - /// the locations from the . - /// - /// The to update. - /// The database to use. - /// The dune locations to use. - /// Thrown when is null. - public static void SetDuneLocations(this DuneErosionFailureMechanism failureMechanism, - HydraulicBoundaryDatabase hydraulicBoundaryDatabase, - IEnumerable duneLocations) - { - if (failureMechanism == null) - { - throw new ArgumentNullException("failureMechanism"); - } - failureMechanism.DuneLocations.Clear(); - - if (hydraulicBoundaryDatabase == null || duneLocations == null || !duneLocations.Any()) - { - return; - } - - foreach (DuneLocation duneLocation in duneLocations) - { - if (hydraulicBoundaryDatabase.Locations.Any(hydraulicBoundaryLocation => - Math2D.AreEqualPoints(hydraulicBoundaryLocation.Location, duneLocation.Location))) - { - failureMechanism.DuneLocations.Add(duneLocation); - } - } - } - - /// /// Gets the norm which is needed in the calculations within . /// /// The to get the failure mechanism norm for. Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionDataSynchronizationService.cs =================================================================== diff -u --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionDataSynchronizationService.cs (revision 0) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/DuneErosionDataSynchronizationService.cs (revision 1842c5be2441b5fe3b19867ff69a30194d9534d0) @@ -0,0 +1,70 @@ +// Copyright (C) Stichting Deltares 2016. 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.Geometry; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.DuneErosion.Data; + +namespace Ringtoets.DuneErosion.Service +{ + /// + /// Service for synchronizing dune erosion data. + /// + public static class DuneErosionDataSynchronizationService + { + /// + /// Sets based upon + /// the locations from the . + /// + /// The to update. + /// The database to use. + /// The dune locations to use. + /// Thrown when is null. + public static void SetDuneLocations(DuneErosionFailureMechanism failureMechanism, + HydraulicBoundaryDatabase hydraulicBoundaryDatabase, + IEnumerable duneLocations) + { + if (failureMechanism == null) + { + throw new ArgumentNullException("failureMechanism"); + } + failureMechanism.DuneLocations.Clear(); + + if (hydraulicBoundaryDatabase == null || duneLocations == null || !duneLocations.Any()) + { + return; + } + + foreach (DuneLocation duneLocation in duneLocations) + { + if (hydraulicBoundaryDatabase.Locations.Any(hydraulicBoundaryLocation => + Math2D.AreEqualPoints(hydraulicBoundaryLocation.Location, duneLocation.Location))) + { + failureMechanism.DuneLocations.Add(duneLocation); + } + } + } + + } +} \ No newline at end of file Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/Ringtoets.DuneErosion.Service.csproj =================================================================== diff -u -r23d1e296e2da4364fbfe346e68d582dfcf966bb0 -r1842c5be2441b5fe3b19867ff69a30194d9534d0 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/Ringtoets.DuneErosion.Service.csproj (.../Ringtoets.DuneErosion.Service.csproj) (revision 23d1e296e2da4364fbfe346e68d582dfcf966bb0) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Service/Ringtoets.DuneErosion.Service.csproj (.../Ringtoets.DuneErosion.Service.csproj) (revision 1842c5be2441b5fe3b19867ff69a30194d9534d0) @@ -39,13 +39,31 @@ Properties\GlobalAssembly.cs + Copying.licenseheader + + + {3bbfd65b-b277-4e50-ae6d-bd24c3434609} + Core.Common.Base + False + + + {D4200F43-3F72-4F42-AF0A-8CED416A38EC} + Ringtoets.Common.Data + False + + + {D1068432-C172-4AA6-847B-D9DEB4C6DE26} + Ringtoets.DuneErosion.Data + False + + + + + + \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj =================================================================== diff -u -r861341a7835c17ca6309ff1b6e0b8fe2269b5c0f -r1842c5be2441b5fe3b19867ff69a30194d9534d0 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj (.../Ringtoets.Integration.Plugin.csproj) (revision 861341a7835c17ca6309ff1b6e0b8fe2269b5c0f) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj (.../Ringtoets.Integration.Plugin.csproj) (revision 1842c5be2441b5fe3b19867ff69a30194d9534d0) @@ -131,6 +131,11 @@ Ringtoets.DuneErosion.IO False + + {FDEE3429-0BB1-4AD2-813A-06FAD425EA6F} + Ringtoets.DuneErosion.Service + False + {3D4B9740-8348-4434-8D77-B611FC6EE57F} Ringtoets.StabilityPointStructures.Data Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r861341a7835c17ca6309ff1b6e0b8fe2269b5c0f -r1842c5be2441b5fe3b19867ff69a30194d9534d0 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 861341a7835c17ca6309ff1b6e0b8fe2269b5c0f) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 1842c5be2441b5fe3b19867ff69a30194d9534d0) @@ -59,6 +59,7 @@ using Ringtoets.DuneErosion.Data; using Ringtoets.DuneErosion.Forms.PresentationObjects; using Ringtoets.DuneErosion.IO; +using Ringtoets.DuneErosion.Service; using Ringtoets.GrassCoverErosionInwards.Data; using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects; using Ringtoets.GrassCoverErosionOutwards.Data; @@ -1473,8 +1474,10 @@ assessmentSection.GrassCoverErosionOutwards.HydraulicBoundaryLocations.NotifyObservers(); var duneLocationsReader = new DuneLocationsReader(); - var duneLocations = duneLocationsReader.ReadDuneLocations(); - assessmentSection.DuneErosion.SetDuneLocations(assessmentSection.HydraulicBoundaryDatabase, duneLocations); + IEnumerable duneLocations = duneLocationsReader.ReadDuneLocations(); + DuneErosionDataSynchronizationService.SetDuneLocations(assessmentSection.DuneErosion, + assessmentSection.HydraulicBoundaryDatabase, + duneLocations); assessmentSection.DuneErosion.DuneLocations.NotifyObservers(); } log.InfoFormat(RingtoetsFormsResources.RingtoetsPlugin_SetBoundaryDatabaseFilePath_Database_on_path_0_linked,