Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingConfigurationImporter.cs =================================================================== diff -u -r7fcb0613ba513557f59a87037385c0012981716c -r4f292cc8bf75a76604b07b1ca9fd21be1bf9e904 --- Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingConfigurationImporter.cs (.../PipingConfigurationImporter.cs) (revision 7fcb0613ba513557f59a87037385c0012981716c) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingConfigurationImporter.cs (.../PipingConfigurationImporter.cs) (revision 4f292cc8bf75a76604b07b1ca9fd21be1bf9e904) @@ -31,6 +31,7 @@ using Ringtoets.Piping.Data; using Ringtoets.Piping.IO.Properties; using Ringtoets.Piping.IO.Readers; +using Ringtoets.Piping.Primitives; using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources; namespace Ringtoets.Piping.IO.Importers @@ -43,6 +44,7 @@ private static readonly ILog log = LogManager.GetLogger(typeof(PipingConfigurationImporter)); private readonly IEnumerable hydraulicBoundaryLocations; + private readonly PipingFailureMechanism failureMechanism; private readonly List validCalculationItems; @@ -51,19 +53,27 @@ /// /// The path to the file to import from. /// The calculation group to update. - /// The hydraulic boundary locations used to check if - /// the imported objects contain the right location. + /// The hydraulic boundary locations used to check if + /// the imported objects contain the right location. + /// The piping failure mechanism used to check + /// if the imported objects contain the right data. /// Thrown when any parameter is null. public PipingConfigurationImporter(string filePath, CalculationGroup importTarget, - IEnumerable hydraulicBoundaryLocations) + IEnumerable hydraulicBoundaryLocations, + PipingFailureMechanism failureMechanism) : base(filePath, importTarget) { if (hydraulicBoundaryLocations == null) { throw new ArgumentNullException(nameof(hydraulicBoundaryLocations)); } + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } this.hydraulicBoundaryLocations = hydraulicBoundaryLocations; + this.failureMechanism = failureMechanism; validCalculationItems = new List(); } @@ -147,11 +157,26 @@ } } + if (readCalculation.SurfaceLine != null) + { + RingtoetsPipingSurfaceLine surfaceLine = failureMechanism.SurfaceLines.FirstOrDefault(sl => sl.Name == readCalculation.SurfaceLine); + + if (surfaceLine != null) + { + pipingCalculation.InputParameters.SurfaceLine = surfaceLine; + } + else + { + log.Warn("Profielschematisatie bestaat niet. Berekening overgeslagen."); + return; + } + } + validCalculationItems.Add(pipingCalculation); // Validate when set: - // - HR location - // - Surface line + // - HR location X + // - Surface line X // - Stochastic soil model // - Stochastic soil profile // Validate the stochastic soil model crosses the surface line when set