Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs =================================================================== diff -u -r01ad489124b30cf09961349f6049911ae8ee6090 -r93acf9b0dcf191ef5088f4d822a81b1759c10532 --- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 01ad489124b30cf09961349f6049911ae8ee6090) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 93acf9b0dcf191ef5088f4d822a81b1759c10532) @@ -317,6 +317,15 @@ } /// + /// Looks up a localized string similar to Kruin buitentalud. + /// + public static string CharacteristicPoint_DikeTopAtRiver { + get { + return ResourceManager.GetString("CharacteristicPoint_DikeTopAtRiver", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Insteek sloot dijkzijde. /// public static string CharacteristicPoint_DitchDikeSide { Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx =================================================================== diff -u -r01ad489124b30cf09961349f6049911ae8ee6090 -r93acf9b0dcf191ef5088f4d822a81b1759c10532 --- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision 01ad489124b30cf09961349f6049911ae8ee6090) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision 93acf9b0dcf191ef5088f4d822a81b1759c10532) @@ -384,4 +384,7 @@ De ondergrens moet gelijk zijn aan of groter zijn dan de signaleringswaarde. + + Kruin buitentalud + \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SurfaceLines/MacroStabilityInwardsSurfaceLineExtensions.cs =================================================================== diff -u -r00bca55b16694cd9d828d5a0052016b442b78b6b -r93acf9b0dcf191ef5088f4d822a81b1759c10532 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SurfaceLines/MacroStabilityInwardsSurfaceLineExtensions.cs (.../MacroStabilityInwardsSurfaceLineExtensions.cs) (revision 00bca55b16694cd9d828d5a0052016b442b78b6b) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SurfaceLines/MacroStabilityInwardsSurfaceLineExtensions.cs (.../MacroStabilityInwardsSurfaceLineExtensions.cs) (revision 93acf9b0dcf191ef5088f4d822a81b1759c10532) @@ -62,6 +62,7 @@ surfaceLine.TrySetSurfaceLevelOutside(characteristicPoints.SurfaceLevelOutside); surfaceLine.TrySetDikeToeAtRiver(characteristicPoints.DikeToeAtRiver); surfaceLine.TrySetDikeTopAtPolder(characteristicPoints.DikeTopAtPolder); + surfaceLine.TrySetDikeTopAtRiver(characteristicPoints.DikeTopAtRiver); surfaceLine.TrySetDikeToeAtPolder(characteristicPoints.DikeToeAtPolder); surfaceLine.TrySetSurfaceLevelInside(characteristicPoints.SurfaceLevelInside); @@ -239,6 +240,31 @@ } /// + /// Tries to set the at the location of + /// . + /// + /// The to set the + /// for. + /// The point at which to set the . + /// Thrown when is null or + /// not on the . + private static void TrySetDikeTopAtRiver(this MacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + { + try + { + surfaceLine.SetDikeTopAtRiverAt(point); + } + catch (ArgumentNullException) + { + throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_DikeTopAtRiver), surfaceLine.Name); + } + catch (ArgumentException e) + { + throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name); + } + } + + /// /// Tries to set the at the location of /// . /// Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSurfaceLine.cs =================================================================== diff -u -r99f686f22091051a65ff1ee20abd68ffad713647 -r93acf9b0dcf191ef5088f4d822a81b1759c10532 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSurfaceLine.cs (.../MacroStabilityInwardsSurfaceLine.cs) (revision 99f686f22091051a65ff1ee20abd68ffad713647) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSurfaceLine.cs (.../MacroStabilityInwardsSurfaceLine.cs) (revision 93acf9b0dcf191ef5088f4d822a81b1759c10532) @@ -70,6 +70,12 @@ public Point3D DikeTopAtPolder { get; private set; } /// + /// Gets the location of the top of the dike when approaching from + /// outside the polder. + /// + public Point3D DikeTopAtRiver { get; private set; } + + /// /// Gets the location where the shoulder on the side of the polder /// connects with the dike. /// @@ -204,6 +210,23 @@ } /// + /// Sets the at the given point. + /// + /// The location as a which to set as the . + /// Thrown when doesn't contain a at + /// . + /// Thrown when is null. + public void SetDikeTopAtRiverAt(Point3D point) + { + Point3D geometryPoint = GetPointFromGeometry(point); + if (geometryPoint == null) + { + throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DikeTopAtRiver); + } + DikeTopAtRiver = geometryPoint; + } + + /// /// Sets the at the given point. /// /// The location as a which to set as the . @@ -391,6 +414,7 @@ hashCode = (hashCode * 397) ^ (TrafficLoadInside?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (TrafficLoadOutside?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (DikeTopAtPolder?.GetHashCode() ?? 0); + hashCode = (hashCode * 397) ^ (DikeTopAtRiver?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ShoulderBaseInside?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ShoulderTopInside?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (DikeToeAtPolder?.GetHashCode() ?? 0); @@ -410,6 +434,7 @@ TrafficLoadOutside = PointFromGeometryOrNull(fromSurfaceLine.TrafficLoadOutside); TrafficLoadInside = PointFromGeometryOrNull(fromSurfaceLine.TrafficLoadInside); DikeTopAtPolder = PointFromGeometryOrNull(fromSurfaceLine.DikeTopAtPolder); + DikeTopAtRiver = PointFromGeometryOrNull(fromSurfaceLine.DikeTopAtRiver); ShoulderBaseInside = PointFromGeometryOrNull(fromSurfaceLine.ShoulderBaseInside); ShoulderTopInside = PointFromGeometryOrNull(fromSurfaceLine.ShoulderTopInside); BottomDitchDikeSide = PointFromGeometryOrNull(fromSurfaceLine.BottomDitchDikeSide); @@ -441,6 +466,7 @@ && Equals(TrafficLoadInside, other.TrafficLoadInside) && Equals(TrafficLoadOutside, other.TrafficLoadOutside) && Equals(DikeTopAtPolder, other.DikeTopAtPolder) + && Equals(DikeTopAtRiver, other.DikeTopAtRiver) && Equals(ShoulderBaseInside, other.ShoulderBaseInside) && Equals(ShoulderTopInside, other.ShoulderTopInside) && Equals(DikeToeAtPolder, other.DikeToeAtPolder) Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SurfaceLines/MacroStabilityInwardsSurfaceLineExtensionsTest.cs =================================================================== diff -u -r00bca55b16694cd9d828d5a0052016b442b78b6b -r93acf9b0dcf191ef5088f4d822a81b1759c10532 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SurfaceLines/MacroStabilityInwardsSurfaceLineExtensionsTest.cs (.../MacroStabilityInwardsSurfaceLineExtensionsTest.cs) (revision 00bca55b16694cd9d828d5a0052016b442b78b6b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SurfaceLines/MacroStabilityInwardsSurfaceLineExtensionsTest.cs (.../MacroStabilityInwardsSurfaceLineExtensionsTest.cs) (revision 93acf9b0dcf191ef5088f4d822a81b1759c10532) @@ -54,6 +54,11 @@ set.DikeTopAtPolder = null; yield return new TestCaseData(set, RingtoetsCommonDataResources.CharacteristicPoint_DikeTopAtPolder).SetName(name); + name = "Missing DikeTopAtRiver"; + set = CreateCompleteCharacteristicPointSet(name); + set.DikeTopAtRiver = null; + yield return new TestCaseData(set, RingtoetsCommonDataResources.CharacteristicPoint_DikeTopAtRiver).SetName(name); + name = "Missing DikeToeAtPolder"; set = CreateCompleteCharacteristicPointSet(name); set.DikeToeAtPolder = null; @@ -91,6 +96,13 @@ new Action((points, p) => points.DikeTopAtPolder = p), RingtoetsCommonDataResources.CharacteristicPoint_DikeTopAtPolder).SetName(name); + name = "Moved DikeTopAtRiver"; + set = CreateCompleteCharacteristicPointSet(name); + yield return new TestCaseData( + set, + new Action((points, p) => points.DikeTopAtRiver = p), + RingtoetsCommonDataResources.CharacteristicPoint_DikeTopAtRiver).SetName(name); + name = "Moved DikeToeAtPolder"; set = CreateCompleteCharacteristicPointSet(name); yield return new TestCaseData( @@ -205,6 +217,7 @@ // Assert Assert.AreEqual(points.DikeTopAtPolder, surfaceLine.DikeTopAtPolder); + Assert.AreEqual(points.DikeTopAtRiver, surfaceLine.DikeTopAtRiver); Assert.AreEqual(points.ShoulderBaseInside, surfaceLine.ShoulderBaseInside); Assert.AreEqual(points.ShoulderTopInside, surfaceLine.ShoulderTopInside); Assert.AreEqual(points.TrafficLoadOutside, surfaceLine.TrafficLoadOutside); @@ -258,14 +271,15 @@ string message = $"Profielschematisatie '{points.Name}' kan niet gebruikt worden. " + $"De geometrie bevat geen punt op locatie {changedPoint} om als \'{pointDescription}\' in te stellen. " + "Dit karakteristieke punt is verplicht."; - Assert.AreEqual(message, exception.Message); + ; Assert.AreEqual(message, exception.Message); } private static IEnumerable CharacteristicPointsToGeometry(CharacteristicPoints points) { return new[] { points.DikeTopAtPolder, + points.DikeTopAtRiver, points.ShoulderBaseInside, points.ShoulderTopInside, points.TrafficLoadOutside, @@ -288,6 +302,7 @@ var trafficLoadOutside = new Point3D(2.25, 2, 5); var trafficLoadInside = new Point3D(2.45, 2, 5); var dikeTopAtPolder = new Point3D(2.7, 2, 5); + var dikeTopAtRiver = new Point3D(2.6, 2, 5); var shoulderBaseInside = new Point3D(3.2, 2, 5); var shoulderTopInside = new Point3D(3.5, 2, 5); var dikeToeAtPolder = new Point3D(4.4, 3, 8); @@ -308,6 +323,7 @@ SurfaceLevelInside = surfaceLevelInside, DikeToeAtRiver = dikeToeAtRiver, DikeToeAtPolder = dikeToeAtPolder, + DikeTopAtRiver = dikeTopAtRiver, DitchDikeSide = ditchDikeSide, BottomDitchDikeSide = bottomDitchDikeSide, BottomDitchPolderSide = bottomDitchPolderSide, Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SurfaceLines/MacrostabilityInwardsSurfaceLineTransformerTest.cs =================================================================== diff -u -r00bca55b16694cd9d828d5a0052016b442b78b6b -r93acf9b0dcf191ef5088f4d822a81b1759c10532 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SurfaceLines/MacrostabilityInwardsSurfaceLineTransformerTest.cs (.../MacrostabilityInwardsSurfaceLineTransformerTest.cs) (revision 00bca55b16694cd9d828d5a0052016b442b78b6b) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SurfaceLines/MacrostabilityInwardsSurfaceLineTransformerTest.cs (.../MacrostabilityInwardsSurfaceLineTransformerTest.cs) (revision 93acf9b0dcf191ef5088f4d822a81b1759c10532) @@ -104,6 +104,11 @@ "Kruin binnentalud") .SetName("Move DikeTopAtPolder"); yield return new TestCaseData( + new Action((cp, p) => cp.DikeTopAtRiver = p), + new Func(sl => sl.DikeTopAtRiver), + "Kruin buitentalud") + .SetName("Move DikeTopAtRiver"); + yield return new TestCaseData( new Action((cp, p) => cp.DikeToeAtPolder = p), new Func(sl => sl.DikeToeAtPolder), "Teen dijk binnenwaarts") @@ -237,7 +242,10 @@ [Test] [TestCaseSource(nameof(MoveOptionalCharacteristicPoint))] - public void Transform_OptionalCharacteristicPointNotOnSurfaceLine_LogErrorAndReturnSurfaceLineWithoutCharacteristicPointSet(Action pointChange, Func pointWhichIsNull, string changedCharacteristicPointName) + public void Transform_OptionalCharacteristicPointNotOnSurfaceLine_LogErrorAndReturnSurfaceLineWithoutCharacteristicPointSet( + Action pointChange, + Func pointWhichIsNull, + string changedCharacteristicPointName) { // Setup var referenceLine = new ReferenceLine(); @@ -271,6 +279,7 @@ TrafficLoadOutside = point2, TrafficLoadInside = point2, DikeTopAtPolder = point2, + DikeTopAtRiver = point2, ShoulderBaseInside = point3, ShoulderTopInside = point3, BottomDitchDikeSide = point3, @@ -361,6 +370,7 @@ TrafficLoadOutside = point2, TrafficLoadInside = point2, DikeTopAtPolder = point2, + DikeTopAtRiver = point2, ShoulderBaseInside = point3, ShoulderTopInside = point3, BottomDitchDikeSide = point3, Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSurfaceLineTest.cs =================================================================== diff -u -r99f686f22091051a65ff1ee20abd68ffad713647 -r93acf9b0dcf191ef5088f4d822a81b1759c10532 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSurfaceLineTest.cs (.../MacroStabilityInwardsSurfaceLineTest.cs) (revision 99f686f22091051a65ff1ee20abd68ffad713647) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSurfaceLineTest.cs (.../MacroStabilityInwardsSurfaceLineTest.cs) (revision 93acf9b0dcf191ef5088f4d822a81b1759c10532) @@ -349,13 +349,31 @@ } [Test] + public void Equals_DifferentDikeTopAtRiver_ReturnsFalse() + { + // Setup + MacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); + MacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); + Point3D[] points = surfaceLineTwo.Points.ToArray(); + surfaceLineTwo.SetDikeTopAtRiverAt(points[5]); + + // Call + bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); + bool isLineTwoEqualToLineOne = surfaceLineTwo.Equals(surfaceLineOne); + + // Assert + Assert.IsFalse(isLineOneEqualToLineTwo); + Assert.IsFalse(isLineTwoEqualToLineOne); + } + + [Test] public void Equals_DifferentShoulderBaseInside_ReturnsFalse() { // Setup MacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); MacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); Point3D[] points = surfaceLineTwo.Points.ToArray(); - surfaceLineTwo.SetShoulderBaseInsideAt(points[5]); + surfaceLineTwo.SetShoulderBaseInsideAt(points[1]); // Call bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); @@ -712,6 +730,25 @@ } [TestFixture] + public class SetDikeTopAtRiverAtTest : SetCharacteristicPointTest + { + protected override void SetCharacteristicPoint(MacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + { + surfaceLine.SetDikeTopAtRiverAt(point); + } + + protected override Point3D GetCharacteristicPoint(MacroStabilityInwardsSurfaceLine surfaceLine) + { + return surfaceLine.DikeTopAtRiver; + } + + protected override string CharacteristicPointDescription() + { + return "Kruin buitentalud"; + } + } + + [TestFixture] public class SetShoulderBaseInsideAtTest : SetCharacteristicPointTest { protected override void SetCharacteristicPoint(MacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) @@ -925,23 +962,25 @@ new Point3D(9, 0, 4), new Point3D(10, 0, 3), new Point3D(11, 0, 2), - new Point3D(12, 0, 1) + new Point3D(12, 0, 1), + new Point3D(13, 0, 1) }; surfaceLine.SetGeometry(geometry); surfaceLine.SetSurfaceLevelOutsideAt(geometry[0]); surfaceLine.SetTrafficLoadOutsideAt(geometry[1]); surfaceLine.SetTrafficLoadInsideAt(geometry[2]); surfaceLine.SetDikeTopAtPolderAt(geometry[3]); - surfaceLine.SetShoulderBaseInsideAt(geometry[4]); - surfaceLine.SetShoulderTopInsideAt(geometry[5]); - surfaceLine.SetBottomDitchDikeSideAt(geometry[6]); - surfaceLine.SetBottomDitchPolderSideAt(geometry[7]); - surfaceLine.SetDikeToeAtPolderAt(geometry[8]); - surfaceLine.SetDikeToeAtRiverAt(geometry[9]); - surfaceLine.SetDitchDikeSideAt(geometry[10]); - surfaceLine.SetDitchPolderSideAt(geometry[11]); - surfaceLine.SetSurfaceLevelInsideAt(geometry[12]); + surfaceLine.SetDikeTopAtRiverAt(geometry[4]); + surfaceLine.SetShoulderBaseInsideAt(geometry[5]); + surfaceLine.SetShoulderTopInsideAt(geometry[6]); + surfaceLine.SetBottomDitchDikeSideAt(geometry[7]); + surfaceLine.SetBottomDitchPolderSideAt(geometry[8]); + surfaceLine.SetDikeToeAtPolderAt(geometry[9]); + surfaceLine.SetDikeToeAtRiverAt(geometry[10]); + surfaceLine.SetDitchDikeSideAt(geometry[11]); + surfaceLine.SetDitchPolderSideAt(geometry[12]); + surfaceLine.SetSurfaceLevelInsideAt(geometry[13]); return surfaceLine; }