Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/DikesDesign/SurfaceLineHeightAdapterTest.cs =================================================================== diff -u -r4000 -r4052 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/DikesDesign/SurfaceLineHeightAdapterTest.cs (.../SurfaceLineHeightAdapterTest.cs) (revision 4000) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/DikesDesign/SurfaceLineHeightAdapterTest.cs (.../SurfaceLineHeightAdapterTest.cs) (revision 4052) @@ -28,1458 +28,1457 @@ using Deltares.DamEngine.TestHelpers.Factories; using NUnit.Framework; -namespace Deltares.DamEngine.Calculators.Tests.DikesDesign +namespace Deltares.DamEngine.Calculators.Tests.DikesDesign; + +[TestFixture] +public class SurfaceLineHeightAdapterTest { - [TestFixture] - public class SurfaceLineHeightAdapterTest + [Test] + public void ConstructNewSurfaceLineReturnsANewSurfaceLine() { - [Test] - public void ConstructNewSurfaceLineReturnsANewSurfaceLine() + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(2, 1, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(3, 0, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 constructNewSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(1); - Assert.IsNotNull(constructNewSurfaceLine); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(2, 1, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(3, 0, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 constructNewSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(1); + Assert.IsNotNull(constructNewSurfaceLine); + } - [Test] - public void AdaptedSurfaceLineHasSamePointAtToeRiver() + [Test] + public void AdaptedSurfaceLineHasSamePointAtToeRiver() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 6.0; - var pointAtToeRiver = new GeometryPoint - { - X = 17, - Z = 0 - }; - var pointAtTopRiver = new GeometryPoint - { - X = 34.5, - Z = 5 - }; - var pointAtTopPolder = new GeometryPoint - { - X = 35, - Z = 5 - }; - var pointAtToePolder = new GeometryPoint - { - X = 36, - Z = 0 - }; + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 6.0; + var pointAtToeRiver = new GeometryPoint + { + X = 17, + Z = 0 + }; + var pointAtTopRiver = new GeometryPoint + { + X = 34.5, + Z = 5 + }; + var pointAtTopPolder = new GeometryPoint + { + X = 35, + Z = 5 + }; + var pointAtToePolder = new GeometryPoint + { + X = 36, + Z = 0 + }; - surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); + surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - { - GeometryPoint newPointAtToeRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); - Assert.IsTrue(newPointAtToeRiver.LocationEquals(pointAtToeRiver)); - Assert.IsTrue(newSurfaceLine.Geometry.Points.Any(p => p.LocationEquals(pointAtToeRiver))); - } - } - - [Test] - public void AdaptedSurfaceLineHasSameSlopeInside() + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); { - var line = new SurfaceLine2 - { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - SurfaceLine2 surfaceLine = line; - var location = new Location(); - const double cToleranceSlope = 0.0001; - const double newDikeHeight = 6.0; - var pointAtToeRiver = new GeometryPoint - { - X = 17, - Z = 0 - }; - var pointAtTopRiver = new GeometryPoint - { - X = 34.5, - Z = 5 - }; - var pointAtTopPolder = new GeometryPoint - { - X = 35, - Z = 5 - }; - var pointAtToePolder = new GeometryPoint - { - X = 36, - Z = 0 - }; - surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); - surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - double oldSlope = TanSlopeInside(surfaceLine); - double newSlope = TanSlopeInside(newSurfaceLine); - Assert.AreEqual(oldSlope, newSlope, cToleranceSlope); + GeometryPoint newPointAtToeRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); + Assert.IsTrue(newPointAtToeRiver.LocationEquals(pointAtToeRiver)); + Assert.IsTrue(newSurfaceLine.Geometry.Points.Any(p => p.LocationEquals(pointAtToeRiver))); } + } - [Test] - public void AdaptedSurfaceLineHasCorrectNewPointAtTopRiver() + [Test] + public void AdaptedSurfaceLineHasSameSlopeInside() + { + var line = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - var pointAtToeRiver = new GeometryPoint - { - X = 0, - Z = 0 - }; - var pointAtTopRiver = new GeometryPoint - { - X = 1, - Z = 1 - }; - var pointAtTopPolder = new GeometryPoint - { - X = 2, - Z = 1 - }; - var pointAtToePolder = new GeometryPoint - { - X = 3, - Z = 0 - }; - surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - GeometryPoint actualPoint = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - var expectedPoint = new GeometryPoint - { - X = 2, - Z = 2 - }; - Assert.IsTrue(expectedPoint.LocationEquals(actualPoint)); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + SurfaceLine2 surfaceLine = line; + var location = new Location(); + const double cToleranceSlope = 0.0001; + const double newDikeHeight = 6.0; + var pointAtToeRiver = new GeometryPoint + { + X = 17, + Z = 0 + }; + var pointAtTopRiver = new GeometryPoint + { + X = 34.5, + Z = 5 + }; + var pointAtTopPolder = new GeometryPoint + { + X = 35, + Z = 5 + }; + var pointAtToePolder = new GeometryPoint + { + X = 36, + Z = 0 + }; + surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); + surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + double oldSlope = TanSlopeInside(surfaceLine); + double newSlope = TanSlopeInside(newSurfaceLine); + Assert.AreEqual(oldSlope, newSlope, cToleranceSlope); + } - [Test] - public void AdaptedSurfaceLineHasRemovedOldPointAtTopRiverCorrectly() + [Test] + public void AdaptedSurfaceLineHasCorrectNewPointAtTopRiver() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - var pointAtToeRiver = new GeometryPoint - { - X = 0, - Z = 0 - }; - var pointAtTopRiver = new GeometryPoint - { - X = 1, - Z = 1 - }; - var pointAtTopPolder = new GeometryPoint - { - X = 2, - Z = 1 - }; - var pointAtToePolder = new GeometryPoint - { - X = 3, - Z = 0 - }; - surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - Assert.IsFalse(newSurfaceLine.Geometry.Points.Any(p => p.LocationEquals(pointAtTopRiver))); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + var pointAtToeRiver = new GeometryPoint + { + X = 0, + Z = 0 + }; + var pointAtTopRiver = new GeometryPoint + { + X = 1, + Z = 1 + }; + var pointAtTopPolder = new GeometryPoint + { + X = 2, + Z = 1 + }; + var pointAtToePolder = new GeometryPoint + { + X = 3, + Z = 0 + }; + surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + GeometryPoint actualPoint = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + var expectedPoint = new GeometryPoint + { + X = 2, + Z = 2 + }; + Assert.IsTrue(expectedPoint.LocationEquals(actualPoint)); + } - [Test] - public void AdaptedSurfaceLineWithoutShoulderHasCorrectNewPointAtTopPolder() + [Test] + public void AdaptedSurfaceLineHasRemovedOldPointAtTopRiverCorrectly() + { + var surfaceLine = new SurfaceLine2 { - var line = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - SurfaceLine2 surfaceLine = line; - var location = new Location(); - const double newDikeHeight = 2.0; - var pointAtToeRiver = new GeometryPoint - { - X = 0, - Z = 0 - }; - var pointAtTopRiver = new GeometryPoint - { - X = 1, - Z = 1 - }; - var pointAtTopPolder = new GeometryPoint - { - X = 2, - Z = 1 - }; - var pointAtToePolder = new GeometryPoint - { - X = 3, - Z = 0 - }; - surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - GeometryPoint actualPoint = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - var expectedPoint = new GeometryPoint - { - X = 3, - Z = 2 - }; - Assert.IsTrue(expectedPoint.LocationEquals(actualPoint)); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + var pointAtToeRiver = new GeometryPoint + { + X = 0, + Z = 0 + }; + var pointAtTopRiver = new GeometryPoint + { + X = 1, + Z = 1 + }; + var pointAtTopPolder = new GeometryPoint + { + X = 2, + Z = 1 + }; + var pointAtToePolder = new GeometryPoint + { + X = 3, + Z = 0 + }; + surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + Assert.IsFalse(newSurfaceLine.Geometry.Points.Any(p => p.LocationEquals(pointAtTopRiver))); + } - [Test] - public void AdaptedSurfaceLineWithoutShoulderHasCorrectlyRemovedOldPointAtTopPolder() + [Test] + public void AdaptedSurfaceLineWithoutShoulderHasCorrectNewPointAtTopPolder() + { + var line = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - var pointAtToeRiver = new GeometryPoint - { - X = 0, - Z = 0 - }; - var pointAtTopRiver = new GeometryPoint - { - X = 1, - Z = 1 - }; - var pointAtTopPolder = new GeometryPoint - { - X = 2, - Z = 1 - }; - var pointAtToePolder = new GeometryPoint - { - X = 3, - Z = 0 - }; - surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - Assert.IsFalse(newSurfaceLine.Geometry.Points.Any(p => p.LocationEquals(pointAtTopPolder))); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + SurfaceLine2 surfaceLine = line; + var location = new Location(); + const double newDikeHeight = 2.0; + var pointAtToeRiver = new GeometryPoint + { + X = 0, + Z = 0 + }; + var pointAtTopRiver = new GeometryPoint + { + X = 1, + Z = 1 + }; + var pointAtTopPolder = new GeometryPoint + { + X = 2, + Z = 1 + }; + var pointAtToePolder = new GeometryPoint + { + X = 3, + Z = 0 + }; + surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + GeometryPoint actualPoint = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + var expectedPoint = new GeometryPoint + { + X = 3, + Z = 2 + }; + Assert.IsTrue(expectedPoint.LocationEquals(actualPoint)); + } - [Test] - public void AdaptedSurfaceLineWithoutShoulderHasCorrectNewPointAtToePolder() + [Test] + public void AdaptedSurfaceLineWithoutShoulderHasCorrectlyRemovedOldPointAtTopPolder() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - var pointAtToeRiver = new GeometryPoint - { - X = 0, - Z = 0 - }; - var pointAtTopRiver = new GeometryPoint - { - X = 2, - Z = 1 - }; - var pointAtTopPolder = new GeometryPoint - { - X = 3, - Z = 1 - }; - var pointAtToePolder = new GeometryPoint - { - X = 7, - Z = 0 - }; - surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - GeometryPoint actualPoint = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - var expectedPoint = new GeometryPoint - { - X = 13 - }; - Assert.IsTrue(expectedPoint.LocationEquals(actualPoint)); - double oldSlope = TanSlopeInside(surfaceLine); - double newSlope = TanSlopeInside(newSurfaceLine); - Assert.AreEqual(oldSlope, newSlope, 0.001); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + var pointAtToeRiver = new GeometryPoint + { + X = 0, + Z = 0 + }; + var pointAtTopRiver = new GeometryPoint + { + X = 1, + Z = 1 + }; + var pointAtTopPolder = new GeometryPoint + { + X = 2, + Z = 1 + }; + var pointAtToePolder = new GeometryPoint + { + X = 3, + Z = 0 + }; + surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + Assert.IsFalse(newSurfaceLine.Geometry.Points.Any(p => p.LocationEquals(pointAtTopPolder))); + } - [Test] - public void AdaptedSurfaceLineWithShoulderHasCorrectPointAtToePolder() + [Test] + public void AdaptedSurfaceLineWithoutShoulderHasCorrectNewPointAtToePolder() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(2, 1, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(3, 0.5, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(4, 0.5, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - var expectedPoint = new GeometryPoint - { - X = 7, - Z = 0 - }; // - GeometryPoint actualPoint = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - Assert.IsTrue(expectedPoint.LocationEquals(actualPoint)); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + var pointAtToeRiver = new GeometryPoint + { + X = 0, + Z = 0 + }; + var pointAtTopRiver = new GeometryPoint + { + X = 2, + Z = 1 + }; + var pointAtTopPolder = new GeometryPoint + { + X = 3, + Z = 1 + }; + var pointAtToePolder = new GeometryPoint + { + X = 7, + Z = 0 + }; + surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + GeometryPoint actualPoint = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + var expectedPoint = new GeometryPoint + { + X = 13 + }; + Assert.IsTrue(expectedPoint.LocationEquals(actualPoint)); + double oldSlope = TanSlopeInside(surfaceLine); + double newSlope = TanSlopeInside(newSurfaceLine); + Assert.AreEqual(oldSlope, newSlope, 0.001); + } - [Test] - public void AdaptedSurfaceLineHasRemovedShoulderPointsCorrectly() + [Test] + public void AdaptedSurfaceLineWithShoulderHasCorrectPointAtToePolder() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 3.0; - var pointAtToeRiver = new GeometryPoint - { - X = 0, - Z = 0 - }; - var pointAtTopRiver = new GeometryPoint - { - X = 1, - Z = 1 - }; - var pointAtTopPolder = new GeometryPoint - { - X = 2, - Z = 1 - }; - var pointAtShoulderInsteek = new GeometryPoint - { - X = 3, - Z = 0.5 - }; - var pointAtShoulderTop = new GeometryPoint - { - X = 4, - Z = 0.5 - }; - var pointAtToePolder = new GeometryPoint - { - X = 5, - Z = 0 - }; - var pointAtSurfaceLevelInside = new GeometryPoint - { - X = 100, - Z = 0 - }; - surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(pointAtShoulderInsteek.X, pointAtShoulderInsteek.Z, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(pointAtShoulderTop.X, pointAtShoulderTop.Z, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(pointAtSurfaceLevelInside.X, pointAtSurfaceLevelInside.Z, CharacteristicPointType.SurfaceLevelInside); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - Assert.IsNull(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside)); - Assert.IsNull(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside)); - Assert.IsFalse(newSurfaceLine.Geometry.Points.Any(p => p.LocationEquals(pointAtShoulderInsteek))); - Assert.IsFalse(newSurfaceLine.Geometry.Points.Any(p => p.LocationEquals(pointAtShoulderTop))); - GeometryPoint newPointAtToePolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - Assert.AreEqual(3, newSurfaceLine.GetPointSegmentIncluding(pointAtTopRiver.X, newPointAtToePolder.X).Count()); - Assert.AreEqual(5, newSurfaceLine.Geometry.Points.Count); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(2, 1, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(3, 0.5, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(4, 0.5, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + var expectedPoint = new GeometryPoint + { + X = 7, + Z = 0 + }; // + GeometryPoint actualPoint = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Assert.IsTrue(expectedPoint.LocationEquals(actualPoint)); + } - [Test] - public void AdaptedSurfaceLineWithLargeShoulderHaveSameToeAtPolder() + [Test] + public void AdaptedSurfaceLineHasRemovedShoulderPointsCorrectly() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 1.5; - var pointAtToeRiver = new GeometryPoint - { - X = 0, - Z = 0 - }; - var pointAtTopRiver = new GeometryPoint - { - X = 1, - Z = 1 - }; - var pointAtTopPolder = new GeometryPoint - { - X = 2, - Z = 1 - }; - var pointAtShoulderInsteek = new GeometryPoint - { - X = 3, - Z = 0.5 - }; - var pointAtShoulderTop = new GeometryPoint - { - X = 5, - Z = 0.5 - }; - var pointAtToePolder = new GeometryPoint - { - X = 6, - Z = 0 - }; - var pointAtSurfaceLevelInside = new GeometryPoint - { - X = 100, - Z = 0 - }; - surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(pointAtShoulderInsteek.X, pointAtShoulderInsteek.Z, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(pointAtShoulderTop.X, pointAtShoulderTop.Z, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(pointAtSurfaceLevelInside.X, pointAtSurfaceLevelInside.Z, CharacteristicPointType.SurfaceLevelInside); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - Assert.IsTrue(pointAtToePolder.LocationEquals(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder))); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 3.0; + var pointAtToeRiver = new GeometryPoint + { + X = 0, + Z = 0 + }; + var pointAtTopRiver = new GeometryPoint + { + X = 1, + Z = 1 + }; + var pointAtTopPolder = new GeometryPoint + { + X = 2, + Z = 1 + }; + var pointAtShoulderInsteek = new GeometryPoint + { + X = 3, + Z = 0.5 + }; + var pointAtShoulderTop = new GeometryPoint + { + X = 4, + Z = 0.5 + }; + var pointAtToePolder = new GeometryPoint + { + X = 5, + Z = 0 + }; + var pointAtSurfaceLevelInside = new GeometryPoint + { + X = 100, + Z = 0 + }; + surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(pointAtShoulderInsteek.X, pointAtShoulderInsteek.Z, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(pointAtShoulderTop.X, pointAtShoulderTop.Z, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(pointAtSurfaceLevelInside.X, pointAtSurfaceLevelInside.Z, CharacteristicPointType.SurfaceLevelInside); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + Assert.IsNull(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside)); + Assert.IsNull(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside)); + Assert.IsFalse(newSurfaceLine.Geometry.Points.Any(p => p.LocationEquals(pointAtShoulderInsteek))); + Assert.IsFalse(newSurfaceLine.Geometry.Points.Any(p => p.LocationEquals(pointAtShoulderTop))); + GeometryPoint newPointAtToePolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Assert.AreEqual(3, newSurfaceLine.GetPointSegmentIncluding(pointAtTopRiver.X, newPointAtToePolder.X).Count()); + Assert.AreEqual(5, newSurfaceLine.Geometry.Points.Count); + } - [Test] - public void AdaptedSurfaceLineWithLargeShoulderHaveSameTopAtShoulderInside() + [Test] + public void AdaptedSurfaceLineWithLargeShoulderHaveSameToeAtPolder() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 3.0; - var pointAtToeRiver = new GeometryPoint - { - X = 0, - Z = 0 - }; - var pointAtTopRiver = new GeometryPoint - { - X = 1, - Z = 2 - }; - var pointAtTopPolder = new GeometryPoint - { - X = 2, - Z = 2 - }; - var pointAtShoulderInsteek = new GeometryPoint - { - X = 3, - Z = 1 - }; - var pointAtShoulderTop = new GeometryPoint - { - X = 5, - Z = 1 - }; - var pointAtToePolder = new GeometryPoint - { - X = 6, - Z = 2 - }; - var pointAtSurfaceLevelInside = new GeometryPoint - { - X = 100, - Z = 0 - }; - surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(pointAtShoulderInsteek.X, pointAtShoulderInsteek.Z, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(pointAtShoulderTop.X, pointAtShoulderTop.Z, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(pointAtSurfaceLevelInside.X, pointAtSurfaceLevelInside.Z, CharacteristicPointType.SurfaceLevelInside); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - Assert.IsTrue(pointAtShoulderTop.LocationEquals(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside))); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 1.5; + var pointAtToeRiver = new GeometryPoint + { + X = 0, + Z = 0 + }; + var pointAtTopRiver = new GeometryPoint + { + X = 1, + Z = 1 + }; + var pointAtTopPolder = new GeometryPoint + { + X = 2, + Z = 1 + }; + var pointAtShoulderInsteek = new GeometryPoint + { + X = 3, + Z = 0.5 + }; + var pointAtShoulderTop = new GeometryPoint + { + X = 5, + Z = 0.5 + }; + var pointAtToePolder = new GeometryPoint + { + X = 6, + Z = 0 + }; + var pointAtSurfaceLevelInside = new GeometryPoint + { + X = 100, + Z = 0 + }; + surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(pointAtShoulderInsteek.X, pointAtShoulderInsteek.Z, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(pointAtShoulderTop.X, pointAtShoulderTop.Z, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(pointAtSurfaceLevelInside.X, pointAtSurfaceLevelInside.Z, CharacteristicPointType.SurfaceLevelInside); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + Assert.IsTrue(pointAtToePolder.LocationEquals(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder))); + } - [Test] - public void AdaptedSurfaceLineWithLargeShoulderShouldHaveACorrectIntersectionPoint() + [Test] + public void AdaptedSurfaceLineWithLargeShoulderHaveSameTopAtShoulderInside() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 3.0; - var pointAtToeRiver = new GeometryPoint - { - X = 0, - Z = 0 - }; - var pointAtTopRiver = new GeometryPoint - { - X = 1, - Z = 2 - }; - var pointAtTopPolder = new GeometryPoint - { - X = 2, - Z = 2 - }; - var pointAtShoulderInsteek = new GeometryPoint - { - X = 3, - Z = 1 - }; - var pointAtShoulderTop = new GeometryPoint - { - X = 5, - Z = 1 - }; - var pointAtToePolder = new GeometryPoint - { - X = 6, - Z = 0 - }; - var pointAtSurfaceLevelInside = new GeometryPoint - { - X = 100, - Z = 0 - }; - surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(pointAtShoulderInsteek.X, pointAtShoulderInsteek.Z, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(pointAtShoulderTop.X, pointAtShoulderTop.Z, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(pointAtSurfaceLevelInside.X, pointAtSurfaceLevelInside.Z, CharacteristicPointType.SurfaceLevelInside); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - var expectedPoint = new GeometryPoint - { - X = 4.5, - Z = 1 - }; - GeometryPoint actualPoint = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); - Assert.IsTrue(expectedPoint.LocationEquals(actualPoint)); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 3.0; + var pointAtToeRiver = new GeometryPoint + { + X = 0, + Z = 0 + }; + var pointAtTopRiver = new GeometryPoint + { + X = 1, + Z = 2 + }; + var pointAtTopPolder = new GeometryPoint + { + X = 2, + Z = 2 + }; + var pointAtShoulderInsteek = new GeometryPoint + { + X = 3, + Z = 1 + }; + var pointAtShoulderTop = new GeometryPoint + { + X = 5, + Z = 1 + }; + var pointAtToePolder = new GeometryPoint + { + X = 6, + Z = 2 + }; + var pointAtSurfaceLevelInside = new GeometryPoint + { + X = 100, + Z = 0 + }; + surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(pointAtShoulderInsteek.X, pointAtShoulderInsteek.Z, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(pointAtShoulderTop.X, pointAtShoulderTop.Z, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(pointAtSurfaceLevelInside.X, pointAtSurfaceLevelInside.Z, CharacteristicPointType.SurfaceLevelInside); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + Assert.IsTrue(pointAtShoulderTop.LocationEquals(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside))); + } - [Test] - public void AdaptedSurfaceLineWithSoulderAndDitchShouldNotCreateInvalidSurfaceLine() + [Test] + public void AdaptedSurfaceLineWithLargeShoulderShouldHaveACorrectIntersectionPoint() + { + var surfaceLine = new SurfaceLine2 { - SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateRealisticSurfaceLineForHeightAdapter(); - var location = new Location(); - const double newDikeHeight = 19.2; - ValidationResult validationError = surfaceLine.Validate().FirstOrDefault(vr => vr.MessageType == ValidationResultType.Error); - if (validationError != null) + CharacteristicPoints = { - throw new SurfaceLineException(validationError.Text); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 3.0; + var pointAtToeRiver = new GeometryPoint + { + X = 0, + Z = 0 + }; + var pointAtTopRiver = new GeometryPoint + { + X = 1, + Z = 2 + }; + var pointAtTopPolder = new GeometryPoint + { + X = 2, + Z = 2 + }; + var pointAtShoulderInsteek = new GeometryPoint + { + X = 3, + Z = 1 + }; + var pointAtShoulderTop = new GeometryPoint + { + X = 5, + Z = 1 + }; + var pointAtToePolder = new GeometryPoint + { + X = 6, + Z = 0 + }; + var pointAtSurfaceLevelInside = new GeometryPoint + { + X = 100, + Z = 0 + }; + surfaceLine.EnsurePointOfType(pointAtToeRiver.X, pointAtToeRiver.Z, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopRiver.X, pointAtTopRiver.Z, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(pointAtTopPolder.X, pointAtTopPolder.Z, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(pointAtShoulderInsteek.X, pointAtShoulderInsteek.Z, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(pointAtShoulderTop.X, pointAtShoulderTop.Z, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(pointAtToePolder.X, pointAtToePolder.Z, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(pointAtSurfaceLevelInside.X, pointAtSurfaceLevelInside.Z, CharacteristicPointType.SurfaceLevelInside); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + var expectedPoint = new GeometryPoint + { + X = 4.5, + Z = 1 + }; + GeometryPoint actualPoint = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); + Assert.IsTrue(expectedPoint.LocationEquals(actualPoint)); + } - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - validationError = newSurfaceLine.Validate().FirstOrDefault(vr => vr.MessageType == ValidationResultType.Error); - if (validationError != null) - { - throw new SurfaceLineException(validationError.Text); - } + [Test] + public void AdaptedSurfaceLineWithSoulderAndDitchShouldNotCreateInvalidSurfaceLine() + { + SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateRealisticSurfaceLineForHeightAdapter(); + var location = new Location(); + const double newDikeHeight = 19.2; + ValidationResult validationError = surfaceLine.Validate().FirstOrDefault(vr => vr.MessageType == ValidationResultType.Error); + if (validationError != null) + { + throw new SurfaceLineException(validationError.Text); } - /// - /// This tests with a realistic surfaceline which contains all possible relevant characteristic points - /// - [Test] - public void AdaptedSurfaceLineWithTrafficLoadPointsShouldAdjustThosePoints1() + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + validationError = newSurfaceLine.Validate().FirstOrDefault(vr => vr.MessageType == ValidationResultType.Error); + if (validationError != null) { - SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateRealisticSurfaceLineForHeightAdapter(); - var location = new Location(); - const double cTolerance = 0.0000001; - const double newDikeHeight = 19.2; - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - Assert.AreEqual(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadOutside).Z, cTolerance); - Assert.AreEqual(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadInside).Z, cTolerance); + throw new SurfaceLineException(validationError.Text); } + } - /// - /// This tests with a surfaceline that contains the minimum possible characteristic points - /// - [Test] - public void AdaptedSurfaceLineWithTrafficLoadPointsShouldAdjustThosePoints2() + /// + /// This tests with a realistic surfaceline which contains all possible relevant characteristic points + /// + [Test] + public void AdaptedSurfaceLineWithTrafficLoadPointsShouldAdjustThosePoints1() + { + SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateRealisticSurfaceLineForHeightAdapter(); + var location = new Location(); + const double cTolerance = 0.0000001; + const double newDikeHeight = 19.2; + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + Assert.AreEqual(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadOutside).Z, cTolerance); + Assert.AreEqual(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadInside).Z, cTolerance); + } + + /// + /// This tests with a surfaceline that contains the minimum possible characteristic points + /// + [Test] + public void AdaptedSurfaceLineWithTrafficLoadPointsShouldAdjustThosePoints2() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 1.2; - var pointDikeToeAtRiver = new GeometryPoint - { - X = 0, - Z = 0 - }; - var pointDikeTopAtRiver = new GeometryPoint - { - X = 1, - Z = 1 - }; - var pointTrafficLoadOutside = new GeometryPoint - { - X = 1.1, - Z = 1 - }; - var pointTrafficLoadInside = new GeometryPoint - { - X = 1.9, - Z = 1 - }; - var pointDikeTopAtPolder = new GeometryPoint - { - X = 2, - Z = 1 - }; - var pointDikeToeAtPolder = new GeometryPoint - { - X = 3, - Z = 0 - }; - surfaceLine.EnsurePointOfType(pointDikeToeAtRiver.X, pointDikeToeAtRiver.Z, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(pointDikeTopAtRiver.X, pointDikeTopAtRiver.Z, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(pointTrafficLoadOutside.X, pointTrafficLoadOutside.Z, CharacteristicPointType.TrafficLoadOutside); - surfaceLine.EnsurePointOfType(pointTrafficLoadInside.X, pointTrafficLoadInside.Z, CharacteristicPointType.TrafficLoadInside); - surfaceLine.EnsurePointOfType(pointDikeTopAtPolder.X, pointDikeTopAtPolder.Z, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(pointDikeToeAtPolder.X, pointDikeToeAtPolder.Z, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - Assert.AreEqual(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadOutside).Z); - Assert.AreEqual(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadInside).Z); - } - - /// - /// Test if dike with skewed dike table and points between characteristic points is constructed correctly with new height - /// - [Test] - public void CanAdaptSurfaceLineWithSkewedDikeTableAndInBetweenPoints() + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 1.2; + var pointDikeToeAtRiver = new GeometryPoint { - SurfaceLine2 surfaceLine = CreateSurfaceLineWithSkwewedDikeTableAndInBetweenPoints(); - var location = new Location(); - const double cTolerance = 0.001; - const double newDikeHeight = 4.0; - Assert.AreEqual(10, surfaceLine.Geometry.Points.Count); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - Assert.AreEqual(6, newSurfaceLine.Geometry.Points.Count); - Assert.AreEqual(7.3333, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).X, cTolerance); - Assert.AreEqual(4.0000, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Z, cTolerance); - Assert.AreEqual(9.3333, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X, cTolerance); - Assert.AreEqual(4.0000, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z, cTolerance); - Assert.AreEqual(14.6666, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X, cTolerance); - Assert.AreEqual(0.0000, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z, cTolerance); - Assert.AreEqual(100.000, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X, cTolerance); - Assert.AreEqual(0.0000, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).Z, cTolerance); - } + X = 0, + Z = 0 + }; + var pointDikeTopAtRiver = new GeometryPoint + { + X = 1, + Z = 1 + }; + var pointTrafficLoadOutside = new GeometryPoint + { + X = 1.1, + Z = 1 + }; + var pointTrafficLoadInside = new GeometryPoint + { + X = 1.9, + Z = 1 + }; + var pointDikeTopAtPolder = new GeometryPoint + { + X = 2, + Z = 1 + }; + var pointDikeToeAtPolder = new GeometryPoint + { + X = 3, + Z = 0 + }; + surfaceLine.EnsurePointOfType(pointDikeToeAtRiver.X, pointDikeToeAtRiver.Z, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(pointDikeTopAtRiver.X, pointDikeTopAtRiver.Z, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(pointTrafficLoadOutside.X, pointTrafficLoadOutside.Z, CharacteristicPointType.TrafficLoadOutside); + surfaceLine.EnsurePointOfType(pointTrafficLoadInside.X, pointTrafficLoadInside.Z, CharacteristicPointType.TrafficLoadInside); + surfaceLine.EnsurePointOfType(pointDikeTopAtPolder.X, pointDikeTopAtPolder.Z, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(pointDikeToeAtPolder.X, pointDikeToeAtPolder.Z, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + Assert.AreEqual(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadOutside).Z); + Assert.AreEqual(newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadInside).Z); + } - [Test] - public void AdaptedSurfaceLineWithNewDefinedTopExactOnOldTop() + /// + /// Test if dike with skewed dike table and points between characteristic points is constructed correctly with new height + /// + [Test] + public void CanAdaptSurfaceLineWithSkewedDikeTableAndInBetweenPoints() + { + SurfaceLine2 surfaceLine = CreateSurfaceLineWithSkwewedDikeTableAndInBetweenPoints(); + var location = new Location(); + const double cTolerance = 0.001; + const double newDikeHeight = 4.0; + Assert.AreEqual(10, surfaceLine.Geometry.Points.Count); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + Assert.AreEqual(6, newSurfaceLine.Geometry.Points.Count); + Assert.AreEqual(7.3333, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).X, cTolerance); + Assert.AreEqual(4.0000, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Z, cTolerance); + Assert.AreEqual(9.3333, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X, cTolerance); + Assert.AreEqual(4.0000, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z, cTolerance); + Assert.AreEqual(14.6666, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).X, cTolerance); + Assert.AreEqual(0.0000, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z, cTolerance); + Assert.AreEqual(100.000, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X, cTolerance); + Assert.AreEqual(0.0000, newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).Z, cTolerance); + } + + [Test] + public void AdaptedSurfaceLineWithNewDefinedTopExactOnOldTop() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); - location.UseNewDikeTopWidth = true; - location.NewDikeTopWidth = 1; - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - var expectedNewTopRiver = new GeometryPoint - { - X = 2, - Z = 2 - }; - GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); - var expectedNewTopPolder = new GeometryPoint - { - X = 3, - Z = 2 - }; - GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); - var expectedShoulderBaseInside = new GeometryPoint - { - X = 5, - Z = 0 - }; - GeometryPoint actualShoulderBaseInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); - Assert.IsTrue(expectedShoulderBaseInside.LocationEquals(actualShoulderBaseInside)); - Assert.AreEqual(9, newSurfaceLine.Geometry.Points.Count); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); + location.UseNewDikeTopWidth = true; + location.NewDikeTopWidth = 1; + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + var expectedNewTopRiver = new GeometryPoint + { + X = 2, + Z = 2 + }; + GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); + var expectedNewTopPolder = new GeometryPoint + { + X = 3, + Z = 2 + }; + GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); + var expectedShoulderBaseInside = new GeometryPoint + { + X = 5, + Z = 0 + }; + GeometryPoint actualShoulderBaseInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); + Assert.IsTrue(expectedShoulderBaseInside.LocationEquals(actualShoulderBaseInside)); + Assert.AreEqual(9, newSurfaceLine.Geometry.Points.Count); + } - [Test] - public void AdaptedSurfaceLineWithNewDefinedTopSmallerThanOldTop() + [Test] + public void AdaptedSurfaceLineWithNewDefinedTopSmallerThanOldTop() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); - location.UseNewDikeTopWidth = true; - location.NewDikeTopWidth = 0.8; - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - var expectedNewTopRiver = new GeometryPoint - { - X = 2, - Z = 2 - }; - GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); - var expectedNewTopPolder = new GeometryPoint - { - X = 2.8, - Z = 2 - }; - GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); - var expectedNewPoint = new GeometryPoint - { - X = 3.8, - Z = 1 - }; - GeometryPoint actualNewPoint = newSurfaceLine.Geometry.Points[4]; - Assert.IsTrue(expectedNewPoint.LocationEquals(actualNewPoint)); - var expectedShoulderBaseInside = new GeometryPoint - { - X = 5, - Z = 0 - }; - GeometryPoint actualShoulderBaseInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); - Assert.IsTrue(expectedShoulderBaseInside.LocationEquals(actualShoulderBaseInside)); - Assert.AreEqual(10, newSurfaceLine.Geometry.Points.Count); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, 0, CharacteristicPointType.SurfaceLevelInside); + location.UseNewDikeTopWidth = true; + location.NewDikeTopWidth = 0.8; + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + var expectedNewTopRiver = new GeometryPoint + { + X = 2, + Z = 2 + }; + GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); + var expectedNewTopPolder = new GeometryPoint + { + X = 2.8, + Z = 2 + }; + GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); + var expectedNewPoint = new GeometryPoint + { + X = 3.8, + Z = 1 + }; + GeometryPoint actualNewPoint = newSurfaceLine.Geometry.Points[4]; + Assert.IsTrue(expectedNewPoint.LocationEquals(actualNewPoint)); + var expectedShoulderBaseInside = new GeometryPoint + { + X = 5, + Z = 0 + }; + GeometryPoint actualShoulderBaseInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); + Assert.IsTrue(expectedShoulderBaseInside.LocationEquals(actualShoulderBaseInside)); + Assert.AreEqual(10, newSurfaceLine.Geometry.Points.Count); + } - [Test] - public void AdaptedSurfaceLineWithNewDefinedTopWiderThanOldTopBeyondShoulder() + [Test] + public void AdaptedSurfaceLineWithNewDefinedTopWiderThanOldTopBeyondShoulder() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); - location.UseNewDikeTopWidth = true; - location.NewDikeTopWidth = 3; - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - var expectedNewTopRiver = new GeometryPoint - { - X = 2, - Z = 2 - }; - GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); - var expectedNewTopPolder = new GeometryPoint - { - X = 5, - Z = 2 - }; - GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); - var expectedToeInside = new GeometryPoint - { - X = 8, - Z = -1 - }; - GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); - Assert.AreEqual(5, newSurfaceLine.Geometry.Points.Count); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); + location.UseNewDikeTopWidth = true; + location.NewDikeTopWidth = 3; + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + var expectedNewTopRiver = new GeometryPoint + { + X = 2, + Z = 2 + }; + GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); + var expectedNewTopPolder = new GeometryPoint + { + X = 5, + Z = 2 + }; + GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); + var expectedToeInside = new GeometryPoint + { + X = 8, + Z = -1 + }; + GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); + Assert.AreEqual(5, newSurfaceLine.Geometry.Points.Count); + } - [Test] - public void AdaptedSurfaceLineWithNewDefinedTopWiderThanOldTopOnShoulderTopInside() + [Test] + public void AdaptedSurfaceLineWithNewDefinedTopWiderThanOldTopOnShoulderTopInside() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); - location.UseNewDikeTopWidth = true; - location.NewDikeTopWidth = 2; - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - var expectedNewTopRiver = new GeometryPoint - { - X = 2, - Z = 2 - }; - GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); - var expectedNewTopPolder = new GeometryPoint - { - X = 4, - Z = 2 - }; - GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); - var expectedToeInside = new GeometryPoint - { - X = 7, - Z = -1 - }; - GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); - Assert.AreEqual(6, newSurfaceLine.Geometry.Points.Count); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); + location.UseNewDikeTopWidth = true; + location.NewDikeTopWidth = 2; + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + var expectedNewTopRiver = new GeometryPoint + { + X = 2, + Z = 2 + }; + GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); + var expectedNewTopPolder = new GeometryPoint + { + X = 4, + Z = 2 + }; + GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); + var expectedToeInside = new GeometryPoint + { + X = 7, + Z = -1 + }; + GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); + Assert.AreEqual(6, newSurfaceLine.Geometry.Points.Count); + } - [Test] - public void AdaptedSurfaceLineWithNewDefinedTopWiderThanOldTopIntersectingShoulder() + [Test] + public void AdaptedSurfaceLineWithNewDefinedTopWiderThanOldTopIntersectingShoulder() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); - location.UseNewDikeTopWidth = true; - location.NewDikeTopWidth = 1.5; - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - var expectedNewTopRiver = new GeometryPoint - { - X = 2, - Z = 2 - }; - GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); - var expectedNewTopPolder = new GeometryPoint - { - X = 3.5, - Z = 2 - }; - GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); - var expectedShoulderBaseInside = new GeometryPoint - { - X = 5.5, - Z = 0 - }; - GeometryPoint actualShoulderBaseInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); - Assert.IsTrue(expectedShoulderBaseInside.LocationEquals(actualShoulderBaseInside)); - var expectedShoulderTopInside = new GeometryPoint - { - X = 6, - Z = 0 - }; - GeometryPoint actualShoulderTopInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); - Assert.IsTrue(expectedShoulderTopInside.LocationEquals(actualShoulderTopInside)); - var expectedToeInside = new GeometryPoint - { - X = 7, - Z = -1 - }; - GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); - Assert.AreEqual(7, newSurfaceLine.Geometry.Points.Count); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); + location.UseNewDikeTopWidth = true; + location.NewDikeTopWidth = 1.5; + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + var expectedNewTopRiver = new GeometryPoint + { + X = 2, + Z = 2 + }; + GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); + var expectedNewTopPolder = new GeometryPoint + { + X = 3.5, + Z = 2 + }; + GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); + var expectedShoulderBaseInside = new GeometryPoint + { + X = 5.5, + Z = 0 + }; + GeometryPoint actualShoulderBaseInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); + Assert.IsTrue(expectedShoulderBaseInside.LocationEquals(actualShoulderBaseInside)); + var expectedShoulderTopInside = new GeometryPoint + { + X = 6, + Z = 0 + }; + GeometryPoint actualShoulderTopInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); + Assert.IsTrue(expectedShoulderTopInside.LocationEquals(actualShoulderTopInside)); + var expectedToeInside = new GeometryPoint + { + X = 7, + Z = -1 + }; + GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); + Assert.AreEqual(7, newSurfaceLine.Geometry.Points.Count); + } - [Test] - public void AdaptedSurfaceLineWithNewDefinedInsideSlope() + [Test] + public void AdaptedSurfaceLineWithNewDefinedInsideSlope() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); - location.UseNewDikeSlopeInside = true; - location.NewDikeSlopeInside = 0.5; - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - var expectedNewTopRiver = new GeometryPoint - { - X = 2, - Z = 2 - }; - GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); - var expectedNewTopPolder = new GeometryPoint - { - X = 5, - Z = 2 - }; - GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); - var expectedToeInside = new GeometryPoint - { - X = 11, - Z = -1 - }; - GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); - Assert.AreEqual(5, newSurfaceLine.Geometry.Points.Count); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); + location.UseNewDikeSlopeInside = true; + location.NewDikeSlopeInside = 0.5; + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + var expectedNewTopRiver = new GeometryPoint + { + X = 2, + Z = 2 + }; + GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); + var expectedNewTopPolder = new GeometryPoint + { + X = 5, + Z = 2 + }; + GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); + var expectedToeInside = new GeometryPoint + { + X = 11, + Z = -1 + }; + GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); + Assert.AreEqual(5, newSurfaceLine.Geometry.Points.Count); + } - [Test] - public void AdaptedSurfaceLineWithNewDefinedInsideSlopeEndingOnOldShoulderTop() + [Test] + public void AdaptedSurfaceLineWithNewDefinedInsideSlopeEndingOnOldShoulderTop() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); - location.UseNewDikeSlopeInside = true; - location.NewDikeSlopeInside = 2; - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - var expectedNewTopRiver = new GeometryPoint - { - X = 2, - Z = 2 - }; - GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); - var expectedNewTopPolder = new GeometryPoint - { - X = 5, - Z = 2 - }; - GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); - var expectedPoint = new GeometryPoint - { - X = 6, - Z = 0 - }; - GeometryPoint actualPoint = newSurfaceLine.Geometry.Points[3]; - Assert.IsTrue(expectedPoint.LocationEquals(actualPoint)); - var expectedToeInside = new GeometryPoint - { - X = 7, - Z = -1 - }; - GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); - Assert.AreEqual(6, newSurfaceLine.Geometry.Points.Count); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); + location.UseNewDikeSlopeInside = true; + location.NewDikeSlopeInside = 2; + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + var expectedNewTopRiver = new GeometryPoint + { + X = 2, + Z = 2 + }; + GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); + var expectedNewTopPolder = new GeometryPoint + { + X = 5, + Z = 2 + }; + GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); + var expectedPoint = new GeometryPoint + { + X = 6, + Z = 0 + }; + GeometryPoint actualPoint = newSurfaceLine.Geometry.Points[3]; + Assert.IsTrue(expectedPoint.LocationEquals(actualPoint)); + var expectedToeInside = new GeometryPoint + { + X = 7, + Z = -1 + }; + GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); + Assert.AreEqual(6, newSurfaceLine.Geometry.Points.Count); + } - [Test] - public void AdaptedSurfaceLineWithNewDefinedOutsideSlope2() + [Test] + public void AdaptedSurfaceLineWithNewDefinedOutsideSlope2() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); - location.UseNewDikeSlopeOutside = true; - location.NewDikeSlopeOutside = 2; - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - var expectedNewTopRiver = new GeometryPoint - { - X = 1.5, - Z = 2 - }; - GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); - var expectedNewTopPolder = new GeometryPoint - { - X = 4.5, - Z = 2 - }; - GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); - var expectedToeInside = new GeometryPoint - { - X = 7.5, - Z = -1 - }; - GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); - Assert.AreEqual(6, newSurfaceLine.Geometry.Points.Count); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); + location.UseNewDikeSlopeOutside = true; + location.NewDikeSlopeOutside = 2; + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + var expectedNewTopRiver = new GeometryPoint + { + X = 1.5, + Z = 2 + }; + GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); + var expectedNewTopPolder = new GeometryPoint + { + X = 4.5, + Z = 2 + }; + GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); + var expectedToeInside = new GeometryPoint + { + X = 7.5, + Z = -1 + }; + GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); + Assert.AreEqual(6, newSurfaceLine.Geometry.Points.Count); + } - [Test] - public void AdaptedSurfaceLineWithNewDefinedOutsideSlope05() + [Test] + public void AdaptedSurfaceLineWithNewDefinedOutsideSlope05() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); - location.UseNewDikeSlopeOutside = true; - location.NewDikeSlopeOutside = 0.5; - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - var expectedNewTopRiver = new GeometryPoint - { - X = 3, - Z = 2 - }; - GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); - var expectedNewTopPolder = new GeometryPoint - { - X = 6, - Z = 2 - }; - GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); - var expectedToeInside = new GeometryPoint - { - X = 9, - Z = -1 - }; - GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); - Assert.AreEqual(6, newSurfaceLine.Geometry.Points.Count); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); + location.UseNewDikeSlopeOutside = true; + location.NewDikeSlopeOutside = 0.5; + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + var expectedNewTopRiver = new GeometryPoint + { + X = 3, + Z = 2 + }; + GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); + var expectedNewTopPolder = new GeometryPoint + { + X = 6, + Z = 2 + }; + GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); + var expectedToeInside = new GeometryPoint + { + X = 9, + Z = -1 + }; + GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); + Assert.AreEqual(6, newSurfaceLine.Geometry.Points.Count); + } - [Test] - public void AdaptedSurfaceLineWithNewDefinedTopWidthAndOutsideSlopeAndInsideSlope2() + [Test] + public void AdaptedSurfaceLineWithNewDefinedTopWidthAndOutsideSlopeAndInsideSlope2() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); - location.UseNewDikeSlopeOutside = true; - location.NewDikeSlopeOutside = 2; - location.UseNewDikeSlopeInside = true; - location.NewDikeSlopeInside = 2; - location.UseNewDikeTopWidth = true; - location.NewDikeTopWidth = 1.5; - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - var expectedNewTopRiver = new GeometryPoint - { - X = 1.5, - Z = 2 - }; - GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); - var expectedNewTopPolder = new GeometryPoint - { - X = 3, - Z = 2 - }; - GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); - var expectedPoint = new GeometryPoint - { - X = 3.5, - Z = 1 - }; - GeometryPoint actualPoint = newSurfaceLine.Geometry.Points[4]; - Assert.IsTrue(expectedPoint.LocationEquals(actualPoint)); - var expectedPoint2 = new GeometryPoint - { - X = 4, - Z = 1 - }; - GeometryPoint actualPoint2 = newSurfaceLine.Geometry.Points[5]; - Assert.IsTrue(expectedPoint2.LocationEquals(actualPoint2)); - var expectedShoulderBaseInside = new GeometryPoint - { - X = 5, - Z = 0 - }; - GeometryPoint actualShoulderBaseInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); - Assert.IsTrue(expectedShoulderBaseInside.LocationEquals(actualShoulderBaseInside)); - var expectedToeInside = new GeometryPoint - { - X = 7, - Z = -1 - }; - GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); - Assert.AreEqual(10, newSurfaceLine.Geometry.Points.Count); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); + location.UseNewDikeSlopeOutside = true; + location.NewDikeSlopeOutside = 2; + location.UseNewDikeSlopeInside = true; + location.NewDikeSlopeInside = 2; + location.UseNewDikeTopWidth = true; + location.NewDikeTopWidth = 1.5; + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + var expectedNewTopRiver = new GeometryPoint + { + X = 1.5, + Z = 2 + }; + GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); + var expectedNewTopPolder = new GeometryPoint + { + X = 3, + Z = 2 + }; + GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); + var expectedPoint = new GeometryPoint + { + X = 3.5, + Z = 1 + }; + GeometryPoint actualPoint = newSurfaceLine.Geometry.Points[4]; + Assert.IsTrue(expectedPoint.LocationEquals(actualPoint)); + var expectedPoint2 = new GeometryPoint + { + X = 4, + Z = 1 + }; + GeometryPoint actualPoint2 = newSurfaceLine.Geometry.Points[5]; + Assert.IsTrue(expectedPoint2.LocationEquals(actualPoint2)); + var expectedShoulderBaseInside = new GeometryPoint + { + X = 5, + Z = 0 + }; + GeometryPoint actualShoulderBaseInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderBaseInside); + Assert.IsTrue(expectedShoulderBaseInside.LocationEquals(actualShoulderBaseInside)); + var expectedToeInside = new GeometryPoint + { + X = 7, + Z = -1 + }; + GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); + Assert.AreEqual(10, newSurfaceLine.Geometry.Points.Count); + } - [Test] - public void AdaptedSurfaceLineWithNewDefinedTopWidthAndOutsideSlopeAndInsideSlope05() + [Test] + public void AdaptedSurfaceLineWithNewDefinedTopWidthAndOutsideSlopeAndInsideSlope05() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var location = new Location(); - const double newDikeHeight = 2.0; - surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); - surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); - surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); - location.UseNewDikeSlopeOutside = true; - location.NewDikeSlopeOutside = 2; - location.UseNewDikeSlopeInside = true; - location.NewDikeSlopeInside = 0.5; - location.UseNewDikeTopWidth = true; - location.NewDikeTopWidth = 1.5; - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); - var expectedNewTopRiver = new GeometryPoint - { - X = 1.5, - Z = 2 - }; - GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); - Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); - var expectedNewTopPolder = new GeometryPoint - { - X = 3, - Z = 2 - }; - GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); - var expectedToeInside = new GeometryPoint - { - X = 9, - Z = -1 - }; - GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); - Assert.AreEqual(6, newSurfaceLine.Geometry.Points.Count); - } + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var location = new Location(); + const double newDikeHeight = 2.0; + surfaceLine.EnsurePointOfType(0, 0, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(1, 1, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(4, 1, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(5, 0, CharacteristicPointType.ShoulderBaseInside); + surfaceLine.EnsurePointOfType(6, 0, CharacteristicPointType.ShoulderTopInside); + surfaceLine.EnsurePointOfType(7, -1, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(100, -1, CharacteristicPointType.SurfaceLevelInside); + location.UseNewDikeSlopeOutside = true; + location.NewDikeSlopeOutside = 2; + location.UseNewDikeSlopeInside = true; + location.NewDikeSlopeInside = 0.5; + location.UseNewDikeTopWidth = true; + location.NewDikeTopWidth = 1.5; + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + SurfaceLine2 newSurfaceLine = surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight); + var expectedNewTopRiver = new GeometryPoint + { + X = 1.5, + Z = 2 + }; + GeometryPoint actualNewTopRiver = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver); + Assert.IsTrue(expectedNewTopRiver.LocationEquals(actualNewTopRiver)); + var expectedNewTopPolder = new GeometryPoint + { + X = 3, + Z = 2 + }; + GeometryPoint actualNewTopPolder = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + Assert.IsTrue(expectedNewTopPolder.LocationEquals(actualNewTopPolder)); + var expectedToeInside = new GeometryPoint + { + X = 9, + Z = -1 + }; + GeometryPoint actualToeInside = newSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + Assert.IsTrue(expectedToeInside.LocationEquals(actualToeInside)); + Assert.AreEqual(6, newSurfaceLine.Geometry.Points.Count); + } - [Test] - public void HeightAdaptionThrowsExceptionIfSurfaceLineIsNotLongEnough() + [Test] + public void HeightAdaptionThrowsExceptionIfSurfaceLineIsNotLongEnough() + { + SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateRealisticSurfaceLineForHeightAdapter(); + var location = new Location(); + const double newDikeHeight = 19.0; + var pointSurfaceLevelInside = new GeometryPoint { - SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateRealisticSurfaceLineForHeightAdapter(); - var location = new Location(); - const double newDikeHeight = 19.0; - var pointSurfaceLevelInside = new GeometryPoint - { - X = 40, - Z = 12 - }; // Set surfacelevelinside just beside ditch to force exception - surfaceLine.EnsurePointOfType(pointSurfaceLevelInside.X, pointSurfaceLevelInside.Z, CharacteristicPointType.SurfaceLevelInside); - var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); - Assert.That(() => surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight), Throws.InstanceOf()); - } + X = 40, + Z = 12 + }; // Set surfacelevelinside just beside ditch to force exception + surfaceLine.EnsurePointOfType(pointSurfaceLevelInside.X, pointSurfaceLevelInside.Z, CharacteristicPointType.SurfaceLevelInside); + var surfaceLineAdapter = new SurfaceLineHeightAdapter(surfaceLine, location, 0); + Assert.That(() => surfaceLineAdapter.ConstructNewSurfaceLine(newDikeHeight), Throws.InstanceOf()); + } - /// - /// Create dike with skewed dike table and points between characteristic points - /// - /// - private SurfaceLine2 CreateSurfaceLineWithSkwewedDikeTableAndInBetweenPoints() + /// + /// Create dike with skewed dike table and points between characteristic points + /// + /// + private SurfaceLine2 CreateSurfaceLineWithSkwewedDikeTableAndInBetweenPoints() + { + var surfaceLine = new SurfaceLine2 { - var surfaceLine = new SurfaceLine2 + CharacteristicPoints = { - CharacteristicPoints = - { - GeometryMustContainPoint = true - }, - Geometry = new GeometryPointString() - }; - var point1 = new GeometryPoint - { - X = 0, - Z = 0 - }; - var pointDikeToeAtRiver = new GeometryPoint - { - X = 2, - Z = 0 - }; - var point2 = new GeometryPoint - { - X = 4, - Z = 1 - }; - var pointDikeTopAtRiver = new GeometryPoint - { - X = 6, - Z = 3 - }; - var point3 = new GeometryPoint - { - X = 7, - Z = 3 - }; - var pointDikeTopAtPolder = new GeometryPoint - { - X = 8, - Z = 3.5 - }; - var point4 = new GeometryPoint - { - X = 10, - Z = 1.5 - }; - var pointDikeToeAtPolder = new GeometryPoint - { - X = 12, - Z = 0.5 - }; - var point5 = new GeometryPoint - { - X = 13, - Z = 0 - }; - var pointSurfaceLevelInside = new GeometryPoint - { - X = 100, - Z = 0 - }; + GeometryMustContainPoint = true + }, + Geometry = new GeometryPointString() + }; + var point1 = new GeometryPoint + { + X = 0, + Z = 0 + }; + var pointDikeToeAtRiver = new GeometryPoint + { + X = 2, + Z = 0 + }; + var point2 = new GeometryPoint + { + X = 4, + Z = 1 + }; + var pointDikeTopAtRiver = new GeometryPoint + { + X = 6, + Z = 3 + }; + var point3 = new GeometryPoint + { + X = 7, + Z = 3 + }; + var pointDikeTopAtPolder = new GeometryPoint + { + X = 8, + Z = 3.5 + }; + var point4 = new GeometryPoint + { + X = 10, + Z = 1.5 + }; + var pointDikeToeAtPolder = new GeometryPoint + { + X = 12, + Z = 0.5 + }; + var point5 = new GeometryPoint + { + X = 13, + Z = 0 + }; + var pointSurfaceLevelInside = new GeometryPoint + { + X = 100, + Z = 0 + }; - surfaceLine.EnsurePointOfType(pointDikeToeAtRiver.X, pointDikeToeAtRiver.Z, CharacteristicPointType.DikeToeAtRiver); - surfaceLine.EnsurePointOfType(pointDikeTopAtRiver.X, pointDikeTopAtRiver.Z, CharacteristicPointType.DikeTopAtRiver); - surfaceLine.EnsurePointOfType(pointDikeTopAtPolder.X, pointDikeTopAtPolder.Z, CharacteristicPointType.DikeTopAtPolder); - surfaceLine.EnsurePointOfType(pointDikeToeAtPolder.X, pointDikeToeAtPolder.Z, CharacteristicPointType.DikeToeAtPolder); - surfaceLine.EnsurePointOfType(pointSurfaceLevelInside.X, pointSurfaceLevelInside.Z, CharacteristicPointType.SurfaceLevelInside); - surfaceLine.EnsurePoint(point1.X, point1.Z); - surfaceLine.EnsurePoint(point2.X, point2.Z); - surfaceLine.EnsurePoint(point3.X, point3.Z); - surfaceLine.EnsurePoint(point4.X, point4.Z); - surfaceLine.EnsurePoint(point5.X, point5.Z); - surfaceLine.SortPoints(); - return surfaceLine; - } + surfaceLine.EnsurePointOfType(pointDikeToeAtRiver.X, pointDikeToeAtRiver.Z, CharacteristicPointType.DikeToeAtRiver); + surfaceLine.EnsurePointOfType(pointDikeTopAtRiver.X, pointDikeTopAtRiver.Z, CharacteristicPointType.DikeTopAtRiver); + surfaceLine.EnsurePointOfType(pointDikeTopAtPolder.X, pointDikeTopAtPolder.Z, CharacteristicPointType.DikeTopAtPolder); + surfaceLine.EnsurePointOfType(pointDikeToeAtPolder.X, pointDikeToeAtPolder.Z, CharacteristicPointType.DikeToeAtPolder); + surfaceLine.EnsurePointOfType(pointSurfaceLevelInside.X, pointSurfaceLevelInside.Z, CharacteristicPointType.SurfaceLevelInside); + surfaceLine.EnsurePoint(point1.X, point1.Z); + surfaceLine.EnsurePoint(point2.X, point2.Z); + surfaceLine.EnsurePoint(point3.X, point3.Z); + surfaceLine.EnsurePoint(point4.X, point4.Z); + surfaceLine.EnsurePoint(point5.X, point5.Z); + surfaceLine.SortPoints(); + return surfaceLine; + } - /// - /// Determines the tan slope inside. - /// - /// tan slope inside - private static double TanSlopeInside(SurfaceLine2 line) - { - GeometryPoint dikeToeInward = line.GetDikeToeInward(); - GeometryPoint dikeTopAtPolder = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); - return (dikeTopAtPolder.Z - dikeToeInward.Z) / - (dikeToeInward.X - dikeTopAtPolder.X); - } + /// + /// Determines the tan slope inside. + /// + /// tan slope inside + private static double TanSlopeInside(SurfaceLine2 line) + { + GeometryPoint dikeToeInward = line.GetDikeToeInward(); + GeometryPoint dikeTopAtPolder = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder); + return (dikeTopAtPolder.Z - dikeToeInward.Z) / + (dikeToeInward.X - dikeTopAtPolder.X); } } \ No newline at end of file