Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs =================================================================== diff -u -r99890512d1c7a9b99f05f0dd60ec638f16011080 -r9def31196320039cc9075ba0e1fb12ce87c6769e --- Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 99890512d1c7a9b99f05f0dd60ec638f16011080) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 9def31196320039cc9075ba0e1fb12ce87c6769e) @@ -37,6 +37,7 @@ public class RingtoetsPipingSurfaceLine { private Point3D[] geometryPoints; + private double entryPointX; /// /// Initializes a new instance of the class. @@ -94,6 +95,25 @@ public Point3D DitchDikeSide { get; private set; } /// + /// Gets or sets the x-coördinate of the entree point. + /// + public double EntryPointX + { + get + { + return entryPointX; + } + set + { + if (value < Points.First().X || value > Points.Last().X) + { + throw new ArgumentOutOfRangeException("value", "Cannot set entry point x-coordinate beyond the geometry."); + } + entryPointX = value; + } + } + + /// /// Sets the geometry of the surfaceline. /// /// The collection of points defining the surfaceline geometry. @@ -203,9 +223,18 @@ /// The height of the at L=. /// Thrown when the /// intersection point at have a significant difference in their y coordinate. + /// is empty. public double GetZAtL(double l) { + if (!Points.Any()) + { + throw new InvalidOperationException(Resources.RingtoetsPipingSurfaceLine_SurfaceLine_has_no_Geometry); + } + var projectGeometryToLz = ProjectGeometryToLZ().ToArray(); + + ValidateInRange(l, projectGeometryToLz); + var segments = new Collection(); for (int i = 1; i < projectGeometryToLz.Length; i++) { @@ -225,6 +254,28 @@ } /// + /// Checks whether is in range of the . + /// + /// The value to check for. + /// The 2 dimensional geometry which determines the valid range for , where + /// elements are expected to be ordered on the x-coordinate. + /// Throw when: + /// + /// < {first point's x-coordinate} + /// > {last point's x-coordinate} + /// + private static void ValidateInRange(double l, Point2D[] lzGeometry) + { + if (lzGeometry.First().X > l || lzGeometry.Last().X < l) + { + var outOfRangeMessage = string.Format(Resources.RingtoetsPipingSurfaceLine_L_needs_to_be_in_0_1_range_to_be_able_to_determine_height, + lzGeometry.First().X, + lzGeometry.Last().X); + throw new ArgumentOutOfRangeException("l", outOfRangeMessage); + } + } + + /// /// Projects the points in to localized coordinate (LZ-plane) system. /// Z-values are retained, and the first point is put a L=0. ///