Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs =================================================================== diff -u -rbff183a6d323111affe69f3afa19b9ada02c9375 -re7923e041dfeb751cc6fe3b795f914f13734b19d --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs (.../PipingCalculationConfigurationHelper.cs) (revision bff183a6d323111affe69f3afa19b9ada02c9375) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs (.../PipingCalculationConfigurationHelper.cs) (revision e7923e041dfeb751cc6fe3b795f914f13734b19d) @@ -1,8 +1,6 @@ using System.Collections.Generic; using System.Linq; - using Core.Common.Base.Geometry; - using Ringtoets.Piping.Data; using Ringtoets.Piping.Primitives; @@ -14,6 +12,24 @@ public static class PipingCalculationConfigurationHelper { /// + /// Creates a structure of and based on combination of the + /// and the . + /// + /// Surface lines to generate the structure for and to use to configure + /// with. + /// The soil models from which profiles are taken to configure with. + /// + public static IEnumerable Generate(IEnumerable surfaceLines, IEnumerable soilModels) + { + if (surfaceLines == null) + { + return Enumerable.Empty(); + } + var pipingCalculationGroups = surfaceLines.Select(sl => CreateCalculationGroup(sl, soilModels)); + return pipingCalculationGroups; + } + + /// /// Gets the piping soil profiles matching the input of a calculation. /// /// The surface line used to match a . @@ -41,6 +57,32 @@ return soilProfileObjectsForCalculation; } + private static IPipingCalculationItem CreateCalculationGroup(RingtoetsPipingSurfaceLine surfaceLine, IEnumerable soilModels) + { + var pipingCalculationGroup = new PipingCalculationGroup(surfaceLine.Name, true); + if (soilModels != null) + { + foreach (var profile in GetPipingSoilProfilesForSurfaceLine(surfaceLine, soilModels)) + { + pipingCalculationGroup.Children.Add(CreatePipingCalculation(surfaceLine, profile)); + } + } + + return pipingCalculationGroup; + } + + private static IPipingCalculationItem CreatePipingCalculation(RingtoetsPipingSurfaceLine surfaceLine, PipingSoilProfile profile) + { + return new PipingCalculation(new GeneralPipingInput(), new SemiProbabilisticPipingInput()) + { + InputParameters = + { + SurfaceLine = surfaceLine, + SoilProfile = profile + } + }; + } + private static bool DoesSoilModelGeometryIntersectWithSurfaceLineGeometry(StochasticSoilModel stochasticSoilModel, Segment2D[] surfaceLineSegments) { IEnumerable soilProfileGeometrySegments = Math2D.ConvertLinePointsToLineSegments(stochasticSoilModel.Geometry);