Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs =================================================================== diff -u -r9def31196320039cc9075ba0e1fb12ce87c6769e -r0f8ecad9de486dac8a81bb9de57e76ca6cf8a104 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 9def31196320039cc9075ba0e1fb12ce87c6769e) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 0f8ecad9de486dac8a81bb9de57e76ca6cf8a104) @@ -37,7 +37,7 @@ public class RingtoetsPipingSurfaceLine { private Point3D[] geometryPoints; - private double entryPointX; + private double entryPointL; /// /// Initializes a new instance of the class. @@ -95,21 +95,21 @@ public Point3D DitchDikeSide { get; private set; } /// - /// Gets or sets the x-coördinate of the entree point. + /// Gets or sets the L-coördinate of the entry point. /// - public double EntryPointX + /// is not in range of the LZ-projected . + /// is empty. + public double EntryPointL { get { - return entryPointX; + return entryPointL; } 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; + ValidateHasPoints(); + ValidateInRange(value, ProjectGeometryToLZ().ToArray(), Resources.RingtoetsPipingSurfaceLine_EntryPointL_Cannot_set_entry_point_at_L_0); + entryPointL = value; } } @@ -223,17 +223,15 @@ /// The height of the at L=. /// Thrown when the /// intersection point at have a significant difference in their y coordinate. + /// is not in range of the LZ-projected . /// is empty. public double GetZAtL(double l) { - if (!Points.Any()) - { - throw new InvalidOperationException(Resources.RingtoetsPipingSurfaceLine_SurfaceLine_has_no_Geometry); - } + ValidateHasPoints(); var projectGeometryToLz = ProjectGeometryToLZ().ToArray(); - ValidateInRange(l, projectGeometryToLz); + ValidateInRange(l, projectGeometryToLz, Resources.RingtoetsPipingSurfaceLine_GetZAtL_Cannot_determine_height); var segments = new Collection(); for (int i = 1; i < projectGeometryToLz.Length; i++) @@ -254,23 +252,37 @@ } /// + /// Checks whether the current collection is not empty. + /// + /// is empty. + private void ValidateHasPoints() + { + if (!Points.Any()) + { + throw new InvalidOperationException(Resources.RingtoetsPipingSurfaceLine_SurfaceLine_has_no_Geometry); + } + } + + /// /// 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. + /// 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) + private static void ValidateInRange(double l, Point2D[] lzGeometry, string operationDescription) { 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); + var outOfRangeMessage = string.Format(Resources.RingtoetsPipingSurfaceLine_0_L_needs_to_be_in_1_2_range, + operationDescription, + lzGeometry.First().X, + lzGeometry.Last().X); throw new ArgumentOutOfRangeException("l", outOfRangeMessage); } }