Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/DikeProfile.cs =================================================================== diff -u -r39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d -ra520ed551c5eecc830c54d4373f1efc82c64cb5f --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/DikeProfile.cs (.../DikeProfile.cs) (revision 39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/DikeProfile.cs (.../DikeProfile.cs) (revision a520ed551c5eecc830c54d4373f1efc82c64cb5f) @@ -54,7 +54,7 @@ } SetGeometry(dikeGeometry); - SetForshoreGeometry(foreshoreGeometry); + SetForeshoreGeometry(foreshoreGeometry); orientation = new RoundedDouble(2); dikeHeight = new RoundedDouble(2); @@ -167,16 +167,16 @@ DikeGeometry = points.ToArray(); } - private void SetForshoreGeometry(IEnumerable points) + private void SetForeshoreGeometry(IEnumerable points) { if (points == null) { - throw new ArgumentNullException("points", Resources.DikeProfile_SetForshoreGeometry_Collection_of_points_for_foreshore_geometry_is_null); + throw new ArgumentNullException("points", Resources.DikeProfile_SetForeshoreGeometry_Collection_of_points_for_foreshore_geometry_is_null); } if (points.Any(p => p == null)) { - throw new ArgumentException(Resources.DikeProfile_SetForshoreGeometry_A_point_in_the_collection_is_null); + throw new ArgumentException(Resources.DikeProfile_SetForeshoreGeometry_A_point_in_the_collection_is_null); } ForeshoreGeometry = points.ToArray(); Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Properties/Resources.Designer.cs =================================================================== diff -u -r39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d -ra520ed551c5eecc830c54d4373f1efc82c64cb5f --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a520ed551c5eecc830c54d4373f1efc82c64cb5f) @@ -99,19 +99,19 @@ /// /// Looks up a localized string similar to Een punt in de geometrie voor het voorland heeft geen waarde.. /// - public static string DikeProfile_SetForshoreGeometry_A_point_in_the_collection_is_null { + public static string DikeProfile_SetForeshoreGeometry_A_point_in_the_collection_is_null { get { - return ResourceManager.GetString("DikeProfile_SetForshoreGeometry_A_point_in_the_collection_is_null", resourceCulture); + return ResourceManager.GetString("DikeProfile_SetForeshoreGeometry_A_point_in_the_collection_is_null", resourceCulture); } } /// /// Looks up a localized string similar to De geometrie die werd opgegeven voor het voorland heeft geen waarde.. /// - public static string DikeProfile_SetForshoreGeometry_Collection_of_points_for_foreshore_geometry_is_null { + public static string DikeProfile_SetForeshoreGeometry_Collection_of_points_for_foreshore_geometry_is_null { get { - return ResourceManager.GetString("DikeProfile_SetForshoreGeometry_Collection_of_points_for_foreshore_geometry_is_nu" + - "ll", resourceCulture); + return ResourceManager.GetString("DikeProfile_SetForeshoreGeometry_Collection_of_points_for_foreshore_geometry_is_n" + + "ull", resourceCulture); } } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Properties/Resources.resx =================================================================== diff -u -r39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d -ra520ed551c5eecc830c54d4373f1efc82c64cb5f --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Properties/Resources.resx (.../Resources.resx) (revision 39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/Properties/Resources.resx (.../Resources.resx) (revision a520ed551c5eecc830c54d4373f1efc82c64cb5f) @@ -147,10 +147,10 @@ Een punt in de geometrie voor het dijkprofiel heeft geen waarde. - + De geometrie die werd opgegeven voor het voorland heeft geen waarde. - + Een punt in de geometrie voor het voorland heeft geen waarde. \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsInputView.cs =================================================================== diff -u -r39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d -ra520ed551c5eecc830c54d4373f1efc82c64cb5f --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsInputView.cs (.../GrassCoverErosionInwardsInputView.cs) (revision 39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsInputView.cs (.../GrassCoverErosionInwardsInputView.cs) (revision a520ed551c5eecc830c54d4373f1efc82c64cb5f) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Linq; using System.Windows.Forms; using Core.Common.Base; using Core.Components.Charting.Data; @@ -37,6 +38,7 @@ private GrassCoverErosionInwardsInput data; private GrassCoverErosionInwardsCalculation calculation; private ChartData dikeProfileData; + private ChartData foreshoreData; /// /// Creates a new instance of . @@ -109,20 +111,31 @@ if (data != null) { // Bottom most layer + foreshoreData = AddOrUpdateChartData(foreshoreData, GetForeshoreData()); dikeProfileData = AddOrUpdateChartData(dikeProfileData, GetDikeProfileData()); // Top most layer } chartControl.Data.NotifyObservers(); } + private ChartData GetForeshoreData() + { + if (data == null || !data.ForeshoreGeometry.Any()) + { + return ChartDataFactory.CreateEmptyLineData(Resources.Foreshore_DisplayName); + } + + return GrassCoverErosionInwardsChartDataFactory.Create(data.ForeshoreGeometry); + } + private ChartData GetDikeProfileData() { - if (data == null || data.DikeProfile == null || data.DikeProfile.DikeGeometry == null) + if (data == null || !data.DikeGeometry.Any()) { return ChartDataFactory.CreateEmptyLineData(Resources.DikeProfile_DisplayName); } - return GrassCoverErosionInwardsChartDataFactory.Create(data.DikeProfile.DikeGeometry); + return GrassCoverErosionInwardsChartDataFactory.Create(data.DikeGeometry); } private ChartData AddOrUpdateChartData(ChartData oldChartData, ChartData newChartData) Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/DikeProfileTest.cs =================================================================== diff -u -r39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d -ra520ed551c5eecc830c54d4373f1efc82c64cb5f --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/DikeProfileTest.cs (.../DikeProfileTest.cs) (revision 39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/DikeProfileTest.cs (.../DikeProfileTest.cs) (revision a520ed551c5eecc830c54d4373f1efc82c64cb5f) @@ -114,7 +114,7 @@ // Assert var exception = Assert.Throws(call); - StringAssert.StartsWith(Resources.DikeProfile_SetForshoreGeometry_Collection_of_points_for_foreshore_geometry_is_null, exception.Message); + StringAssert.StartsWith(Resources.DikeProfile_SetForeshoreGeometry_Collection_of_points_for_foreshore_geometry_is_null, exception.Message); Assert.AreEqual("points", exception.ParamName); } @@ -129,7 +129,7 @@ // Assert var exception = Assert.Throws(call); - StringAssert.StartsWith(Resources.DikeProfile_SetForshoreGeometry_A_point_in_the_collection_is_null, exception.Message); + StringAssert.StartsWith(Resources.DikeProfile_SetForeshoreGeometry_A_point_in_the_collection_is_null, exception.Message); } [Test] Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsInputViewTest.cs =================================================================== diff -u -r39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d -ra520ed551c5eecc830c54d4373f1efc82c64cb5f --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsInputViewTest.cs (.../GrassCoverErosionInwardsInputViewTest.cs) (revision 39496fd42e53a9fb20fec4f2a1b4dcdfadcaea3d) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsInputViewTest.cs (.../GrassCoverErosionInwardsInputViewTest.cs) (revision a520ed551c5eecc830c54d4373f1efc82c64cb5f) @@ -119,7 +119,7 @@ view.Data = input; // Precondition - Assert.AreEqual(1, view.Chart.Data.List.Count); + Assert.AreEqual(2, view.Chart.Data.List.Count); // Call view.Data = null; @@ -182,7 +182,7 @@ // Setup using (GrassCoverErosionInwardsInputView view = new GrassCoverErosionInwardsInputView()) { - var dikeProfile = new DikeProfile(new Point2D(0.0, 0.0), new RoughnessPoint[0], new Point2D[0]); + var dikeProfile = GetDikeProfileWithGeometry(); var input = new GrassCoverErosionInwardsInput { DikeProfile = dikeProfile @@ -198,8 +198,9 @@ Assert.IsNotNull(chartData); Assert.AreEqual(Resources.GrassCoverErosionInwardsInputContext_NodeDisplayName, chartData.Name); - Assert.AreEqual(1, chartData.List.Count); + Assert.AreEqual(2, chartData.List.Count); AssertDikeProfileChartData(dikeProfile, chartData.List[dikeProfileIndex]); + AssertForeshoreChartData(dikeProfile, chartData.List[foreshoreIndex]); } } @@ -221,11 +222,14 @@ Assert.IsNotNull(chartData); Assert.AreEqual(Resources.GrassCoverErosionInwardsInputContext_NodeDisplayName, chartData.Name); - Assert.AreEqual(1, chartData.List.Count); + Assert.AreEqual(2, chartData.List.Count); var dikeProfileData = (ChartLineData) chartData.List[dikeProfileIndex]; + var foreShoreData = (ChartLineData) chartData.List[foreshoreIndex]; CollectionAssert.IsEmpty(dikeProfileData.Points); + CollectionAssert.IsEmpty(foreShoreData.Points); Assert.AreEqual(Resources.DikeProfile_DisplayName, dikeProfileData.Name); + Assert.AreEqual(Resources.Foreshore_DisplayName, foreShoreData.Name); } } @@ -363,6 +367,7 @@ view.Data = input; ChartLineData oldDikeProfileChartData = (ChartLineData) view.Chart.Data.List[dikeProfileIndex]; + ChartLineData oldForeshoreChartData = (ChartLineData) view.Chart.Data.List[foreshoreIndex]; DikeProfile dikeProfile2 = GetSecondDikeProfileWithGeometry(); @@ -375,6 +380,10 @@ ChartLineData newDikeProfileChartData = (ChartLineData)view.Chart.Data.List[dikeProfileIndex]; Assert.AreNotEqual(oldDikeProfileChartData, newDikeProfileChartData); AssertDikeProfileChartData(dikeProfile2, newDikeProfileChartData); + + ChartLineData newForeshoreChartData = (ChartLineData)view.Chart.Data.List[foreshoreIndex]; + Assert.AreNotEqual(oldForeshoreChartData, newForeshoreChartData); + AssertForeshoreChartData(dikeProfile2, newForeshoreChartData); } } @@ -440,7 +449,8 @@ } } - private const int dikeProfileIndex = 0; + private const int foreshoreIndex = 0; + private const int dikeProfileIndex = 1; private DikeProfile GetDikeProfileWithGeometry() { @@ -450,8 +460,15 @@ new RoughnessPoint(new Point2D(3.0, 4.0), 4.0), new RoughnessPoint(new Point2D(4.0, 5.0), 4.0) }; + + var foreshore = new[] + { + new Point2D(1.0, 2.0), + new Point2D(5.0, 6.0), + new Point2D(8.0, 9.0), + }; - return GetDikeProfile(points); + return GetDikeProfile(points, foreshore); } private DikeProfile GetSecondDikeProfileWithGeometry() @@ -463,12 +480,19 @@ new RoughnessPoint(new Point2D(12.0, 5.0), 1.0) }; - return GetDikeProfile(points); + var foreshore = new[] + { + new Point2D(0.0, 0.0), + new Point2D(1.0, 1.0), + new Point2D(2.0, 2.0), + }; + + return GetDikeProfile(points, foreshore); } - private DikeProfile GetDikeProfile(RoughnessPoint[] points) + private DikeProfile GetDikeProfile(RoughnessPoint[] dikeGeometry, Point2D[] foreshoreGeometry) { - DikeProfile dikeProfile = new DikeProfile(new Point2D(0.0, 0.0), points, new Point2D[0]); + DikeProfile dikeProfile = new DikeProfile(new Point2D(0.0, 0.0), dikeGeometry, foreshoreGeometry); return dikeProfile; } @@ -483,5 +507,16 @@ CollectionAssert.AreEqual(dikeGeometry.Select(dg => dg.Point), dikeProfileChartData.Points); Assert.AreEqual(Resources.DikeProfile_DisplayName, chartData.Name); } + + private void AssertForeshoreChartData(DikeProfile dikeProfile, ChartData chartData) + { + Assert.IsInstanceOf(chartData); + ChartLineData foreshoreCVhartData = (ChartLineData)chartData; + + Point2D[] foreshoreGeometry = dikeProfile.ForeshoreGeometry; + Assert.AreEqual(foreshoreGeometry.Length, foreshoreCVhartData.Points.Count()); + CollectionAssert.AreEqual(foreshoreGeometry, foreshoreCVhartData.Points); + Assert.AreEqual(Resources.Foreshore_DisplayName, chartData.Name); + } } } \ No newline at end of file