Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs =================================================================== diff -u -rb2b9fdf365e70928a05c57966eeed30d9050e528 -rfef932cbceb323536b66ee0278471cb77393a723 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs (.../PipingCalculationConfigurationHelper.cs) (revision b2b9fdf365e70928a05c57966eeed30d9050e528) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs (.../PipingCalculationConfigurationHelper.cs) (revision fef932cbceb323536b66ee0278471cb77393a723) @@ -111,6 +111,29 @@ .ToList(); } + /// + /// Indicates whether a stochastic soil model intersects with a surface line. + /// + /// The stochastic soil model used to match a surface line. + /// The surface line used to match a stochastic soil model. + /// true when the intersects with the ; + /// false otherwise. + /// Thrown when any input parameter is null. + public static bool DoesSoilModelGeometryIntersectWithSurfaceLineGeometry(StochasticSoilModel stochasticSoilModel, RingtoetsPipingSurfaceLine surfaceLine) + { + if (stochasticSoilModel == null) + { + throw new ArgumentNullException(nameof(stochasticSoilModel)); + } + if (surfaceLine == null) + { + throw new ArgumentNullException(nameof(surfaceLine)); + } + Segment2D[] surfaceLineSegments = Math2D.ConvertLinePointsToLineSegments(surfaceLine.Points.Select(p => new Point2D(p.X, p.Y))).ToArray(); + + return DoesSoilModelGeometryIntersectWithSurfaceLineGeometry(stochasticSoilModel, surfaceLineSegments); + } + private static CalculationGroup CreateCalculationGroup(RingtoetsPipingSurfaceLine surfaceLine, IEnumerable soilModels, GeneralPipingInput generalInput) { var calculationGroup = new CalculationGroup(surfaceLine.Name, true); @@ -128,7 +151,7 @@ private static ICalculationBase CreatePipingCalculation(RingtoetsPipingSurfaceLine surfaceLine, StochasticSoilModel stochasticSoilModel, StochasticSoilProfile stochasticSoilProfile, IEnumerable calculations, GeneralPipingInput generalInput) { - var nameBase = string.Format("{0} {1}", surfaceLine.Name, stochasticSoilProfile); + var nameBase = $"{surfaceLine.Name} {stochasticSoilProfile}"; var name = NamingHelper.GetUniqueName(calculations, nameBase, c => c.Name); return new PipingCalculationScenario(generalInput)