Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs =================================================================== diff -u -ra371ae048cf582e8a9cad8436a21c2b9b18dc793 -r2351e33d2db5e822abd37b63a88930d9239528b7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs (.../MacroStabilityInwardsChartDataFactory.cs) (revision a371ae048cf582e8a9cad8436a21c2b9b18dc793) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs (.../MacroStabilityInwardsChartDataFactory.cs) (revision 2351e33d2db5e822abd37b63a88930d9239528b7) @@ -102,7 +102,8 @@ { Color = Color.Blue, DashStyle = ChartLineDashStyle.Solid, - Width = 2 + Width = 2, + IsEditable = true }) { IsVisible = isVisible @@ -284,6 +285,22 @@ } /// + /// Creates with default styling for the tangent lines. + /// + /// The created . + public static ChartMultipleLineData CreateTangentLinesChartData() + { + return new ChartMultipleLineData(Resources.TangentLines_DisplayName, + new ChartLineStyle + { + Color = Color.Green, + DashStyle = ChartLineDashStyle.Dash, + IsEditable = true, + Width = 1 + }); + } + + /// /// Updates the name of based on . /// /// The to update the name for. Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataPointsFactory.cs =================================================================== diff -u -rcac3045aae8af73cbc3602a1c38b071385aa3581 -r2351e33d2db5e822abd37b63a88930d9239528b7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataPointsFactory.cs (.../MacroStabilityInwardsChartDataPointsFactory.cs) (revision cac3045aae8af73cbc3602a1c38b071385aa3581) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataPointsFactory.cs (.../MacroStabilityInwardsChartDataPointsFactory.cs) (revision 2351e33d2db5e822abd37b63a88930d9239528b7) @@ -399,8 +399,31 @@ } /// - /// Create areas of the slices based on the provided . + /// Create the tangent lines based on the provided + /// and . /// + /// The tangent line Y-coordinates. + /// The surface line that determines the boundaries of the tangent line. + /// A collection of arrays of points in 2D space or an empty collection when + /// or is null. + public static IEnumerable CreateTangentLines(IEnumerable tangentLines, + MacroStabilityInwardsSurfaceLine surfaceLine) + { + if (surfaceLine == null || tangentLines == null) + { + return Enumerable.Empty(); + } + + return tangentLines.Select(tangentLine => new[] + { + new Point2D(surfaceLine.LocalGeometry.First().X, tangentLine), + new Point2D(surfaceLine.LocalGeometry.Last().X, tangentLine) + }).ToArray(); + } + + /// + /// Create lines of the slices based on the provided . + /// /// The slices to create the areas for. /// A collection of arrays of points in 2D space or an empty collection when /// is null. Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r1d682d2d79d3dc08fc5a8c0ebac889d996dfb492 -r2351e33d2db5e822abd37b63a88930d9239528b7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1d682d2d79d3dc08fc5a8c0ebac889d996dfb492) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 2351e33d2db5e822abd37b63a88930d9239528b7) @@ -1581,6 +1581,15 @@ } /// + /// Looks up a localized string similar to Tangentlijnen. + /// + public static string TangentLines_DisplayName { + get { + return ResourceManager.GetString("TangentLines_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Verticale coördinaat van de onderste raaklijn.. /// public static string TangentLineZBottom_Description { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx =================================================================== diff -u -r1d682d2d79d3dc08fc5a8c0ebac889d996dfb492 -r2351e33d2db5e822abd37b63a88930d9239528b7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 1d682d2d79d3dc08fc5a8c0ebac889d996dfb492) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 2351e33d2db5e822abd37b63a88930d9239528b7) @@ -469,6 +469,9 @@ Radius passieve cirkel + + Tangentlijnen + Bepaling raaklijnen op basis van grondlaagscheidingen of handmatig? Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsOutputChartControl.cs =================================================================== diff -u -ra371ae048cf582e8a9cad8436a21c2b9b18dc793 -r2351e33d2db5e822abd37b63a88930d9239528b7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsOutputChartControl.cs (.../MacroStabilityInwardsOutputChartControl.cs) (revision a371ae048cf582e8a9cad8436a21c2b9b18dc793) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsOutputChartControl.cs (.../MacroStabilityInwardsOutputChartControl.cs) (revision 2351e33d2db5e822abd37b63a88930d9239528b7) @@ -63,6 +63,7 @@ private readonly ChartLineData slipPlaneChartData; private readonly ChartLineData leftCircleRadiusChartData; private readonly ChartLineData rightCircleRadiusChartData; + private readonly ChartMultipleLineData tangentLinesChartData; private readonly List soilLayerChartDataLookup; @@ -101,6 +102,7 @@ surfaceLevelOutsideChartData = MacroStabilityInwardsChartDataFactory.CreateSurfaceLevelOutsideChartData(); waternetZonesExtremeChartData = MacroStabilityInwardsChartDataFactory.CreateWaternetZonesExtremeChartDataCollection(); waternetZonesDailyChartData = MacroStabilityInwardsChartDataFactory.CreateWaternetZonesDailyChartDataCollection(); + tangentLinesChartData = MacroStabilityInwardsChartDataFactory.CreateTangentLinesChartData(); leftGridChartData = MacroStabilityInwardsChartDataFactory.CreateLeftGridChartData(); rightGridChartData = MacroStabilityInwardsChartDataFactory.CreateRightGridChartData(); slipPlaneChartData = MacroStabilityInwardsChartDataFactory.CreateSlipPlaneChartData(); @@ -124,6 +126,7 @@ chartDataCollection.Add(surfaceLevelOutsideChartData); chartDataCollection.Add(waternetZonesExtremeChartData); chartDataCollection.Add(waternetZonesDailyChartData); + chartDataCollection.Add(tangentLinesChartData); chartDataCollection.Add(leftGridChartData); chartDataCollection.Add(rightGridChartData); chartDataCollection.Add(slicesChartData); @@ -189,6 +192,8 @@ leftCircleRadiusChartData.Points = MacroStabilityInwardsChartDataPointsFactory.CreateLeftCircleRadiusPoints(output?.SlidingCurve); rightCircleRadiusChartData.Points = MacroStabilityInwardsChartDataPointsFactory.CreateRightCircleRadiusPoints(output?.SlidingCurve); slicesChartData.Areas = MacroStabilityInwardsChartDataPointsFactory.CreateSliceAreas(output?.SlidingCurve.Slices); + tangentLinesChartData.Lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(output?.SlipPlane.TangentLines, + data.InputParameters.SurfaceLine); } private void UpdateInputChartData() Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/MacroStabilityInwardsOutputTestFactoryTest.cs =================================================================== diff -u -ra1f0bed43a1bdeeda53ac505a77c065ca6fd7c12 -r2351e33d2db5e822abd37b63a88930d9239528b7 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/MacroStabilityInwardsOutputTestFactoryTest.cs (.../MacroStabilityInwardsOutputTestFactoryTest.cs) (revision a1f0bed43a1bdeeda53ac505a77c065ca6fd7c12) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/MacroStabilityInwardsOutputTestFactoryTest.cs (.../MacroStabilityInwardsOutputTestFactoryTest.cs) (revision 2351e33d2db5e822abd37b63a88930d9239528b7) @@ -84,6 +84,12 @@ Assert.IsNotNull(output.SlidingCurve); Assert.AreEqual(3, output.SlidingCurve.Slices.Count()); Assert.IsNotNull(output.SlipPlane); + CollectionAssert.AreEqual(new[] + { + -3.5, + 0.0, + 2.0 + }, output.SlipPlane.TangentLines); } [Test] Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsOutputTestFactory.cs =================================================================== diff -u -rb513e76d805898795483251f7d070489dfd20b9b -r2351e33d2db5e822abd37b63a88930d9239528b7 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsOutputTestFactory.cs (.../MacroStabilityInwardsOutputTestFactory.cs) (revision b513e76d805898795483251f7d070489dfd20b9b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsOutputTestFactory.cs (.../MacroStabilityInwardsOutputTestFactory.cs) (revision 2351e33d2db5e822abd37b63a88930d9239528b7) @@ -74,7 +74,12 @@ }, 0, 0), new MacroStabilityInwardsSlipPlaneUpliftVan(MacroStabilityInwardsGridTestFactory.Create(), MacroStabilityInwardsGridTestFactory.Create(), - new double[0]), + new[] + { + -3.5, + 0.0, + 2.0 + }), properties); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataFactoryTest.cs =================================================================== diff -u -ra371ae048cf582e8a9cad8436a21c2b9b18dc793 -r2351e33d2db5e822abd37b63a88930d9239528b7 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataFactoryTest.cs (.../MacroStabilityInwardsChartDataFactoryTest.cs) (revision a371ae048cf582e8a9cad8436a21c2b9b18dc793) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataFactoryTest.cs (.../MacroStabilityInwardsChartDataFactoryTest.cs) (revision 2351e33d2db5e822abd37b63a88930d9239528b7) @@ -308,6 +308,18 @@ } [Test] + public void CreateTangentLinesChartData_ReturnsChartMultipleLineData() + { + // Call + ChartMultipleLineData data = MacroStabilityInwardsChartDataFactory.CreateTangentLinesChartData(); + + // Assert + CollectionAssert.IsEmpty(data.Lines); + Assert.AreEqual("Tangentlijnen", data.Name); + AssertEqualStyle(data.Style, Color.Green, 1, ChartLineDashStyle.Dash); + } + + [Test] public void UpdateSurfaceLineChartDataName_SurfaceLineNull_NameSetToDefaultSurfaceLineName() { // Setup @@ -388,6 +400,7 @@ Assert.AreEqual(color, lineStyle.Color); Assert.AreEqual(width, lineStyle.Width); Assert.AreEqual(dashStyle, lineStyle.DashStyle); + Assert.IsTrue(lineStyle.IsEditable); } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataPointsFactoryTest.cs =================================================================== diff -u -r7946e60ec6d419d8b4a7cfbf61e93f2738139843 -r2351e33d2db5e822abd37b63a88930d9239528b7 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataPointsFactoryTest.cs (.../MacroStabilityInwardsChartDataPointsFactoryTest.cs) (revision 7946e60ec6d419d8b4a7cfbf61e93f2738139843) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataPointsFactoryTest.cs (.../MacroStabilityInwardsChartDataPointsFactoryTest.cs) (revision 2351e33d2db5e822abd37b63a88930d9239528b7) @@ -1452,6 +1452,60 @@ }, areas); } + [Test] + public void CreateTangentLines_TangentLinesNull_ReturnsEmptyCollection() + { + // Call + IEnumerable areas = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(null, new MacroStabilityInwardsSurfaceLine("line")); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreateTangentLines_SurfaceLineNull_ReturnsEmptyCollection() + { + // Call + IEnumerable areas = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(Enumerable.Empty(), null); + + // Assert + CollectionAssert.IsEmpty(areas); + } + + [Test] + public void CreateTangentLines_WithSlices_ReturnsLines() + { + // Setup + var surfaceLine = new MacroStabilityInwardsSurfaceLine("line"); + surfaceLine.SetGeometry(new[] + { + new Point3D(-5, 2, 2), + new Point3D(10, 2, 2) + }); + + // Call + IEnumerable lines = MacroStabilityInwardsChartDataPointsFactory.CreateTangentLines(new[] + { + 2.5, + 5.8 + }, surfaceLine); + + // Assert + CollectionAssert.AreEqual(new[] + { + new[] + { + new Point2D(0.0, 2.5), + new Point2D(15.0, 2.5) + }, + new[] + { + new Point2D(0, 5.8), + new Point2D(15.0, 5.8) + } + }, lines); + } + private static MacroStabilityInwardsWaternetLine CreateWaternetLine(IEnumerable waternetLineGeometry, IEnumerable phreaticLineGeometry) { Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsOutputViewChartDataAssert.cs =================================================================== diff -u -ra371ae048cf582e8a9cad8436a21c2b9b18dc793 -r2351e33d2db5e822abd37b63a88930d9239528b7 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsOutputViewChartDataAssert.cs (.../MacroStabilityInwardsOutputViewChartDataAssert.cs) (revision a371ae048cf582e8a9cad8436a21c2b9b18dc793) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsOutputViewChartDataAssert.cs (.../MacroStabilityInwardsOutputViewChartDataAssert.cs) (revision 2351e33d2db5e822abd37b63a88930d9239528b7) @@ -51,13 +51,14 @@ private const int surfaceLevelOutsideIndex = 13; private const int waternetZonesExtremeIndex = 14; private const int waternetZonesDailyIndex = 15; - private const int leftGridIndex = 16; - private const int rightGridIndex = 17; - private const int slicesIndex = 18; - private const int slipPlaneIndex = 19; - private const int activeCircleRadiusIndex = 20; - private const int passiveCircleRadiusIndex = 21; - private const int nrOfChartData = 22; + private const int tangentLinesIndex = 16; + private const int leftGridIndex = 17; + private const int rightGridIndex = 18; + private const int slicesIndex = 19; + private const int slipPlaneIndex = 20; + private const int activeCircleRadiusIndex = 21; + private const int passiveCircleRadiusIndex = 22; + private const int nrOfChartData = 23; /// /// Asserts whether corresponds to the input of . @@ -97,6 +98,9 @@ MacroStabilityInwardsViewChartDataAssert.AssertGridChartData(calculationScenario.Output.SlipPlane.RightGrid, (ChartPointData) actual.Collection.ElementAt(rightGridIndex)); + AssertTangentLinesChartData(calculationScenario.Output.SlipPlane.TangentLines, calculationScenario.InputParameters.SurfaceLine, + (ChartMultipleLineData) actual.Collection.ElementAt(tangentLinesIndex)); + AssertSlicesChartData(calculationScenario.Output.SlidingCurve.Slices, (ChartMultipleAreaData) actual.Collection.ElementAt(slicesIndex)); @@ -135,20 +139,23 @@ ChartData[] chartDataArray = chartDataCollection.Collection.ToArray(); Assert.AreEqual(nrOfChartData, chartDataArray.Length); + var tangentLinesData = (ChartMultipleLineData) chartDataArray[tangentLinesIndex]; var leftGridData = (ChartPointData) chartDataArray[leftGridIndex]; var rightGridData = (ChartPointData) chartDataArray[rightGridIndex]; var slicesData = (ChartMultipleAreaData) chartDataArray[slicesIndex]; var slipPlaneData = (ChartLineData) chartDataArray[slipPlaneIndex]; var activeCircleRadiusData = (ChartLineData) chartDataArray[activeCircleRadiusIndex]; var passiveCircleRadiusData = (ChartLineData) chartDataArray[passiveCircleRadiusIndex]; + CollectionAssert.IsEmpty(tangentLinesData.Lines); CollectionAssert.IsEmpty(leftGridData.Points); CollectionAssert.IsEmpty(rightGridData.Points); CollectionAssert.IsEmpty(slicesData.Areas); CollectionAssert.IsEmpty(slipPlaneData.Points); CollectionAssert.IsEmpty(activeCircleRadiusData.Points); CollectionAssert.IsEmpty(passiveCircleRadiusData.Points); + Assert.AreEqual("Tangentlijnen", tangentLinesData.Name); Assert.AreEqual("Linker grid", leftGridData.Name); Assert.AreEqual("Rechter grid", rightGridData.Name); Assert.AreEqual("Lamellen", slicesData.Name); @@ -214,6 +221,33 @@ } /// + /// Asserts whether corresponds to + /// and . + /// + /// The original tangent line Y-coordinates. + /// The original surface line. + /// The actual . + /// Thrown when + /// does not correspond to and . + /// + private static void AssertTangentLinesChartData(IEnumerable tangentLines, + MacroStabilityInwardsSurfaceLine surfaceLine, + ChartMultipleLineData actual) + { + CollectionAssert.IsNotEmpty(actual.Lines); + double[] tangentLinesArray = tangentLines.ToArray(); + for (var i = 0; i < tangentLinesArray.Length; i++) + { + var expectedPoints = new[] + { + new Point2D(surfaceLine.LocalGeometry.First().X, tangentLinesArray[i]), + new Point2D(surfaceLine.LocalGeometry.Last().X, tangentLinesArray[i]) + }; + CollectionAssert.AreEqual(expectedPoints, actual.Lines.ElementAt(i)); + } + } + + /// /// Asserts whether corresponds to . /// /// The original slices.