Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs =================================================================== diff -u -rfef932cbceb323536b66ee0278471cb77393a723 -r257b5b8c4e053ff875f75e0940a0f9d8775ef083 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs (.../PipingCalculationConfigurationHelper.cs) (revision fef932cbceb323536b66ee0278471cb77393a723) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PipingCalculationConfigurationHelper.cs (.../PipingCalculationConfigurationHelper.cs) (revision 257b5b8c4e053ff875f75e0940a0f9d8775ef083) @@ -23,7 +23,6 @@ using System.Collections.Generic; using System.Linq; using Core.Common.Base.Data; -using Core.Common.Base.Geometry; using log4net; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Forms.Helpers; @@ -104,36 +103,11 @@ return Enumerable.Empty(); } - Segment2D[] surfaceLineSegments = Math2D.ConvertLinePointsToLineSegments(surfaceLine.Points.Select(p => new Point2D(p.X, p.Y))).ToArray(); - return availableSoilModels.Where(stochasticSoilModel => stochasticSoilModel.StochasticSoilProfiles.Any() && - DoesSoilModelGeometryIntersectWithSurfaceLineGeometry(stochasticSoilModel, surfaceLineSegments)) + stochasticSoilModel.IntersectsWithSurfaceLineGeometry(surfaceLine)) .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); @@ -166,17 +140,5 @@ Contribution = (RoundedDouble) stochasticSoilProfile.Probability }; } - - private static bool DoesSoilModelGeometryIntersectWithSurfaceLineGeometry(StochasticSoilModel stochasticSoilModel, Segment2D[] surfaceLineSegments) - { - IEnumerable soilProfileGeometrySegments = Math2D.ConvertLinePointsToLineSegments(stochasticSoilModel.Geometry); - return soilProfileGeometrySegments.Any(s => DoesSegmentIntersectWithSegmentArray(s, surfaceLineSegments)); - } - - private static bool DoesSegmentIntersectWithSegmentArray(Segment2D segment, Segment2D[] segmentArray) - { - // Consider intersections and overlaps similarly - return segmentArray.Any(sls => Math2D.GetIntersectionBetweenSegments(segment, sls).IntersectionType != Intersection2DType.DoesNotIntersect); - } } } \ No newline at end of file