Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Utils/GrassCoverErosionInwardsHelper.cs =================================================================== diff -u -r02670d8c9fceeaea5f829937a2eb269f3488c6b1 -r721d6f7ac6513e2219ff9bc652f3d6059061a009 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Utils/GrassCoverErosionInwardsHelper.cs (.../GrassCoverErosionInwardsHelper.cs) (revision 02670d8c9fceeaea5f829937a2eb269f3488c6b1) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Utils/GrassCoverErosionInwardsHelper.cs (.../GrassCoverErosionInwardsHelper.cs) (revision 721d6f7ac6513e2219ff9bc652f3d6059061a009) @@ -22,8 +22,8 @@ using System; using System.Collections.Generic; using System.Linq; -using Core.Common.Base.Geometry; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Utils; using Ringtoets.GrassCoverErosionInwards.Data; namespace Ringtoets.GrassCoverErosionInwards.Utils @@ -57,7 +57,7 @@ throw new ArgumentNullException("calculations"); } - SectionSegments[] sectionSegments = MakeSectionSegments(sections); + SectionSegments[] sectionSegments = SectionSegmentsHelper.MakeSectionSegments(sections); var calculationsPerSegment = new Dictionary>(); @@ -96,16 +96,11 @@ throw new ArgumentNullException("calculation"); } - SectionSegments[] sectionSegments = MakeSectionSegments(sections); + SectionSegments[] sectionSegments = SectionSegmentsHelper.MakeSectionSegments(sections); return FindSectionForCalculation(sectionSegments, calculation); } - private static SectionSegments[] MakeSectionSegments(IEnumerable sectionResults) - { - return sectionResults.Select(s => new SectionSegments(s)).ToArray(); - } - private static FailureMechanismSection FindSectionForCalculation(SectionSegments[] sectionSegmentsCollection, GrassCoverErosionInwardsCalculation calculation) { var dikeProfile = calculation.InputParameters.DikeProfile; @@ -138,39 +133,5 @@ } calculationsPerSegment[sectionName].Add(calculation); } - - /// - /// This class represents the geometry of a as a collection of objects. - /// - private class SectionSegments - { - private readonly IEnumerable segments; - - /// - /// Creates a new instance of . - /// - /// The whose - /// this class represents as a collection of objects. - public SectionSegments(FailureMechanismSection section) - { - Section = section; - segments = Math2D.ConvertLinePointsToLineSegments(section.Points); - } - - /// - /// Gets the . - /// - public FailureMechanismSection Section { get; private set; } - - /// - /// Calculate the Euclidean distance between the and a . - /// - /// The . - /// The Euclidean distance as a . - public double Distance(Point2D point) - { - return segments.Min(segment => segment.GetEuclideanDistanceToPoint(point)); - } - } } } \ No newline at end of file