Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingChartDataFactory.cs =================================================================== diff -u -r6c7f7aa26bfbb6caa020f05fb9f563eca3458447 -r9cbc101eb43fcbfc72e2ebb7c9ab3bf7807fa46e --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingChartDataFactory.cs (.../PipingChartDataFactory.cs) (revision 6c7f7aa26bfbb6caa020f05fb9f563eca3458447) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingChartDataFactory.cs (.../PipingChartDataFactory.cs) (revision 9cbc101eb43fcbfc72e2ebb7c9ab3bf7807fa46e) @@ -29,6 +29,7 @@ using Core.Common.Geometry; using Core.Components.Charting.Data; using Core.Components.Charting.Styles; +using Ringtoets.Piping.Data; using Ringtoets.Piping.Forms.Properties; using Ringtoets.Piping.Primitives; using PipingDataResources = Ringtoets.Piping.Data.Properties.Resources; @@ -41,10 +42,10 @@ public static class PipingChartDataFactory { /// - /// Create with default styling based on a . + /// Create with default styling for a . /// /// The function for obtaining a for which to create . - /// based on the surface line obtained via . + /// for the surface line obtained via . /// Thrown when is null. public static ChartData CreateSurfaceLine(Func getSurfaceLineFunc) { @@ -78,55 +79,69 @@ } /// - /// Create a with default styling based on the . + /// Create with default styling for an entry point. /// - /// The horizontal distance from the origin at which to place the entry point - /// on the . - /// The to place the entry point on. - /// based on the . - /// Thrown when is NaN. - /// Thrown when is null. - public static ChartData CreateEntryPoint(RoundedDouble entryPoint, RingtoetsPipingSurfaceLine surfaceLine) + /// The function for obtaining the that holds the entry point for which to create . + /// based on the entry point of the obtained via . + /// Thrown when is null. + public static ChartData CreateEntryPoint(Func getPipingInputFunc) { - if (double.IsNaN(entryPoint)) + if (getPipingInputFunc == null) { - throw new ArgumentException("Entry point should have a value.", "entryPoint"); + throw new ArgumentNullException("getPipingInputFunc"); } - if (surfaceLine == null) + Func> getPointsFunc = () => { - throw new ArgumentNullException("surfaceLine"); - } + var pipingInput = getPipingInputFunc(); - return CreatePointWithZAtL(entryPoint, surfaceLine, Resources.PipingInput_EntryPointL_DisplayName, Color.Gold); + return pipingInput != null && pipingInput.SurfaceLine != null && !double.IsNaN(pipingInput.EntryPointL) + ? new[] + { + new Point2D(pipingInput.EntryPointL, pipingInput.SurfaceLine.GetZAtL(pipingInput.EntryPointL)) + } + : Enumerable.Empty(); + }; + + return new ChartPointData(getPointsFunc, Resources.PipingInput_EntryPointL_DisplayName) + { + Style = new ChartPointStyle(Color.Gold, 8, Color.Transparent, 0, ChartPointSymbol.Triangle) + }; } /// - /// Create a with default styling based on the . + /// Create with default styling for an exit point. /// - /// The horizontal distance from the origin at which to place the exit point - /// on the . - /// The to place the exit point on. - /// based on the . - /// Thrown when is NaN. - /// Thrown when is null. - public static ChartData CreateExitPoint(RoundedDouble exitPoint, RingtoetsPipingSurfaceLine surfaceLine) + /// The function for obtaining the that holds the exit point for which to create . + /// based on the exit point of the obtained via . + /// Thrown when is null. + public static ChartData CreateExitPoint(Func getPipingInputFunc) { - if (double.IsNaN(exitPoint)) + if (getPipingInputFunc == null) { - throw new ArgumentException("Exit point should have a value.", "exitPoint"); + throw new ArgumentNullException("getPipingInputFunc"); } - if (surfaceLine == null) + Func> getPointsFunc = () => { - throw new ArgumentNullException("surfaceLine"); - } + var pipingInput = getPipingInputFunc(); - return CreatePointWithZAtL(exitPoint, surfaceLine, Resources.PipingInput_ExitPointL_DisplayName, Color.Tomato); + return pipingInput != null && pipingInput.SurfaceLine != null && !double.IsNaN(pipingInput.ExitPointL) + ? new[] + { + new Point2D(pipingInput.ExitPointL, pipingInput.SurfaceLine.GetZAtL(pipingInput.ExitPointL)) + } + : Enumerable.Empty(); + }; + + return new ChartPointData(getPointsFunc, Resources.PipingInput_ExitPointL_DisplayName) + { + Style = new ChartPointStyle(Color.Tomato, 8, Color.Transparent, 0, ChartPointSymbol.Triangle) + }; } /// - /// Create a with default styling based on the . + /// Create with default styling based on the . /// /// The which contains a point which /// characterizes the ditch at polder side, to create for. @@ -144,7 +159,7 @@ } /// - /// Create a with default styling based on the . + /// Create with default styling based on the . /// /// The which contains a point which /// characterizes the bottom ditch at polder side, to create for. @@ -162,7 +177,7 @@ } /// - /// Create a with default styling based on the . + /// Create with default styling based on the . /// /// The which contains a point which /// characterizes the bottom ditch at dike side, to create for. @@ -180,7 +195,7 @@ } /// - /// Create a with default styling based on the . + /// Create with default styling based on the . /// /// The which contains a point which /// characterizes the ditch at dike side, to create for. @@ -198,7 +213,7 @@ } /// - /// Create a with default styling based on the . + /// Create with default styling based on the . /// /// The which contains a point which /// characterizes the dike toe at river side, to create for. @@ -216,7 +231,7 @@ } /// - /// Create a with default styling based on the . + /// Create with default styling based on the . /// /// The which contains a point which /// characterizes the dike toe at polder side, to create for. @@ -234,7 +249,7 @@ } /// - /// Create an instance of with styling based on the color of of + /// Create with styling based on the color of of /// the as index . The is drawn /// for the full width of the (as far as the is visible below /// the ). @@ -354,19 +369,6 @@ }; } - private static ChartData CreatePointWithZAtL(RoundedDouble pointL, RingtoetsPipingSurfaceLine surfaceLine, string name, Color color) - { - var pointZ = surfaceLine.GetZAtL(pointL); - - return new ChartPointData(() => new[] - { - new Point2D(pointL, pointZ) - }, name) - { - Style = new ChartPointStyle(color, 8, Color.Transparent, 0, ChartPointSymbol.Triangle) - }; - } - private static ChartData CreateCharacteristicPoint(Point3D worldPoint, RingtoetsPipingSurfaceLine surfaceLine, string name, Color color) { return CreateLocalPoint(worldPoint, surfaceLine, name, new ChartPointStyle(color, 8, Color.Transparent, 0, ChartPointSymbol.Circle));