Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsChartDataFactory.cs =================================================================== diff -u -r39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d -r0f2c3010ba8a0760af2c98f70abd6542a936ca32 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsChartDataFactory.cs (.../GrassCoverErosionInwardsChartDataFactory.cs) (revision 39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsChartDataFactory.cs (.../GrassCoverErosionInwardsChartDataFactory.cs) (revision 0f2c3010ba8a0760af2c98f70abd6542a936ca32) @@ -20,9 +20,11 @@ // All rights reserved. using System; +using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; +using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Components.Charting.Data; using Core.Components.Charting.Styles; @@ -78,5 +80,43 @@ Style = new ChartLineStyle(Color.DarkOrange, 2, DashStyle.Solid) }; } + + /// + /// Create with default styling based on the . + /// + /// The dike height of the for which + /// to create . + /// The geometry of the to place the + /// on. + /// based on the . + /// Thrown when is NaN. + /// Thrown when + /// is null. + public static ChartData Create(RoundedDouble dikeHeight, RoughnessPoint[] dikeGeometry) + { + if (double.IsNaN(dikeHeight)) + { + throw new ArgumentException("Dike height should have a value.", "dikeHeight"); + } + + if (dikeGeometry == null) + { + throw new ArgumentNullException("dikeGeometry"); + } + + return new ChartLineData(CreateDikeHeightData(dikeHeight, dikeGeometry), Resources.DikeHeight_ChartName) + { + Style = new ChartLineStyle(Color.MediumSeaGreen, 2, DashStyle.Dash) + }; + } + + private static IEnumerable CreateDikeHeightData(RoundedDouble dikeHeight, RoughnessPoint[] dikeGeometry) + { + return new[] + { + new Point2D(dikeGeometry.First().Point.X, dikeHeight), + new Point2D(dikeGeometry.Last().Point.X, dikeHeight) + }; + } } } \ No newline at end of file