Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs
===================================================================
diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -272,6 +272,123 @@
}
///
+ /// Looks up a localized string similar to Slootbodem dijkzijde.
+ ///
+ public static string CharacteristicPoint_BottomDitchDikeSide {
+ get {
+ return ResourceManager.GetString("CharacteristicPoint_BottomDitchDikeSide", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Slootbodem polderzijde.
+ ///
+ public static string CharacteristicPoint_BottomDitchPolderSide {
+ get {
+ return ResourceManager.GetString("CharacteristicPoint_BottomDitchPolderSide", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Teen dijk binnenwaarts.
+ ///
+ public static string CharacteristicPoint_DikeToeAtPolder {
+ get {
+ return ResourceManager.GetString("CharacteristicPoint_DikeToeAtPolder", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Teen dijk buitenwaarts.
+ ///
+ public static string CharacteristicPoint_DikeToeAtRiver {
+ get {
+ return ResourceManager.GetString("CharacteristicPoint_DikeToeAtRiver", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Kruin binnentalud.
+ ///
+ public static string CharacteristicPoint_DikeTopAtPolder {
+ get {
+ return ResourceManager.GetString("CharacteristicPoint_DikeTopAtPolder", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Insteek sloot dijkzijde.
+ ///
+ public static string CharacteristicPoint_DitchDikeSide {
+ get {
+ return ResourceManager.GetString("CharacteristicPoint_DitchDikeSide", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Insteek sloot polderzijde.
+ ///
+ public static string CharacteristicPoint_DitchPolderSide {
+ get {
+ return ResourceManager.GetString("CharacteristicPoint_DitchPolderSide", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Insteek binnenberm.
+ ///
+ public static string CharacteristicPoint_ShoulderBaseInside {
+ get {
+ return ResourceManager.GetString("CharacteristicPoint_ShoulderBaseInside", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Kruin binnenberm.
+ ///
+ public static string CharacteristicPoint_ShoulderTopInside {
+ get {
+ return ResourceManager.GetString("CharacteristicPoint_ShoulderTopInside", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Maaiveld binnenwaarts.
+ ///
+ public static string CharacteristicPoint_SurfaceLevelInside {
+ get {
+ return ResourceManager.GetString("CharacteristicPoint_SurfaceLevelInside", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Maaiveld buitenwaarts.
+ ///
+ public static string CharacteristicPoint_SurfaceLevelOutside {
+ get {
+ return ResourceManager.GetString("CharacteristicPoint_SurfaceLevelOutside", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Verkeersbelasting kant binnenwaarts.
+ ///
+ public static string CharacteristicPoint_TrafficLoadInside {
+ get {
+ return ResourceManager.GetString("CharacteristicPoint_TrafficLoadInside", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Verkeersbelasting kant buitenwaarts.
+ ///
+ public static string CharacteristicPoint_TrafficLoadOutside {
+ get {
+ return ResourceManager.GetString("CharacteristicPoint_TrafficLoadOutside", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Variatiecoëfficiënt (CV) moet groter zijn dan of gelijk zijn aan 0..
///
public static string CoefficientOfVariation_Should_be_greater_or_equal_to_zero {
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx
===================================================================
diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -309,4 +309,43 @@
Profielschematisaties
+
+ Insteek sloot dijkzijde
+
+
+ Insteek sloot polderzijde
+
+
+ Slootbodem dijkzijde
+
+
+ Slootbodem polderzijde
+
+
+ Teen dijk binnenwaarts
+
+
+ Teen dijk buitenwaarts
+
+
+ Kruin binnentalud
+
+
+ Insteek binnenberm
+
+
+ Kruin binnenberm
+
+
+ Verkeersbelasting kant binnenwaarts
+
+
+ Verkeersbelasting kant buitenwaarts
+
+
+ Maaiveld binnenwaarts
+
+
+ Maaiveld buitenwaarts
+
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/CharacteristicPoints.cs
===================================================================
diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/CharacteristicPoints.cs (.../CharacteristicPoints.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/CharacteristicPoints.cs (.../CharacteristicPoints.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -91,13 +91,13 @@
/// declines towards the location of the dike toe when approaching from inside
/// the polder.
///
- public Point3D TopShoulderInside { get; set; }
+ public Point3D ShoulderTopInside { get; set; }
///
/// Gets or sets the location where the shoulder on the side of the polder
/// connects with the dike.
///
- public Point3D ShoulderInside { get; set; }
+ public Point3D ShoulderBaseInside { get; set; }
///
/// Gets or sets the location of the top of the dike when approaching from
@@ -127,14 +127,14 @@
/// Gets or sets the location where the shoulder on the outside of the polder
/// connects with the dike.
///
- public Point3D ShoulderOutisde { get; set; }
+ public Point3D ShoulderBaseOutside { get; set; }
///
/// Gets or sets the location where the shoulder on the outside of the polder
/// declines towards the location of the dike toe when approaching from outside
/// the polder.
///
- public Point3D TopShoulderOutside { get; set; }
+ public Point3D ShoulderTopOutside { get; set; }
///
/// Gets or sets the location of dike toe when approaching from outside
Index: Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/CharacteristicPointsCsvReader.cs
===================================================================
diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/CharacteristicPointsCsvReader.cs (.../CharacteristicPointsCsvReader.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/SurfaceLines/CharacteristicPointsCsvReader.cs (.../CharacteristicPointsCsvReader.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -379,14 +379,14 @@
location.BottomDitchDikeSide = GetPoint3D(tokenizedString, bottomDitchDikeSideKey, location.Name);
location.DitchDikeSide = GetPoint3D(tokenizedString, ditchDikeSideKey, location.Name);
location.DikeToeAtPolder = GetPoint3D(tokenizedString, dikeToeAtPolderKey, location.Name);
- location.TopShoulderInside = GetPoint3D(tokenizedString, topShoulderInsideKey, location.Name);
- location.ShoulderInside = GetPoint3D(tokenizedString, shoulderInsideKey, location.Name);
+ location.ShoulderTopInside = GetPoint3D(tokenizedString, topShoulderInsideKey, location.Name);
+ location.ShoulderBaseInside = GetPoint3D(tokenizedString, shoulderInsideKey, location.Name);
location.DikeTopAtPolder = GetPoint3D(tokenizedString, dikeTopAtPolderKey, location.Name);
location.TrafficLoadInside = GetPoint3D(tokenizedString, trafficLoadInsideKey, location.Name);
location.TrafficLoadOutside = GetPoint3D(tokenizedString, trafficLoadOutsideKey, location.Name);
location.DikeTopAtRiver = GetPoint3D(tokenizedString, dikeTopAtRiverKey, location.Name);
- location.ShoulderOutisde = GetPoint3D(tokenizedString, shoulderOutsideKey, location.Name);
- location.TopShoulderOutside = GetPoint3D(tokenizedString, topShoulderOutsideKey, location.Name);
+ location.ShoulderBaseOutside = GetPoint3D(tokenizedString, shoulderOutsideKey, location.Name);
+ location.ShoulderTopOutside = GetPoint3D(tokenizedString, topShoulderOutsideKey, location.Name);
location.DikeToeAtRiver = GetPoint3D(tokenizedString, dikeToeAtRiverKey, location.Name);
location.SurfaceLevelOutside = GetPoint3D(tokenizedString, surfaceLevelOutsideKey, location.Name);
location.DikeTableHeight = GetPoint3D(tokenizedString, dikeTableHeightKey, location.Name);
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SurfaceLines/CharacteristicPointsCsvReaderTest.cs
===================================================================
diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SurfaceLines/CharacteristicPointsCsvReaderTest.cs (.../CharacteristicPointsCsvReaderTest.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SurfaceLines/CharacteristicPointsCsvReaderTest.cs (.../CharacteristicPointsCsvReaderTest.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -673,9 +673,9 @@
Assert.AreEqual(new Point3D(55.37, 0, -0.31), location1.DikeToeAtPolder);
- Assert.IsNull(location1.TopShoulderInside);
+ Assert.IsNull(location1.ShoulderTopInside);
- Assert.IsNull(location1.ShoulderInside);
+ Assert.IsNull(location1.ShoulderBaseInside);
Assert.AreEqual(new Point3D(40.17, 0, 2.63), location1.DikeTopAtPolder);
@@ -685,9 +685,9 @@
Assert.AreEqual(new Point3D(35.95, 0, 2.61), location1.DikeTopAtRiver);
- Assert.IsNull(location1.ShoulderOutisde);
+ Assert.IsNull(location1.ShoulderBaseOutside);
- Assert.IsNull(location1.TopShoulderOutside);
+ Assert.IsNull(location1.ShoulderTopOutside);
Assert.AreEqual(new Point3D(29.1, 0, -0.2), location1.DikeToeAtRiver);
@@ -716,9 +716,9 @@
Assert.AreEqual(new Point3D(53.48, 0, -0.49), location2.DikeToeAtPolder);
- Assert.IsNull(location2.TopShoulderInside);
+ Assert.IsNull(location2.ShoulderTopInside);
- Assert.IsNull(location2.ShoulderInside);
+ Assert.IsNull(location2.ShoulderBaseInside);
Assert.AreEqual(new Point3D(38.17, 0, 3.04), location2.DikeTopAtPolder);
@@ -728,9 +728,9 @@
Assert.AreEqual(new Point3D(32.77, 0, 3.11), location2.DikeTopAtRiver);
- Assert.IsNull(location2.ShoulderOutisde);
+ Assert.IsNull(location2.ShoulderBaseOutside);
- Assert.IsNull(location2.TopShoulderOutside);
+ Assert.IsNull(location2.ShoulderTopOutside);
Assert.AreEqual(new Point3D(19.61, 0, -0.05), location2.DikeToeAtRiver);
Index: Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataImportHelper.cs
===================================================================
diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataImportHelper.cs (.../DataImportHelper.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381)
+++ Ringtoets/Integration/test/Ringtoets.Integration.TestUtils/DataImportHelper.cs (.../DataImportHelper.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -243,7 +243,8 @@
{
using (var embeddedResourceFileWriter = new EmbeddedResourceFileWriter(typeof(DataImportHelper).Assembly,
true,
- "DR6_surfacelines.csv"))
+ "DR6_surfacelines.csv",
+ "DR6_surfacelines.krp.csv"))
{
string filePath = Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "DR6_surfacelines.csv");
var activity = new FileImportActivity(new SurfaceLinesCsvImporter(
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Importers/MacroStabilityInwardsSurfaceLineTransformer.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Importers/MacroStabilityInwardsSurfaceLineTransformer.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Importers/MacroStabilityInwardsSurfaceLineTransformer.cs (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -0,0 +1,79 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using log4net;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.IO.SurfaceLines;
+using Ringtoets.MacroStabilityInwards.Primitives;
+
+using ReferenceLineIntersectionsResult = Ringtoets.Common.IO.SurfaceLines.SurfaceLineExtensions.ReferenceLineIntersectionsResult;
+using ReferenceLineIntersectionResult = Ringtoets.Common.IO.SurfaceLines.SurfaceLineExtensions.ReferenceLineIntersectionResult;
+
+namespace Ringtoets.MacroStabilityInwards.IO.Importers
+{
+ ///
+ /// Transforms generic into piping specific .
+ ///
+ public class MacroStabilityInwardsSurfaceLineTransformer : ISurfaceLineTransformer
+ {
+ private readonly ReferenceLine referenceLine;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The reference line to determine locations for the surface
+ /// lines for.
+ public MacroStabilityInwardsSurfaceLineTransformer(ReferenceLine referenceLine)
+ {
+ if (referenceLine == null)
+ {
+ throw new ArgumentNullException(nameof(referenceLine));
+ }
+ this.referenceLine = referenceLine;
+ }
+
+ public RingtoetsMacroStabilityInwardsSurfaceLine Transform(SurfaceLine surfaceLine, CharacteristicPoints characteristicPoints)
+ {
+ ReferenceLineIntersectionResult result = surfaceLine.CheckReferenceLineInterSections(referenceLine);
+
+ if (result.TypeOfIntersection != ReferenceLineIntersectionsResult.OneIntersection)
+ {
+ return null;
+ }
+
+ var macroStabilityInwardsSurfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = surfaceLine.Name
+ };
+ macroStabilityInwardsSurfaceLine.SetGeometry(surfaceLine.Points);
+
+ if (!macroStabilityInwardsSurfaceLine.SetCharacteristicPoints(characteristicPoints))
+ {
+ return null;
+ }
+
+ macroStabilityInwardsSurfaceLine.ReferenceLineIntersectionWorldPoint = result.IntersectionPoint;
+
+ return macroStabilityInwardsSurfaceLine;
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 5579d8fdef4f553fb4ba94160825ec960b89bab9 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Importers/MacrostabilityInwardsSurfaceLineTransformer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Importers/RingtoetsMacroStabilityInwardsSurfaceLineExtensions.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Importers/RingtoetsMacroStabilityInwardsSurfaceLineExtensions.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Importers/RingtoetsMacroStabilityInwardsSurfaceLineExtensions.cs (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -0,0 +1,432 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Core.Common.Base.Geometry;
+using log4net;
+using Ringtoets.Common.IO.Properties;
+using Ringtoets.Common.IO.SurfaceLines;
+using Ringtoets.MacroStabilityInwards.Primitives;
+
+namespace Ringtoets.MacroStabilityInwards.IO.Importers
+{
+ ///
+ /// Extension methods for the class.
+ ///
+ public static class RingtoetsMacroStabilityInwardsSurfaceLineExtensions
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(RingtoetsMacroStabilityInwardsSurfaceLineExtensions));
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// true if the was set, false if
+ /// is null or there is no point in at the location
+ /// of .
+ public static bool TrySetDitchPolderSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetDitchPolderSideAt(point);
+ return true;
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// true if the was set, false if
+ /// is null or there is no point in at the location
+ /// of .
+ public static bool TrySetBottomDitchPolderSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetBottomDitchPolderSideAt(point);
+ return true;
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// true if the was set, false if
+ /// is null or there is no point in at the location
+ /// of .
+ public static bool TrySetBottomDitchDikeSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetBottomDitchDikeSideAt(point);
+ return true;
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// true if the was set, false if
+ /// is null or there is no point in at the location
+ /// of .
+ public static bool TrySetDitchDikeSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetDitchDikeSideAt(point);
+ return true;
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// true if the was set, false if
+ /// is null or there is no point in at the location
+ /// of .
+ public static bool TrySetSurfaceLevelInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetSurfaceLevelInsideAt(point);
+ return true;
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// true if the was set, false if
+ /// is null or there is no point in at the location
+ /// of .
+ public static bool TrySetSurfaceLevelOutside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetSurfaceLevelOutsideAt(point);
+ return true;
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// true if the was set, false if
+ /// is null or there is no point in at the location
+ /// of .
+ public static bool TrySetDikeTopAtPolder(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetDikeTopAtPolderAt(point);
+ return true;
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// true if the was set, false if
+ /// is null or there is no point in at the location
+ /// of .
+ public static bool TrySetShoulderBaseInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetShoulderBaseInsideAt(point);
+ return true;
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// true if the was set, false if
+ /// is null or there is no point in at the location
+ /// of .
+ public static bool TrySetShoulderTopInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetShoulderTopInsideAt(point);
+ return true;
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// true if the was set, false if
+ /// is null or there is no point in at the location
+ /// of .
+ public static bool TrySetTrafficLoadInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetTrafficLoadInsideAt(point);
+ return true;
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// true if the was set, false if
+ /// is null or there is no point in at the location
+ /// of .
+ public static bool TrySetTrafficLoadOutside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetTrafficLoadOutsideAt(point);
+ return true;
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// true if the was set, false if
+ /// is null or there is no point in at the location
+ /// of .
+ public static bool TrySetDikeToeAtRiver(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetDikeToeAtRiverAt(point);
+ return true;
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Tries to set the at the location of
+ /// .
+ ///
+ /// The to set the
+ /// for.
+ /// The point at which to set the .
+ /// true if the was set, false if
+ /// is null or there is no point in at the location
+ /// of .
+ public static bool TrySetDikeToeAtPolder(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ if (point != null)
+ {
+ try
+ {
+ surfaceLine.SetDikeToeAtPolderAt(point);
+ return true;
+ }
+ catch (ArgumentException e)
+ {
+ LogError(surfaceLine, e);
+ }
+ }
+ return false;
+ }
+
+ ///
+ /// Tries to set the relevant characteristic points from the
+ /// on the .
+ ///
+ /// The surface line to set characteristic points for.
+ /// The characteristic points to set, if the collection is valid.
+ /// true if the characteristic points could be set; false otherwise.
+ /// Thrown when is null.
+ public static bool SetCharacteristicPoints(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, CharacteristicPoints characteristicPoints)
+ {
+ if (surfaceLine == null)
+ {
+ throw new ArgumentNullException(nameof(surfaceLine));
+ }
+ if (characteristicPoints == null)
+ {
+ return false;
+ }
+
+ surfaceLine.TrySetSurfaceLevelOutside(characteristicPoints.SurfaceLevelOutside);
+ surfaceLine.TrySetTrafficLoadOutside(characteristicPoints.TrafficLoadOutside);
+ surfaceLine.TrySetTrafficLoadInside(characteristicPoints.TrafficLoadInside);
+ surfaceLine.TrySetDikeTopAtPolder(characteristicPoints.DikeTopAtPolder);
+ surfaceLine.TrySetShoulderBaseInside(characteristicPoints.ShoulderBaseInside);
+ surfaceLine.TrySetShoulderTopInside(characteristicPoints.ShoulderTopInside);
+ surfaceLine.TrySetDikeToeAtRiver(characteristicPoints.DikeToeAtRiver);
+ surfaceLine.TrySetDitchDikeSide(characteristicPoints.DitchDikeSide);
+ surfaceLine.TrySetBottomDitchDikeSide(characteristicPoints.BottomDitchDikeSide);
+ surfaceLine.TrySetBottomDitchPolderSide(characteristicPoints.BottomDitchPolderSide);
+ surfaceLine.TrySetDitchPolderSide(characteristicPoints.DitchPolderSide);
+ surfaceLine.TrySetDikeToeAtPolder(characteristicPoints.DikeToeAtPolder);
+ surfaceLine.TrySetSurfaceLevelInside(characteristicPoints.SurfaceLevelInside);
+
+ return true;
+ }
+
+ private static void LogError(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, ArgumentException e)
+ {
+ log.ErrorFormat(Resources.SurfaceLinesCsvImporter_CharacteristicPoint_of_SurfaceLine_0_skipped_cause_1_,
+ surfaceLine.Name,
+ e.Message);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Ringtoets.MacroStabilityInwards.IO.csproj
===================================================================
diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Ringtoets.MacroStabilityInwards.IO.csproj (.../Ringtoets.MacroStabilityInwards.IO.csproj) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Ringtoets.MacroStabilityInwards.IO.csproj (.../Ringtoets.MacroStabilityInwards.IO.csproj) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -50,7 +50,8 @@
-
+
+
True
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Properties/Resources.Designer.cs
===================================================================
diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -100,6 +100,16 @@
}
///
+ /// Looks up a localized string similar to De geometrie bevat geen punt op locatie {0} om als '{1}' in te stellen..
+ ///
+ public static string MacroStabilityInwardsSurfaceLine_SetCharacteristicPointAt_Geometry_does_not_contain_point_at_0_to_assign_as_characteristic_point_1_ {
+ get {
+ return ResourceManager.GetString("MacroStabilityInwardsSurfaceLine_SetCharacteristicPointAt_Geometry_does_not_conta" +
+ "in_point_at_0_to_assign_as_characteristic_point_1_", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to {0} De lokale coördinaat moet in het bereik {1} liggen..
///
public static string RingtoetsMacroStabilityInwardsSurfaceLine_0_L_needs_to_be_in_Range_1_ {
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Properties/Resources.resx
===================================================================
diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Properties/Resources.resx (.../Resources.resx) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Properties/Resources.resx (.../Resources.resx) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -141,4 +141,7 @@
Eén of meerdere lagen hebben een top onder de bodem van de ondergrondschematisatie.
+
+ De geometrie bevat geen punt op locatie {0} om als '{1}' in te stellen.
+
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/RingtoetsMacroStabilityInwardsSurfaceLine.cs
===================================================================
diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/RingtoetsMacroStabilityInwardsSurfaceLine.cs (.../RingtoetsMacroStabilityInwardsSurfaceLine.cs) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/RingtoetsMacroStabilityInwardsSurfaceLine.cs (.../RingtoetsMacroStabilityInwardsSurfaceLine.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -31,6 +31,8 @@
using Ringtoets.MacroStabilityInwards.Primitives.Exceptions;
using Ringtoets.MacroStabilityInwards.Primitives.Properties;
+using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources;
+
namespace Ringtoets.MacroStabilityInwards.Primitives
{
///
@@ -62,16 +64,95 @@
public Point3D[] Points { get; private set; }
///
- /// Gets or sets the first 3D geometry point defining the surfaceline in world coordinates.
+ /// Gets the first 3D geometry point defining the surfaceline in world coordinates.
///
public Point3D StartingWorldPoint { get; private set; }
///
- /// Gets or sets the last 3D geometry point defining the surfaceline in world coordinates.
+ /// Gets the last 3D geometry point defining the surfaceline in world coordinates.
///
public Point3D EndingWorldPoint { get; private set; }
///
+ /// Gets the location which generalizes the height of the surface
+ /// on the oustide of the polder.
+ ///
+ public Point3D SurfaceLevelOutside { get; private set; }
+
+ ///
+ /// Gets the location of dike toe when approaching from outside
+ /// the polder.
+ ///
+ public Point3D DikeToeAtRiver { get; private set; }
+
+ ///
+ /// Gets the location of the start of traffic load when approaching
+ /// from outside the polder.
+ ///
+ public Point3D TrafficLoadOutside { get; private set; }
+
+ ///
+ /// Gets the location of the start of traffic load when approaching
+ /// from inside the polder.
+ ///
+ public Point3D TrafficLoadInside { get; private set; }
+
+ ///
+ /// Gets the location of the top of the dike when approaching from
+ /// inside the polder.
+ ///
+ public Point3D DikeTopAtPolder { get; private set; }
+
+ ///
+ /// Gets the location where the shoulder on the side of the polder
+ /// connects with the dike.
+ ///
+ public Point3D ShoulderBaseInside { get; private set; }
+
+ ///
+ /// Gets the location where the shoulder on the side of the polder
+ /// declines towards the location of the dike toe when approaching from inside
+ /// the polder.
+ ///
+ public Point3D ShoulderTopInside { get; private set; }
+
+ ///
+ /// Gets the location of dike toe when approaching from inside
+ /// the polder.
+ ///
+ public Point3D DikeToeAtPolder { get; private set; }
+
+ ///
+ /// Gets the location of the start of the ditch when approaching
+ /// from the dike.
+ ///
+ public Point3D DitchDikeSide { get; private set; }
+
+ ///
+ /// Gets the location of the bottom of the ditch when approaching
+ /// from the dike.
+ ///
+ public Point3D BottomDitchDikeSide { get; private set; }
+
+ ///
+ /// Gets the location of the bottom of the ditch when approaching
+ /// from inside the polder.
+ ///
+ public Point3D BottomDitchPolderSide { get; private set; }
+
+ ///
+ /// Gets the location of the start of the ditch when approaching from
+ /// inside the polder.
+ ///
+ public Point3D DitchPolderSide { get; private set; }
+
+ ///
+ /// Gets the location which generalizes the surface level on the
+ /// inside of the polder
+ ///
+ public Point3D SurfaceLevelInside { get; private set; }
+
+ ///
/// Gets or sets the reference line intersection point in world coordinates.
///
public Point2D ReferenceLineIntersectionWorldPoint { get; set; }
@@ -115,6 +196,227 @@
}
///
+ /// Sets the at the given point.
+ ///
+ /// The location as a which to set as the .
+ /// Thrown when doesn't contain a at
+ /// .
+ /// is null.
+ public void SetDitchPolderSideAt(Point3D point)
+ {
+ Point3D geometryPoint = GetPointFromGeometry(point);
+ if (geometryPoint == null)
+ {
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DitchPolderSide);
+ }
+ DitchPolderSide = geometryPoint;
+ }
+
+ ///
+ /// Sets the at the given point.
+ ///
+ /// The location as a which to set as the .
+ /// Thrown when doesn't contain a at
+ /// .
+ /// is null.
+ public void SetBottomDitchPolderSideAt(Point3D point)
+ {
+ Point3D geometryPoint = GetPointFromGeometry(point);
+ if (geometryPoint == null)
+ {
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_BottomDitchPolderSide);
+ }
+ BottomDitchPolderSide = geometryPoint;
+ }
+
+ ///
+ /// Sets the at the given point.
+ ///
+ /// The location as a which to set as the .
+ /// Thrown when doesn't contain a at
+ /// .
+ /// is null.
+ public void SetBottomDitchDikeSideAt(Point3D point)
+ {
+ Point3D geometryPoint = GetPointFromGeometry(point);
+ if (geometryPoint == null)
+ {
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_BottomDitchDikeSide);
+ }
+ BottomDitchDikeSide = geometryPoint;
+ }
+
+ ///
+ /// Sets the at the given point.
+ ///
+ /// The location as a which to set as the .
+ /// Thrown when doesn't contain a at
+ /// .
+ /// is null.
+ public void SetDitchDikeSideAt(Point3D point)
+ {
+ Point3D geometryPoint = GetPointFromGeometry(point);
+ if (geometryPoint == null)
+ {
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DitchDikeSide);
+ }
+ DitchDikeSide = geometryPoint;
+ }
+
+ ///
+ /// Sets the at the given point.
+ ///
+ /// The location as a which to set as the .
+ /// Thrown when doesn't contain a at
+ /// .
+ /// is null.
+ public void SetDikeTopAtPolderAt(Point3D point)
+ {
+ Point3D geometryPoint = GetPointFromGeometry(point);
+ if (geometryPoint == null)
+ {
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DikeTopAtPolder);
+ }
+ DikeTopAtPolder = geometryPoint;
+ }
+
+ ///
+ /// Sets the at the given point.
+ ///
+ /// The location as a which to set as the .
+ /// Thrown when doesn't contain a at
+ /// .
+ /// is null.
+ public void SetShoulderBaseInsideAt(Point3D point)
+ {
+ Point3D geometryPoint = GetPointFromGeometry(point);
+ if (geometryPoint == null)
+ {
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_ShoulderBaseInside);
+ }
+ ShoulderBaseInside = geometryPoint;
+ }
+
+ ///
+ /// Sets the at the given point.
+ ///
+ /// The location as a which to set as the .
+ /// Thrown when doesn't contain a at
+ /// .
+ /// is null.
+ public void SetShoulderTopInsideAt(Point3D point)
+ {
+ Point3D geometryPoint = GetPointFromGeometry(point);
+ if (geometryPoint == null)
+ {
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_ShoulderTopInside);
+ }
+ ShoulderTopInside = geometryPoint;
+ }
+
+ ///
+ /// Sets the at the given point.
+ ///
+ /// The location as a which to set as the .
+ /// Thrown when doesn't contain a at
+ /// .
+ /// is null.
+ public void SetTrafficLoadInsideAt(Point3D point)
+ {
+ Point3D geometryPoint = GetPointFromGeometry(point);
+ if (geometryPoint == null)
+ {
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_TrafficLoadInside);
+ }
+ TrafficLoadInside = geometryPoint;
+ }
+
+ ///
+ /// Sets the at the given point.
+ ///
+ /// The location as a which to set as the .
+ /// Thrown when doesn't contain a at
+ /// .
+ /// is null.
+ public void SetTrafficLoadOutsideAt(Point3D point)
+ {
+ Point3D geometryPoint = GetPointFromGeometry(point);
+ if (geometryPoint == null)
+ {
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_TrafficLoadOutside);
+ }
+ TrafficLoadOutside = geometryPoint;
+ }
+
+ ///
+ /// Sets the at the given point.
+ ///
+ /// The location as a which to set as the .
+ /// Thrown when doesn't contain a at
+ /// .
+ /// is null.
+ public void SetDikeToeAtRiverAt(Point3D point)
+ {
+ Point3D geometryPoint = GetPointFromGeometry(point);
+ if (geometryPoint == null)
+ {
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtRiver);
+ }
+ DikeToeAtRiver = geometryPoint;
+ }
+
+ ///
+ /// Sets the at the given point.
+ ///
+ /// The location as a which to set as the .
+ /// Thrown when doesn't contain a at
+ /// .
+ /// is null.
+ public void SetDikeToeAtPolderAt(Point3D point)
+ {
+ Point3D geometryPoint = GetPointFromGeometry(point);
+ if (geometryPoint == null)
+ {
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtPolder);
+ }
+ DikeToeAtPolder = geometryPoint;
+ }
+
+ ///
+ /// Sets the at the given point.
+ ///
+ /// The location as a which to set as the .
+ /// Thrown when doesn't contain a at
+ /// .
+ /// is null.
+ public void SetSurfaceLevelInsideAt(Point3D point)
+ {
+ Point3D geometryPoint = GetPointFromGeometry(point);
+ if (geometryPoint == null)
+ {
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_SurfaceLevelInside);
+ }
+ SurfaceLevelInside = geometryPoint;
+ }
+
+ ///
+ /// Sets the at the given point.
+ ///
+ /// The location as a which to set as the .
+ /// Thrown when doesn't contain a at
+ /// .
+ /// is null.
+ public void SetSurfaceLevelOutsideAt(Point3D point)
+ {
+ Point3D geometryPoint = GetPointFromGeometry(point);
+ if (geometryPoint == null)
+ {
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_SurfaceLevelOutside);
+ }
+ SurfaceLevelOutside = geometryPoint;
+ }
+
+ ///
/// Gets the height of the projected at a L=.
///
/// The L coordinate from where to take the height of the .
@@ -279,6 +581,29 @@
return Name;
}
+ ///
+ /// Finds a point from which is at the same position as .
+ ///
+ /// The location of a point from .
+ /// The from at the same location as .
+ /// is null.
+ private Point3D GetPointFromGeometry(Point3D point)
+ {
+ if (point == null)
+ {
+ throw new ArgumentNullException(nameof(point), @"Cannot find a point in geometry using a null point.");
+ }
+ return Points.FirstOrDefault(p => p.Equals(point));
+ }
+
+ private static ArgumentException CreatePointNotInGeometryException(Point3D point, string characteristicPointDescription)
+ {
+ string message = string.Format(Resources.MacroStabilityInwardsSurfaceLine_SetCharacteristicPointAt_Geometry_does_not_contain_point_at_0_to_assign_as_characteristic_point_1_,
+ point,
+ characteristicPointDescription);
+ return new ArgumentException(message);
+ }
+
private bool Equals(RingtoetsMacroStabilityInwardsSurfaceLine other)
{
return string.Equals(Name, other.Name)
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/RingtoetsMacroStabilityInwardsSurfaceLineTest.cs
===================================================================
diff -u -r081badaad87a6e2a6d5c861de9ee95fa1ca6dea3 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/RingtoetsMacroStabilityInwardsSurfaceLineTest.cs (.../RingtoetsMacroStabilityInwardsSurfaceLineTest.cs) (revision 081badaad87a6e2a6d5c861de9ee95fa1ca6dea3)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/RingtoetsMacroStabilityInwardsSurfaceLineTest.cs (.../RingtoetsMacroStabilityInwardsSurfaceLineTest.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -128,6 +128,309 @@
TestHelper.AssertAreEqualButNotSame(sourceData[3], surfaceLine.EndingWorldPoint);
}
+ [TestFixture]
+ public class SetDitchPolderSideAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetDitchPolderSideAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine)
+ {
+ return surfaceLine.DitchPolderSide;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Insteek sloot polderzijde";
+ }
+ }
+
+ [TestFixture]
+ public class SetBottomDitchPolderSideAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetBottomDitchPolderSideAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine)
+ {
+ return surfaceLine.BottomDitchPolderSide;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Slootbodem polderzijde";
+ }
+ }
+
+ [TestFixture]
+ public class SetBottomDitchDikeSideAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetBottomDitchDikeSideAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine)
+ {
+ return surfaceLine.BottomDitchDikeSide;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Slootbodem dijkzijde";
+ }
+ }
+
+ [TestFixture]
+ public class SetDitchDikeSideAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetDitchDikeSideAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine)
+ {
+ return surfaceLine.DitchDikeSide;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Insteek sloot dijkzijde";
+ }
+ }
+
+ [TestFixture]
+ public class SetDikeTopAtPolderAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetDikeTopAtPolderAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine)
+ {
+ return surfaceLine.DikeTopAtPolder;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Kruin binnentalud";
+ }
+ }
+
+ [TestFixture]
+ public class SetShoulderBaseInsideAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetShoulderBaseInsideAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine)
+ {
+ return surfaceLine.ShoulderBaseInside;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Insteek binnenberm";
+ }
+ }
+
+ [TestFixture]
+ public class SetShoulderTopInsideAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetShoulderTopInsideAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine)
+ {
+ return surfaceLine.ShoulderTopInside;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Kruin binnenberm";
+ }
+ }
+
+ [TestFixture]
+ public class SetSurfaceLevelInsideAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetSurfaceLevelInsideAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine)
+ {
+ return surfaceLine.SurfaceLevelInside;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Maaiveld binnenwaarts";
+ }
+ }
+
+ [TestFixture]
+ public class SetSurfaceLevelOutsideAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetSurfaceLevelOutsideAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine)
+ {
+ return surfaceLine.SurfaceLevelOutside;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Maaiveld buitenwaarts";
+ }
+ }
+
+ [TestFixture]
+ public class SetTrafficLoadInsideAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetTrafficLoadInsideAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine)
+ {
+ return surfaceLine.TrafficLoadInside;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Verkeersbelasting kant binnenwaarts";
+ }
+ }
+
+ [TestFixture]
+ public class SetTrafficLoadOutsideAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetTrafficLoadOutsideAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine)
+ {
+ return surfaceLine.TrafficLoadOutside;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Verkeersbelasting kant buitenwaarts";
+ }
+ }
+
+ [TestFixture]
+ public class SetDikeToeAtRiverAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetDikeToeAtRiverAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine)
+ {
+ return surfaceLine.DikeToeAtRiver;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Teen dijk buitenwaarts";
+ }
+ }
+
+ [TestFixture]
+ public class SetDikeToeAtPolderAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetDikeToeAtPolderAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine)
+ {
+ return surfaceLine.DikeToeAtPolder;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Teen dijk binnenwaarts";
+ }
+ }
+
+ public abstract class SetCharacteristicPointTest
+ {
+ [Test]
+ public void PointInGeometry_PointSetFromGeometry()
+ {
+ // Setup
+ const double testX = 1.0;
+ const double testY = 2.2;
+ const double testZ = 4.4;
+ var testPoint = new Point3D(testX, testY, testZ);
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+ CreateTestGeometry(testPoint, surfaceLine);
+
+ // Call
+ SetCharacteristicPoint(surfaceLine, testPoint);
+
+ // Assert
+ Assert.AreEqual(testPoint, GetCharacteristicPoint(surfaceLine));
+ Assert.AreNotSame(testPoint, GetCharacteristicPoint(surfaceLine));
+ }
+
+ [Test]
+ public void GeometryEmpty_ThrowsInvalidOperationException()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ TestDelegate test = () => SetCharacteristicPoint(surfaceLine, testPoint);
+
+ // Assert
+ string expectedMessage = $"De geometrie bevat geen punt op locatie {testPoint} om als '{CharacteristicPointDescription()}' in te stellen.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ [Test]
+ public void Null_ThrowsArgumentNullException()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ TestDelegate test = () => SetCharacteristicPoint(surfaceLine, null);
+
+ // Assert
+ const string expectedMessage = "Cannot find a point in geometry using a null point.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ protected abstract void SetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point);
+ protected abstract Point3D GetCharacteristicPoint(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine);
+ protected abstract string CharacteristicPointDescription();
+ }
+
[Test]
public void ProjectGeometryToLZ_EmptyCollection_ReturnEmptyCollection()
{
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/MacrostabilityInwardsSurfaceLineTransformerTest.cs
===================================================================
diff -u -rb8fa5d6867c945f3f1744fd1455b89cadb357959 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/MacrostabilityInwardsSurfaceLineTransformerTest.cs (.../MacrostabilityInwardsSurfaceLineTransformerTest.cs) (revision b8fa5d6867c945f3f1744fd1455b89cadb357959)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/MacrostabilityInwardsSurfaceLineTransformerTest.cs (.../MacrostabilityInwardsSurfaceLineTransformerTest.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -20,19 +20,95 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
using Core.Common.Base.Geometry;
using Core.Common.TestUtil;
using NUnit.Framework;
using Ringtoets.Common.Data;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.IO.SurfaceLines;
using Ringtoets.MacroStabilityInwards.IO.Importers;
+using Ringtoets.MacroStabilityInwards.Primitives;
namespace Ringtoets.MacrostabilityInwards.IO.Test.Importers
{
[TestFixture]
public class MacrostabilityInwardsSurfaceLineTransformerTest
{
+ private static IEnumerable MoveCharacteristicPoint
+ {
+ get
+ {
+ yield return new TestCaseData(
+ new Action((cp, p) => cp.SurfaceLevelOutside = p),
+ new Func(sl => sl.SurfaceLevelOutside),
+ "Maaiveld buitenwaarts")
+ .SetName("Move SurfaceLevelOutside");
+ yield return new TestCaseData(
+ new Action((cp, p) => cp.DikeToeAtRiver = p),
+ new Func(sl => sl.DikeToeAtRiver),
+ "Teen dijk buitenwaarts")
+ .SetName("Move DikeToeAtRiver");
+ yield return new TestCaseData(
+ new Action((cp, p) => cp.TrafficLoadOutside = p),
+ new Func(sl => sl.TrafficLoadOutside),
+ "Verkeersbelasting kant buitenwaarts")
+ .SetName("Move TrafficLoadOutside");
+ yield return new TestCaseData(
+ new Action((cp, p) => cp.TrafficLoadInside = p),
+ new Func(sl => sl.TrafficLoadInside),
+ "Verkeersbelasting kant binnenwaarts")
+ .SetName("Move TrafficLoadInside");
+ yield return new TestCaseData(
+ new Action((cp, p) => cp.DikeTopAtPolder = p),
+ new Func(sl => sl.DikeTopAtPolder),
+ "Kruin binnentalud")
+ .SetName("Move DikeTopAtPolder");
+ yield return new TestCaseData(
+ new Action((cp, p) => cp.ShoulderBaseInside = p),
+ new Func(sl => sl.ShoulderBaseInside),
+ "Insteek binnenberm")
+ .SetName("Move ShoulderBaseInside");
+ yield return new TestCaseData(
+ new Action((cp, p) => cp.ShoulderTopInside = p),
+ new Func(sl => sl.ShoulderTopInside),
+ "Kruin binnenberm")
+ .SetName("Move ShoulderTopInside");
+ yield return new TestCaseData(
+ new Action((cp, p) => cp.DitchDikeSide = p),
+ new Func(sl => sl.DitchDikeSide),
+ "Insteek sloot dijkzijde")
+ .SetName("Move DitchDikeSide");
+ yield return new TestCaseData(
+ new Action((cp, p) => cp.BottomDitchDikeSide = p),
+ new Func(sl => sl.BottomDitchDikeSide),
+ "Slootbodem dijkzijde")
+ .SetName("Move BottomDitchDikeSide");
+ yield return new TestCaseData(
+ new Action((cp, p) => cp.BottomDitchPolderSide = p),
+ new Func(sl => sl.BottomDitchPolderSide),
+ "Slootbodem polderzijde")
+ .SetName("Move BottomDitchPolderSide");
+ yield return new TestCaseData(
+ new Action((cp, p) => cp.DitchPolderSide = p),
+ new Func(sl => sl.DitchPolderSide),
+ "Insteek sloot polderzijde")
+ .SetName("Move DitchPolderSide");
+ yield return new TestCaseData(
+ new Action((cp, p) => cp.DikeToeAtPolder = p),
+ new Func(sl => sl.DikeToeAtPolder),
+ "Teen dijk binnenwaarts")
+ .SetName("Move DikeToeAtPolder");
+ yield return new TestCaseData(
+ new Action((cp, p) => cp.SurfaceLevelInside = p),
+ new Func(sl => sl.SurfaceLevelInside),
+ "Maaiveld binnenwaarts")
+ .SetName("Move SurfaceLevelInside");
+ }
+ }
+
[Test]
public void Constructor_WithoutReferenceLine_ThrowsArgumentNullException()
{
@@ -110,5 +186,92 @@
TestHelper.AssertLogMessageWithLevelIsGenerated(call, Tuple.Create(message, LogLevelConstant.Error));
Assert.IsNull(result);
}
+
+ [Test]
+ [TestCaseSource(nameof(MoveCharacteristicPoint))]
+ public void Transform_CharacteristicPointNotOnSurfaceLine_LogErrorAndReturnNull(Action pointChange, Func pointWhichIsNull, string changedCharacteristicPointName)
+ {
+ // Setup
+ var referenceLine = new ReferenceLine();
+ var transformer = new MacroStabilityInwardsSurfaceLineTransformer(referenceLine);
+ const string locationName = "a location";
+
+ var random = new Random(21);
+ double randomZ = random.NextDouble();
+
+ var surfaceLine = new SurfaceLine
+ {
+ Name = locationName
+ };
+
+ var point1 = new Point3D(3.5, 4.8, randomZ);
+ var point2 = new Point3D(7.2, 9.3, randomZ);
+ var point3 = new Point3D(12.0, 5.6, randomZ);
+ var notOnSurfaceLinePoint = new Point3D(7.3, 9.3, randomZ);
+
+ surfaceLine.SetGeometry(new[]
+ {
+ point1,
+ point2,
+ point3
+ });
+
+ var characteristicPoints = new CharacteristicPoints(locationName)
+ {
+ SurfaceLevelOutside = point2,
+ DikeToeAtRiver = point2,
+ TrafficLoadOutside = point2,
+ TrafficLoadInside = point2,
+ DikeTopAtPolder = point2,
+ ShoulderBaseInside = point3,
+ ShoulderTopInside = point3,
+ BottomDitchDikeSide = point3,
+ BottomDitchPolderSide = point3,
+ DitchPolderSide = point3,
+ DitchDikeSide = point3,
+ DikeToeAtPolder = point3,
+ SurfaceLevelInside = point3
+ };
+
+ pointChange(characteristicPoints, notOnSurfaceLinePoint);
+
+ referenceLine.SetGeometry(new[]
+ {
+ new Point2D(5.6, 2.5),
+ new Point2D(6.8, 15)
+ });
+
+ RingtoetsMacroStabilityInwardsSurfaceLine result = null;
+
+ // Call
+ Action call = () => result = transformer.Transform(surfaceLine, characteristicPoints);
+
+ // Assert
+ string message = $"Karakteristiek punt van profielschematisatie '{locationName}' is overgeslagen. De geometrie bevat geen punt op locatie {notOnSurfaceLinePoint} om als '{changedCharacteristicPointName}' in te stellen.";
+ TestHelper.AssertLogMessageWithLevelIsGenerated(call, Tuple.Create(message, LogLevelConstant.Error));
+ Assert.AreEqual(new[]
+ {
+ point1,
+ point2,
+ point3
+ }, result.Points);
+ Assert.IsNull(pointWhichIsNull(result));
+ Assert.AreEqual(1, new Collection
+ {
+ result.SurfaceLevelOutside,
+ result.DikeToeAtRiver,
+ result.TrafficLoadOutside,
+ result.TrafficLoadInside,
+ result.DikeTopAtPolder,
+ result.ShoulderBaseInside,
+ result.ShoulderTopInside,
+ result.BottomDitchDikeSide,
+ result.BottomDitchPolderSide,
+ result.DitchPolderSide,
+ result.DitchDikeSide,
+ result.DikeToeAtPolder,
+ result.SurfaceLevelInside
+ }.Count(p => p == null));
+ }
}
}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/RingtoetsMacroStabilityInwardsSurfaceLineExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/RingtoetsMacroStabilityInwardsSurfaceLineExtensionsTest.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Importers/RingtoetsMacroStabilityInwardsSurfaceLineExtensionsTest.cs (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -0,0 +1,985 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Core.Common.Base.Geometry;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.IO.SurfaceLines;
+using Ringtoets.MacroStabilityInwards.IO.Importers;
+using Ringtoets.MacroStabilityInwards.Primitives;
+
+namespace Ringtoets.MacroStabilityInwards.IO.Test.Importers
+{
+ [TestFixture]
+ public class RingtoetsMacroStabilityInwardsSurfaceLineExtensionsTest
+ {
+ [Test]
+ public void TrySetDitchDikeSide_Null_ReturnsFalse()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ bool result = surfaceLine.TrySetDitchDikeSide(null);
+
+ // Assert
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetDitchDikeSide_NoPointInGeometry_LogAndReturnFalse()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = "testName"
+ };
+
+ var result = true;
+
+ // Call
+ Action test = () => result = surfaceLine.TrySetDitchDikeSide(testPoint);
+
+ // Assert
+ string message = $"Karakteristiek punt van profielschematisatie 'testName' is overgeslagen. De geometrie bevat geen punt op locatie {testPoint} om als 'Insteek sloot dijkzijde' in te stellen.";
+ TestHelper.AssertLogMessageIsGenerated(test, message, 1);
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetDitchDikeSide_PointInGeometry_PointSetAndReturnTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ double z = random.NextDouble();
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ var point = new Point3D(x, y, z);
+
+ surfaceLine.SetGeometry(new[]
+ {
+ point
+ });
+
+ // Call
+ bool result = surfaceLine.TrySetDitchDikeSide(point);
+
+ // Assert
+ Assert.IsTrue(result);
+ Assert.AreEqual(point, surfaceLine.DitchDikeSide);
+ }
+
+ [Test]
+ public void TrySetBottomDitchDikeSide_Null_ReturnsFalse()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ bool result = surfaceLine.TrySetBottomDitchDikeSide(null);
+
+ // Assert
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetBottomDitchDikeSide_NoPointInGeometry_LogAndReturnFalse()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = "testName"
+ };
+
+ var result = true;
+
+ // Call
+ Action test = () => result = surfaceLine.TrySetBottomDitchDikeSide(testPoint);
+
+ // Assert
+ string message = $"Karakteristiek punt van profielschematisatie 'testName' is overgeslagen. De geometrie bevat geen punt op locatie {testPoint} om als 'Slootbodem dijkzijde' in te stellen.";
+ TestHelper.AssertLogMessageIsGenerated(test, message, 1);
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetBottomDitchDikeSide_PointInGeometry_PointSetAndReturnTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ double z = random.NextDouble();
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ var point = new Point3D(x, y, z);
+
+ surfaceLine.SetGeometry(new[]
+ {
+ point
+ });
+
+ // Call
+ bool result = surfaceLine.TrySetBottomDitchDikeSide(point);
+
+ // Assert
+ Assert.IsTrue(result);
+ Assert.AreEqual(point, surfaceLine.BottomDitchDikeSide);
+ }
+
+ [Test]
+ public void TrySetBottomDitchPolderSide_Null_ReturnsFalse()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ bool result = surfaceLine.TrySetBottomDitchPolderSide(null);
+
+ // Assert
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetBottomDitchPolderSide_NoPointInGeometry_LogAndReturnFalse()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = "testName"
+ };
+
+ var result = true;
+
+ // Call
+ Action test = () => result = surfaceLine.TrySetBottomDitchPolderSide(testPoint);
+
+ // Assert
+ string message = $"Karakteristiek punt van profielschematisatie 'testName' is overgeslagen. De geometrie bevat geen punt op locatie {testPoint} om als 'Slootbodem polderzijde' in te stellen.";
+ TestHelper.AssertLogMessageIsGenerated(test, message, 1);
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetBottomDitchPolderSide_PointInGeometry_PointSetAndReturnTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ double z = random.NextDouble();
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ var point = new Point3D(x, y, z);
+
+ surfaceLine.SetGeometry(new[]
+ {
+ point
+ });
+
+ // Call
+ bool result = surfaceLine.TrySetBottomDitchPolderSide(point);
+
+ // Assert
+ Assert.IsTrue(result);
+ Assert.AreEqual(point, surfaceLine.BottomDitchPolderSide);
+ }
+
+ [Test]
+ public void TrySetDitchPolderSide_Null_ReturnsFalse()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ bool result = surfaceLine.TrySetDitchPolderSide(null);
+
+ // Assert
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetDitchPolderSide_NoPointInGeometry_LogAndReturnFalse()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = "testName"
+ };
+
+ var result = true;
+
+ // Call
+ Action test = () => result = surfaceLine.TrySetDitchPolderSide(testPoint);
+
+ // Assert
+ string message = $"Karakteristiek punt van profielschematisatie 'testName' is overgeslagen. De geometrie bevat geen punt op locatie {testPoint} om als 'Insteek sloot polderzijde' in te stellen.";
+ TestHelper.AssertLogMessageIsGenerated(test, message, 1);
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetDitchPolderSide_PointInGeometry_PointSetAndReturnTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ double z = random.NextDouble();
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ var point = new Point3D(x, y, z);
+
+ surfaceLine.SetGeometry(new[]
+ {
+ point
+ });
+
+ // Call
+ bool result = surfaceLine.TrySetDitchPolderSide(point);
+
+ // Assert
+ Assert.IsTrue(result);
+ Assert.AreEqual(point, surfaceLine.DitchPolderSide);
+ }
+
+ [Test]
+ public void TrySetTrafficLoadInside_Null_ReturnsFalse()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ bool result = surfaceLine.TrySetTrafficLoadInside(null);
+
+ // Assert
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetTrafficLoadInside_NoPointInGeometry_LogAndReturnFalse()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = "testName"
+ };
+
+ var result = true;
+
+ // Call
+ Action test = () => result = surfaceLine.TrySetTrafficLoadInside(testPoint);
+
+ // Assert
+ string message = $"Karakteristiek punt van profielschematisatie 'testName' is overgeslagen. De geometrie bevat geen punt op locatie {testPoint} om als 'Verkeersbelasting kant binnenwaarts' in te stellen.";
+ TestHelper.AssertLogMessageIsGenerated(test, message, 1);
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetTrafficLoadInside_PointInGeometry_PointSetAndReturnTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ double z = random.NextDouble();
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ var point = new Point3D(x, y, z);
+
+ surfaceLine.SetGeometry(new[]
+ {
+ point
+ });
+
+ // Call
+ bool result = surfaceLine.TrySetTrafficLoadInside(point);
+
+ // Assert
+ Assert.IsTrue(result);
+ Assert.AreEqual(point, surfaceLine.TrafficLoadInside);
+ }
+
+ [Test]
+ public void TrySetTrafficLoadOutside_Null_ReturnsFalse()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ bool result = surfaceLine.TrySetTrafficLoadOutside(null);
+
+ // Assert
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetTrafficLoadOutside_NoPointInGeometry_LogAndReturnFalse()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = "testName"
+ };
+
+ var result = true;
+
+ // Call
+ Action test = () => result = surfaceLine.TrySetTrafficLoadOutside(testPoint);
+
+ // Assert
+ string message = $"Karakteristiek punt van profielschematisatie 'testName' is overgeslagen. De geometrie bevat geen punt op locatie {testPoint} om als 'Verkeersbelasting kant buitenwaarts' in te stellen.";
+ TestHelper.AssertLogMessageIsGenerated(test, message, 1);
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetTrafficLoadOutside_PointInGeometry_PointSetAndReturnTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ double z = random.NextDouble();
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ var point = new Point3D(x, y, z);
+
+ surfaceLine.SetGeometry(new[]
+ {
+ point
+ });
+
+ // Call
+ bool result = surfaceLine.TrySetTrafficLoadOutside(point);
+
+ // Assert
+ Assert.IsTrue(result);
+ Assert.AreEqual(point, surfaceLine.TrafficLoadOutside);
+ }
+
+ [Test]
+ public void TrySetDikeTopAtPolder_Null_ReturnsFalse()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ bool result = surfaceLine.TrySetDikeTopAtPolder(null);
+
+ // Assert
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetDikeTopAtPolder_NoPointInGeometry_LogAndReturnFalse()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = "testName"
+ };
+
+ var result = true;
+
+ // Call
+ Action test = () => result = surfaceLine.TrySetDikeTopAtPolder(testPoint);
+
+ // Assert
+ string message = $"Karakteristiek punt van profielschematisatie 'testName' is overgeslagen. De geometrie bevat geen punt op locatie {testPoint} om als 'Kruin binnentalud' in te stellen.";
+ TestHelper.AssertLogMessageIsGenerated(test, message, 1);
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetDikeTopAtPolder_PointInGeometry_PointSetAndReturnTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ double z = random.NextDouble();
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ var point = new Point3D(x, y, z);
+
+ surfaceLine.SetGeometry(new[]
+ {
+ point
+ });
+
+ // Call
+ bool result = surfaceLine.TrySetDikeTopAtPolder(point);
+
+ // Assert
+ Assert.IsTrue(result);
+ Assert.AreEqual(point, surfaceLine.DikeTopAtPolder);
+ }
+
+ [Test]
+ public void TrySetShoulderBaseInside_Null_ReturnsFalse()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ bool result = surfaceLine.TrySetShoulderBaseInside(null);
+
+ // Assert
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetShoulderBaseInside_NoPointInGeometry_LogAndReturnFalse()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = "testName"
+ };
+
+ var result = true;
+
+ // Call
+ Action test = () => result = surfaceLine.TrySetShoulderBaseInside(testPoint);
+
+ // Assert
+ string message = $"Karakteristiek punt van profielschematisatie 'testName' is overgeslagen. De geometrie bevat geen punt op locatie {testPoint} om als 'Insteek binnenberm' in te stellen.";
+ TestHelper.AssertLogMessageIsGenerated(test, message, 1);
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetShoulderBaseInside_PointInGeometry_PointSetAndReturnTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ double z = random.NextDouble();
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ var point = new Point3D(x, y, z);
+
+ surfaceLine.SetGeometry(new[]
+ {
+ point
+ });
+
+ // Call
+ bool result = surfaceLine.TrySetShoulderBaseInside(point);
+
+ // Assert
+ Assert.IsTrue(result);
+ Assert.AreEqual(point, surfaceLine.ShoulderBaseInside);
+ }
+
+ [Test]
+ public void TrySetShoulderTopInside_Null_ReturnsFalse()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ bool result = surfaceLine.TrySetShoulderTopInside(null);
+
+ // Assert
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetShoulderTopInside_NoPointInGeometry_LogAndReturnFalse()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = "testName"
+ };
+
+ var result = true;
+
+ // Call
+ Action test = () => result = surfaceLine.TrySetShoulderTopInside(testPoint);
+
+ // Assert
+ string message = $"Karakteristiek punt van profielschematisatie 'testName' is overgeslagen. De geometrie bevat geen punt op locatie {testPoint} om als 'Kruin binnenberm' in te stellen.";
+ TestHelper.AssertLogMessageIsGenerated(test, message, 1);
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetShoulderTopInside_PointInGeometry_PointSetAndReturnTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ double z = random.NextDouble();
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ var point = new Point3D(x, y, z);
+
+ surfaceLine.SetGeometry(new[]
+ {
+ point
+ });
+
+ // Call
+ bool result = surfaceLine.TrySetShoulderTopInside(point);
+
+ // Assert
+ Assert.IsTrue(result);
+ Assert.AreEqual(point, surfaceLine.ShoulderTopInside);
+ }
+
+ [Test]
+ public void TrySetDikeToeAtPolder_Null_ReturnsFalse()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ bool result = surfaceLine.TrySetDikeToeAtPolder(null);
+
+ // Assert
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetDikeToeAtPolder_NoPointInGeometry_LogAndReturnFalse()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = "testName"
+ };
+
+ var result = true;
+
+ // Call
+ Action test = () => result = surfaceLine.TrySetDikeToeAtPolder(testPoint);
+
+ // Assert
+ string message = $"Karakteristiek punt van profielschematisatie 'testName' is overgeslagen. De geometrie bevat geen punt op locatie {testPoint} om als 'Teen dijk binnenwaarts' in te stellen.";
+ TestHelper.AssertLogMessageIsGenerated(test, message, 1);
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetDikeToeAtPolder_PointInGeometry_PointSetAndReturnTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ double z = random.NextDouble();
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ var point = new Point3D(x, y, z);
+
+ surfaceLine.SetGeometry(new[]
+ {
+ point
+ });
+
+ // Call
+ bool result = surfaceLine.TrySetDikeToeAtPolder(point);
+
+ // Assert
+ Assert.IsTrue(result);
+ Assert.AreEqual(point, surfaceLine.DikeToeAtPolder);
+ }
+
+ [Test]
+ public void TrySetDikeToeAtRiver_Null_ReturnsFalse()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ bool result = surfaceLine.TrySetDikeToeAtRiver(null);
+
+ // Assert
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetDikeToeAtRiver_NoPointInGeometry_LogAndReturnFalse()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = "testName"
+ };
+
+ var result = true;
+
+ // Call
+ Action test = () => result = surfaceLine.TrySetDikeToeAtRiver(testPoint);
+
+ // Assert
+ string message = $"Karakteristiek punt van profielschematisatie 'testName' is overgeslagen. De geometrie bevat geen punt op locatie {testPoint} om als 'Teen dijk buitenwaarts' in te stellen.";
+ TestHelper.AssertLogMessageIsGenerated(test, message, 1);
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetDikeToeAtRiver_PointInGeometry_PointSetAndReturnTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ double z = random.NextDouble();
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ var point = new Point3D(x, y, z);
+
+ surfaceLine.SetGeometry(new[]
+ {
+ point
+ });
+
+ // Call
+ bool result = surfaceLine.TrySetDikeToeAtRiver(point);
+
+ // Assert
+ Assert.IsTrue(result);
+ Assert.AreEqual(point, surfaceLine.DikeToeAtRiver);
+ }
+
+ [Test]
+ public void TrySetSurfaceLevelInside_Null_ReturnsFalse()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ bool result = surfaceLine.TrySetSurfaceLevelInside(null);
+
+ // Assert
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetSurfaceLevelInside_NoPointInGeometry_LogAndReturnFalse()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = "testName"
+ };
+
+ var result = true;
+
+ // Call
+ Action test = () => result = surfaceLine.TrySetSurfaceLevelInside(testPoint);
+
+ // Assert
+ string message = $"Karakteristiek punt van profielschematisatie 'testName' is overgeslagen. De geometrie bevat geen punt op locatie {testPoint} om als 'Maaiveld binnenwaarts' in te stellen.";
+ TestHelper.AssertLogMessageIsGenerated(test, message, 1);
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetSurfaceLevelInside_PointInGeometry_PointSetAndReturnTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ double z = random.NextDouble();
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ var point = new Point3D(x, y, z);
+
+ surfaceLine.SetGeometry(new[]
+ {
+ point
+ });
+
+ // Call
+ bool result = surfaceLine.TrySetSurfaceLevelInside(point);
+
+ // Assert
+ Assert.IsTrue(result);
+ Assert.AreEqual(point, surfaceLine.SurfaceLevelInside);
+ }
+
+ [Test]
+ public void TrySetSurfaceLevelOutside_Null_ReturnsFalse()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ // Call
+ bool result = surfaceLine.TrySetSurfaceLevelOutside(null);
+
+ // Assert
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetSurfaceLevelOutside_NoPointInGeometry_LogAndReturnFalse()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine
+ {
+ Name = "testName"
+ };
+
+ var result = true;
+
+ // Call
+ Action test = () => result = surfaceLine.TrySetSurfaceLevelOutside(testPoint);
+
+ // Assert
+ string message = $"Karakteristiek punt van profielschematisatie 'testName' is overgeslagen. De geometrie bevat geen punt op locatie {testPoint} om als 'Maaiveld buitenwaarts' in te stellen.";
+ TestHelper.AssertLogMessageIsGenerated(test, message, 1);
+ Assert.IsFalse(result);
+ }
+
+ [Test]
+ public void TrySetSurfaceLevelOutside_PointInGeometry_PointSetAndReturnTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ double z = random.NextDouble();
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+
+ var point = new Point3D(x, y, z);
+
+ surfaceLine.SetGeometry(new[]
+ {
+ point
+ });
+
+ // Call
+ bool result = surfaceLine.TrySetSurfaceLevelOutside(point);
+
+ // Assert
+ Assert.IsTrue(result);
+ Assert.AreEqual(point, surfaceLine.SurfaceLevelOutside);
+ }
+
+ [Test]
+ public void SetCharacteristicPoints_SurfaceLineNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var points = new CharacteristicPoints("swapped dike toes")
+ {
+ DikeToeAtPolder = new Point3D(3, 2, 5),
+ DikeToeAtRiver = new Point3D(3.4, 3, 8),
+ DitchDikeSide = new Point3D(4.4, 6, 8),
+ BottomDitchDikeSide = new Point3D(5.1, 6, 6.5),
+ BottomDitchPolderSide = new Point3D(8.5, 7.2, 4.2),
+ DitchPolderSide = new Point3D(9.6, 7.5, 3.9)
+ };
+
+ // Call
+ TestDelegate test = () => ((RingtoetsMacroStabilityInwardsSurfaceLine) null).SetCharacteristicPoints(points);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("surfaceLine", exception.ParamName);
+ }
+
+ [Test]
+ public void SetCharacteristicPoints_CharacteristicPointsNull_ReturnsFalseNoCharacteristicPointsSet()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(3, 2, 5),
+ new Point3D(3.4, 3, 8),
+ new Point3D(4.4, 6, 8),
+ new Point3D(5.1, 6, 6.5),
+ new Point3D(8.5, 7.2, 4.2),
+ new Point3D(9.6, 7.5, 3.9)
+ });
+
+ // Call
+ bool result = surfaceLine.SetCharacteristicPoints(null);
+
+ // Assert
+ Assert.IsFalse(result);
+ Assert.IsNull(surfaceLine.DikeToeAtRiver);
+ Assert.IsNull(surfaceLine.DikeToeAtPolder);
+ Assert.IsNull(surfaceLine.DitchDikeSide);
+ Assert.IsNull(surfaceLine.BottomDitchDikeSide);
+ Assert.IsNull(surfaceLine.BottomDitchPolderSide);
+ Assert.IsNull(surfaceLine.DitchPolderSide);
+ }
+
+ [Test]
+ [TestCaseSource(nameof(DifferentValidCharacteristicPointConfigurations))]
+ public void SetCharacteristicPoints_ValidSituations_ReturnsTruePointsAreSet(CharacteristicPoints points)
+ {
+ // Setup
+ var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine();
+ surfaceLine.SetGeometry(CharacteristicPointsToGeometry(points));
+
+ // Call
+ bool result = surfaceLine.SetCharacteristicPoints(points);
+
+ // Assert
+ Assert.IsTrue(result);
+ Assert.AreEqual(points.DikeToeAtRiver, surfaceLine.DikeToeAtRiver);
+ Assert.AreEqual(points.DikeToeAtPolder, surfaceLine.DikeToeAtPolder);
+ Assert.AreEqual(points.DitchDikeSide, surfaceLine.DitchDikeSide);
+ Assert.AreEqual(points.BottomDitchDikeSide, surfaceLine.BottomDitchDikeSide);
+ Assert.AreEqual(points.BottomDitchPolderSide, surfaceLine.BottomDitchPolderSide);
+ Assert.AreEqual(points.DitchPolderSide, surfaceLine.DitchPolderSide);
+ }
+
+ private static IEnumerable CharacteristicPointsToGeometry(CharacteristicPoints points)
+ {
+ return new[]
+ {
+ points.DikeToeAtRiver,
+ points.DikeToeAtPolder,
+ points.DitchDikeSide,
+ points.BottomDitchDikeSide,
+ points.BottomDitchPolderSide,
+ points.DitchPolderSide
+ }.Where(p => p != null);
+ }
+
+ private static IEnumerable DifferentValidCharacteristicPointConfigurations
+ {
+ get
+ {
+ var dikeToeAtRiver = new Point3D(3, 2, 5);
+ var dikeToeAtPolder = new Point3D(3.4, 3, 8);
+ var ditchDikeSide = new Point3D(4.4, 6, 8);
+ var bottomDitchDikeSide = new Point3D(5.1, 6, 6.5);
+ var bottomDitchPolderSide = new Point3D(8.5, 7.2, 4.2);
+ var ditchPolderSide = new Point3D(9.6, 7.5, 3.9);
+
+ var name = "All present";
+ yield return new TestCaseData(new CharacteristicPoints(name)
+ {
+ DikeToeAtRiver = dikeToeAtRiver,
+ DikeToeAtPolder = dikeToeAtPolder,
+ DitchDikeSide = ditchDikeSide,
+ BottomDitchDikeSide = bottomDitchDikeSide,
+ BottomDitchPolderSide = bottomDitchPolderSide,
+ DitchPolderSide = ditchPolderSide
+ }).SetName(name);
+
+ name = "Missing DikeToeAtRiver";
+ yield return new TestCaseData(new CharacteristicPoints(name)
+ {
+ DikeToeAtPolder = dikeToeAtPolder,
+ DitchDikeSide = ditchDikeSide,
+ BottomDitchDikeSide = bottomDitchDikeSide,
+ BottomDitchPolderSide = bottomDitchPolderSide,
+ DitchPolderSide = ditchPolderSide
+ }).SetName(name);
+
+ name = "Missing DikeToeAtPolder";
+ yield return new TestCaseData(new CharacteristicPoints(name)
+ {
+ DikeToeAtRiver = dikeToeAtRiver,
+ DitchDikeSide = ditchDikeSide,
+ BottomDitchDikeSide = bottomDitchDikeSide,
+ BottomDitchPolderSide = bottomDitchPolderSide,
+ DitchPolderSide = ditchPolderSide
+ }).SetName(name);
+
+ name = "Missing DitchDikeSide";
+ yield return new TestCaseData(new CharacteristicPoints(name)
+ {
+ DikeToeAtRiver = dikeToeAtRiver,
+ DikeToeAtPolder = dikeToeAtPolder,
+ BottomDitchDikeSide = bottomDitchDikeSide,
+ BottomDitchPolderSide = bottomDitchPolderSide,
+ DitchPolderSide = ditchPolderSide
+ }).SetName(name);
+
+ name = "Missing BottomDitchDikeSide";
+ yield return new TestCaseData(new CharacteristicPoints(name)
+ {
+ DikeToeAtRiver = dikeToeAtRiver,
+ DikeToeAtPolder = dikeToeAtPolder,
+ DitchDikeSide = ditchDikeSide,
+ BottomDitchPolderSide = bottomDitchPolderSide,
+ DitchPolderSide = ditchPolderSide
+ }).SetName(name);
+
+ name = "Missing BottomDitchPolderSide";
+ yield return new TestCaseData(new CharacteristicPoints(name)
+ {
+ DikeToeAtRiver = dikeToeAtRiver,
+ DikeToeAtPolder = dikeToeAtPolder,
+ DitchDikeSide = ditchDikeSide,
+ BottomDitchDikeSide = bottomDitchDikeSide,
+ DitchPolderSide = ditchPolderSide
+ }).SetName(name);
+
+ name = "Missing DitchPolderSide";
+ yield return new TestCaseData(new CharacteristicPoints(name)
+ {
+ DikeToeAtRiver = dikeToeAtRiver,
+ DikeToeAtPolder = dikeToeAtPolder,
+ DitchDikeSide = ditchDikeSide,
+ BottomDitchDikeSide = bottomDitchDikeSide,
+ BottomDitchPolderSide = bottomDitchPolderSide
+ }).SetName(name);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj
===================================================================
diff -u -ra940166534b3dd6e778de2e7c8e7e5241f3d3381 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.Test.csproj) (revision a940166534b3dd6e778de2e7c8e7e5241f3d3381)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.Test.csproj) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -79,6 +79,7 @@
+
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingSurfaceLineTransformer.cs
===================================================================
diff -u -r8e717411be3a9f6947737321832ec2ffe06f43dd -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingSurfaceLineTransformer.cs (.../PipingSurfaceLineTransformer.cs) (revision 8e717411be3a9f6947737321832ec2ffe06f43dd)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/PipingSurfaceLineTransformer.cs (.../PipingSurfaceLineTransformer.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -20,10 +20,8 @@
// All rights reserved.
using System;
-using Core.Common.Base.Geometry;
using log4net;
using Ringtoets.Common.Data.AssessmentSection;
-using Ringtoets.Common.IO.Properties;
using Ringtoets.Common.IO.SurfaceLines;
using Ringtoets.Piping.Primitives;
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/RingtoetsPipingSurfaceLineExtensions.cs
===================================================================
diff -u -r8e717411be3a9f6947737321832ec2ffe06f43dd -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/RingtoetsPipingSurfaceLineExtensions.cs (.../RingtoetsPipingSurfaceLineExtensions.cs) (revision 8e717411be3a9f6947737321832ec2ffe06f43dd)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/RingtoetsPipingSurfaceLineExtensions.cs (.../RingtoetsPipingSurfaceLineExtensions.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -216,12 +216,12 @@
return false;
}
- surfaceLine.TrySetDitchPolderSide(characteristicPoints.DitchPolderSide);
- surfaceLine.TrySetBottomDitchPolderSide(characteristicPoints.BottomDitchPolderSide);
- surfaceLine.TrySetBottomDitchDikeSide(characteristicPoints.BottomDitchDikeSide);
+ surfaceLine.TrySetDikeToeAtRiver(characteristicPoints.DikeToeAtRiver);
surfaceLine.TrySetDitchDikeSide(characteristicPoints.DitchDikeSide);
+ surfaceLine.TrySetBottomDitchDikeSide(characteristicPoints.BottomDitchDikeSide);
+ surfaceLine.TrySetBottomDitchPolderSide(characteristicPoints.BottomDitchPolderSide);
+ surfaceLine.TrySetDitchPolderSide(characteristicPoints.DitchPolderSide);
surfaceLine.TrySetDikeToeAtPolder(characteristicPoints.DikeToeAtPolder);
- surfaceLine.TrySetDikeToeAtRiver(characteristicPoints.DikeToeAtRiver);
return true;
}
Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.Designer.cs
===================================================================
diff -u -r81fa8a9bf3bd503cbd280e88b8f6037a840cff12 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 81fa8a9bf3bd503cbd280e88b8f6037a840cff12)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -82,60 +82,6 @@
}
///
- /// Looks up a localized string similar to Slootbodem dijkzijde.
- ///
- public static string CharacteristicPoint_BottomDitchDikeSide {
- get {
- return ResourceManager.GetString("CharacteristicPoint_BottomDitchDikeSide", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Slootbodem polderzijde.
- ///
- public static string CharacteristicPoint_BottomDitchPolderSide {
- get {
- return ResourceManager.GetString("CharacteristicPoint_BottomDitchPolderSide", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Teen dijk binnenwaarts.
- ///
- public static string CharacteristicPoint_DikeToeAtPolder {
- get {
- return ResourceManager.GetString("CharacteristicPoint_DikeToeAtPolder", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Teen dijk buitenwaarts.
- ///
- public static string CharacteristicPoint_DikeToeAtRiver {
- get {
- return ResourceManager.GetString("CharacteristicPoint_DikeToeAtRiver", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Insteek sloot dijkzijde.
- ///
- public static string CharacteristicPoint_DitchDikeSide {
- get {
- return ResourceManager.GetString("CharacteristicPoint_DitchDikeSide", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Insteek sloot polderzijde.
- ///
- public static string CharacteristicPoint_DitchPolderSide {
- get {
- return ResourceManager.GetString("CharacteristicPoint_DitchPolderSide", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized string similar to Geen lagen gevonden voor de ondergrondschematisatie..
///
public static string Error_Cannot_Construct_PipingSoilProfile_Without_Layers {
Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.resx
===================================================================
diff -u -r2fbb7b54b29f25f69c4c53cdb40f3704dccf5620 -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.resx (.../Resources.resx) (revision 2fbb7b54b29f25f69c4c53cdb40f3704dccf5620)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.resx (.../Resources.resx) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -141,24 +141,6 @@
De geometrie bevat geen punt op locatie {0} om als '{1}' in te stellen.
-
- Slootbodem dijkzijde
-
-
- Slootbodem polderzijde
-
-
- Teen dijk binnenwaarts
-
-
- Teen dijk buitenwaarts
-
-
- Insteek sloot dijkzijde
-
-
- Insteek sloot polderzijde
-
Eén of meerdere lagen hebben een top onder de bodem van de ondergrondschematisatie.
Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs
===================================================================
diff -u -rb8976a5e3cf525e419227e409e44ac69a430711a -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision b8976a5e3cf525e419227e409e44ac69a430711a)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -31,6 +31,8 @@
using Ringtoets.Piping.Primitives.Exceptions;
using Ringtoets.Piping.Primitives.Properties;
+using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources;
+
namespace Ringtoets.Piping.Primitives
{
///
@@ -72,34 +74,40 @@
public Point3D EndingWorldPoint { get; private set; }
///
- /// Gets the point which characterizes the ditch at polder side.
+ /// Gets the location of dike toe when approaching from outside
+ /// the polder.
///
- public Point3D DitchPolderSide { get; private set; }
+ public Point3D DikeToeAtRiver { get; private set; }
///
- /// Gets the point which characterizes the bottom of the ditch at polder side.
+ /// Gets the location of dike toe when approaching from inside
+ /// the polder.
///
- public Point3D BottomDitchPolderSide { get; private set; }
+ public Point3D DikeToeAtPolder { get; private set; }
///
- /// Gets the point which characterizes the bottom of the ditch at dike side.
+ /// Gets the location of the start of the ditch when approaching
+ /// from the dike.
///
- public Point3D BottomDitchDikeSide { get; private set; }
+ public Point3D DitchDikeSide { get; private set; }
///
- /// Gets the point which characterizes the ditch at dike side.
+ /// Gets the location of the bottom of the ditch when approaching
+ /// from the dike.
///
- public Point3D DitchDikeSide { get; private set; }
+ public Point3D BottomDitchDikeSide { get; private set; }
///
- /// Gets the point which characterizes the dike toe at river side.
+ /// Gets the location of the bottom of the ditch when approaching
+ /// from inside the polder.
///
- public Point3D DikeToeAtRiver { get; private set; }
+ public Point3D BottomDitchPolderSide { get; private set; }
///
- /// Gets the point which characterizes the dike toe at polder side.
+ /// Gets the location of the start of the ditch when approaching from
+ /// inside the polder.
///
- public Point3D DikeToeAtPolder { get; private set; }
+ public Point3D DitchPolderSide { get; private set; }
///
/// Gets or sets the reference line intersection point in world coordinates.
@@ -156,7 +164,7 @@
Point3D geometryPoint = GetPointFromGeometry(point);
if (geometryPoint == null)
{
- throw CreatePointNotInGeometryException(point, Resources.CharacteristicPoint_DitchPolderSide);
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DitchPolderSide);
}
DitchPolderSide = geometryPoint;
}
@@ -173,7 +181,7 @@
Point3D geometryPoint = GetPointFromGeometry(point);
if (geometryPoint == null)
{
- throw CreatePointNotInGeometryException(point, Resources.CharacteristicPoint_BottomDitchPolderSide);
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_BottomDitchPolderSide);
}
BottomDitchPolderSide = geometryPoint;
}
@@ -190,7 +198,7 @@
Point3D geometryPoint = GetPointFromGeometry(point);
if (geometryPoint == null)
{
- throw CreatePointNotInGeometryException(point, Resources.CharacteristicPoint_BottomDitchDikeSide);
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_BottomDitchDikeSide);
}
BottomDitchDikeSide = geometryPoint;
}
@@ -207,7 +215,7 @@
Point3D geometryPoint = GetPointFromGeometry(point);
if (geometryPoint == null)
{
- throw CreatePointNotInGeometryException(point, Resources.CharacteristicPoint_DitchDikeSide);
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DitchDikeSide);
}
DitchDikeSide = geometryPoint;
}
@@ -224,7 +232,7 @@
Point3D geometryPoint = GetPointFromGeometry(point);
if (geometryPoint == null)
{
- throw CreatePointNotInGeometryException(point, Resources.CharacteristicPoint_DikeToeAtRiver);
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtRiver);
}
DikeToeAtRiver = geometryPoint;
}
@@ -241,7 +249,7 @@
Point3D geometryPoint = GetPointFromGeometry(point);
if (geometryPoint == null)
{
- throw CreatePointNotInGeometryException(point, Resources.CharacteristicPoint_DikeToeAtPolder);
+ throw CreatePointNotInGeometryException(point, RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtPolder);
}
DikeToeAtPolder = geometryPoint;
}
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs
===================================================================
diff -u -rb8976a5e3cf525e419227e409e44ac69a430711a -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision b8976a5e3cf525e419227e409e44ac69a430711a)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -27,7 +27,6 @@
using Core.Common.Base.Geometry;
using Core.Common.TestUtil;
using NUnit.Framework;
-using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Piping.Primitives;
using Ringtoets.Piping.Primitives.Exceptions;
@@ -266,300 +265,6 @@
}
[Test]
- public void SetDitchPolderSideAt_PointInGeometry_PointSetFromGeometry()
- {
- // Setup
- const double testX = 1.0;
- const double testY = 2.2;
- const double testZ = 4.4;
- var testPoint = new Point3D(testX, testY, testZ);
- var surfaceLine = new RingtoetsPipingSurfaceLine();
- CreateTestGeometry(testPoint, surfaceLine);
-
- // Call
- surfaceLine.SetDitchPolderSideAt(testPoint);
-
- // Assert
- Assert.AreEqual(testPoint, surfaceLine.DitchPolderSide);
- Assert.AreNotSame(testPoint, surfaceLine.DitchPolderSide);
- }
-
- [Test]
- public void SetDitchPolderSideAt_GeometryEmpty_ThrowsInvalidOperationException()
- {
- // Setup
- var random = new Random(21);
- var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
- var surfaceLine = new RingtoetsPipingSurfaceLine();
-
- // Call
- TestDelegate test = () => surfaceLine.SetDitchPolderSideAt(testPoint);
-
- // Assert
- string expectedMessage = $"De geometrie bevat geen punt op locatie {testPoint} om als 'Insteek sloot polderzijde' in te stellen.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
- }
-
- [Test]
- public void SetDitchPolderSideAt_Null_ThrowsArgumentNullException()
- {
- // Setup
- var surfaceLine = new RingtoetsPipingSurfaceLine();
-
- // Call
- TestDelegate test = () => surfaceLine.SetDitchPolderSideAt(null);
-
- // Assert
- const string expectedMessage = "Cannot find a point in geometry using a null point.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
- }
-
- [Test]
- public void SetBottomDitchPolderSideAt_PointInGeometry_PointSetFromGeometry()
- {
- // Setup
- const double testX = 1.0;
- const double testY = 2.2;
- const double testZ = 4.4;
- var testPoint = new Point3D(testX, testY, testZ);
- var surfaceLine = new RingtoetsPipingSurfaceLine();
- CreateTestGeometry(testPoint, surfaceLine);
-
- // Call
- surfaceLine.SetBottomDitchPolderSideAt(testPoint);
-
- // Assert
- Assert.AreEqual(testPoint, surfaceLine.BottomDitchPolderSide);
- Assert.AreNotSame(testPoint, surfaceLine.BottomDitchPolderSide);
- }
-
- [Test]
- public void SetBottomDitchPolderSideAt_GeometryEmpty_ThrowsInvalidOperationException()
- {
- // Setup
- var random = new Random(21);
- var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
- var surfaceLine = new RingtoetsPipingSurfaceLine();
-
- // Call
- TestDelegate test = () => surfaceLine.SetBottomDitchPolderSideAt(testPoint);
-
- // Assert
- string expectedMessage = $"De geometrie bevat geen punt op locatie {testPoint} om als 'Slootbodem polderzijde' in te stellen.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
- }
-
- [Test]
- public void SetBottomDitchPolderSideAt_Null_ThrowsArgumentNullException()
- {
- // Setup
- var surfaceLine = new RingtoetsPipingSurfaceLine();
-
- // Call
- TestDelegate test = () => surfaceLine.SetBottomDitchPolderSideAt(null);
-
- // Assert
- const string expectedMessage = "Cannot find a point in geometry using a null point.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
- }
-
- [Test]
- public void SetBottomDitchDikeSideAt_PointInGeometry_PointSetFromGeometry()
- {
- // Setup
- const double testX = 1.0;
- const double testY = 2.2;
- const double testZ = 4.4;
- var testPoint = new Point3D(testX, testY, testZ);
- var surfaceLine = new RingtoetsPipingSurfaceLine();
- CreateTestGeometry(testPoint, surfaceLine);
-
- // Call
- surfaceLine.SetBottomDitchDikeSideAt(testPoint);
-
- // Assert
- Assert.AreEqual(testPoint, surfaceLine.BottomDitchDikeSide);
- Assert.AreNotSame(testPoint, surfaceLine.BottomDitchDikeSide);
- }
-
- [Test]
- public void SetBottomDitchDikeSideAt_GeometryEmpty_ThrowsInvalidOperationException()
- {
- // Setup
- var random = new Random(21);
- var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
- var surfaceLine = new RingtoetsPipingSurfaceLine();
-
- // Call
- TestDelegate test = () => surfaceLine.SetBottomDitchDikeSideAt(testPoint);
-
- // Assert
- string expectedMessage = $"De geometrie bevat geen punt op locatie {testPoint} om als 'Slootbodem dijkzijde' in te stellen.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
- }
-
- [Test]
- public void SetBottomDitchDikeSideAt_Null_ThrowsArgumentNullException()
- {
- // Setup
- var surfaceLine = new RingtoetsPipingSurfaceLine();
-
- // Call
- TestDelegate test = () => surfaceLine.SetBottomDitchDikeSideAt(null);
-
- // Assert
- const string expectedMessage = "Cannot find a point in geometry using a null point.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
- }
-
- [Test]
- public void SetDitchDikeSideAt_PointInGeometry_PointSetFromGeometry()
- {
- // Setup
- const double testX = 1.0;
- const double testY = 2.2;
- const double testZ = 4.4;
- var testPoint = new Point3D(testX, testY, testZ);
- var surfaceLine = new RingtoetsPipingSurfaceLine();
- CreateTestGeometry(testPoint, surfaceLine);
-
- // Call
- surfaceLine.SetDitchDikeSideAt(testPoint);
-
- // Assert
- Assert.AreEqual(testPoint, surfaceLine.DitchDikeSide);
- Assert.AreNotSame(testPoint, surfaceLine.DitchDikeSide);
- }
-
- [Test]
- public void SetDitchDikeSideAt_GeometryEmpty_ThrowsInvalidOperationException()
- {
- // Setup
- var random = new Random(21);
- var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
- var surfaceLine = new RingtoetsPipingSurfaceLine();
-
- // Call
- TestDelegate test = () => surfaceLine.SetDitchDikeSideAt(testPoint);
-
- // Assert
- string message = $"De geometrie bevat geen punt op locatie {testPoint} om als 'Insteek sloot dijkzijde' in te stellen.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, message);
- }
-
- [Test]
- public void SetDitchDikeSideAt_Null_ThrowsArgumentNullException()
- {
- // Setup
- var surfaceLine = new RingtoetsPipingSurfaceLine();
-
- // Call
- TestDelegate test = () => surfaceLine.SetDitchDikeSideAt(null);
-
- // Assert
- const string expectedMessage = "Cannot find a point in geometry using a null point.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
- }
-
- [Test]
- public void SetDikeToeAtRiverAt_PointInGeometry_PointSetFromGeometry()
- {
- // Setup
- const double testX = 1.0;
- const double testY = 2.2;
- const double testZ = 4.4;
- var testPoint = new Point3D(testX, testY, testZ);
- var surfaceLine = new RingtoetsPipingSurfaceLine();
- CreateTestGeometry(testPoint, surfaceLine);
-
- // Call
- surfaceLine.SetDikeToeAtRiverAt(testPoint);
-
- // Assert
- Assert.AreEqual(testPoint, surfaceLine.DikeToeAtRiver);
- Assert.AreNotSame(testPoint, surfaceLine.DikeToeAtRiver);
- }
-
- [Test]
- public void SetDikeToeAtRiverAt_GeometryEmpty_ThrowsInvalidOperationException()
- {
- // Setup
- var random = new Random(21);
- var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
- var surfaceLine = new RingtoetsPipingSurfaceLine();
-
- // Call
- TestDelegate test = () => surfaceLine.SetDikeToeAtRiverAt(testPoint);
-
- // Assert
- string expectedMessage = $"De geometrie bevat geen punt op locatie {testPoint} om als 'Teen dijk buitenwaarts' in te stellen.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
- }
-
- [Test]
- public void SetDikeToeAtRiverAt_Null_ThrowsArgumentNullException()
- {
- // Setup
- var surfaceLine = new RingtoetsPipingSurfaceLine();
-
- // Call
- TestDelegate test = () => surfaceLine.SetDikeToeAtRiverAt(null);
-
- // Assert
- const string expectedMessage = "Cannot find a point in geometry using a null point.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
- }
-
- [Test]
- public void SetDikeToeAtPolderAt_PointInGeometry_PointSetFromGeometry()
- {
- // Setup
- const double testX = 1.0;
- const double testY = 2.2;
- const double testZ = 4.4;
- var testPoint = new Point3D(testX, testY, testZ);
- var surfaceLine = new RingtoetsPipingSurfaceLine();
- CreateTestGeometry(testPoint, surfaceLine);
-
- // Call
- surfaceLine.SetDikeToeAtPolderAt(testPoint);
-
- // Assert
- Assert.AreEqual(testPoint, surfaceLine.DikeToeAtPolder);
- Assert.AreNotSame(testPoint, surfaceLine.DikeToeAtPolder);
- }
-
- [Test]
- public void SetDikeToeAtPolderAt_GeometryEmpty_ThrowsInvalidOperationException()
- {
- // Setup
- var random = new Random(21);
- var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
- var surfaceLine = new RingtoetsPipingSurfaceLine();
-
- // Call
- TestDelegate test = () => surfaceLine.SetDikeToeAtPolderAt(testPoint);
-
- // Assert
- string expectedMessage = $"De geometrie bevat geen punt op locatie {testPoint} om als 'Teen dijk binnenwaarts' in te stellen.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
- }
-
- [Test]
- public void SetDikeToeAtPolderAt_Null_ThrowsArgumentNullException()
- {
- // Setup
- var surfaceLine = new RingtoetsPipingSurfaceLine();
-
- // Call
- TestDelegate test = () => surfaceLine.SetDikeToeAtPolderAt(null);
-
- // Assert
- const string expectedMessage = "Cannot find a point in geometry using a null point.";
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
- }
-
- [Test]
[TestCase(5.0)]
[TestCase(1.375)]
[TestCase(-0.005)]
@@ -1033,6 +738,176 @@
Assert.AreEqual(hashCodeOne, hashCodeTwo);
}
+ public abstract class SetCharacteristicPointTest
+ {
+ [Test]
+ public void PointInGeometry_PointSetFromGeometry()
+ {
+ // Setup
+ const double testX = 1.0;
+ const double testY = 2.2;
+ const double testZ = 4.4;
+ var testPoint = new Point3D(testX, testY, testZ);
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ CreateTestGeometry(testPoint, surfaceLine);
+
+ // Call
+ SetCharacteristicPoint(surfaceLine, testPoint);
+
+ // Assert
+ Assert.AreEqual(testPoint, GetCharacteristicPoint(surfaceLine));
+ Assert.AreNotSame(testPoint, GetCharacteristicPoint(surfaceLine));
+ }
+
+ [Test]
+ public void GeometryEmpty_ThrowsInvalidOperationException()
+ {
+ // Setup
+ var random = new Random(21);
+ var testPoint = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+
+ // Call
+ TestDelegate test = () => SetCharacteristicPoint(surfaceLine, testPoint);
+
+ // Assert
+ string expectedMessage = $"De geometrie bevat geen punt op locatie {testPoint} om als '{CharacteristicPointDescription()}' in te stellen.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ [Test]
+ public void Null_ThrowsArgumentNullException()
+ {
+ // Setup
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+
+ // Call
+ TestDelegate test = () => SetCharacteristicPoint(surfaceLine, null);
+
+ // Assert
+ const string expectedMessage = "Cannot find a point in geometry using a null point.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage);
+ }
+
+ protected abstract void SetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine, Point3D point);
+ protected abstract Point3D GetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine);
+ protected abstract string CharacteristicPointDescription();
+ }
+
+ [TestFixture]
+ public class SetDitchPolderSideAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetDitchPolderSideAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine)
+ {
+ return surfaceLine.DitchPolderSide;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Insteek sloot polderzijde";
+ }
+ }
+
+ [TestFixture]
+ public class SetBottomDitchPolderSideAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetBottomDitchPolderSideAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine)
+ {
+ return surfaceLine.BottomDitchPolderSide;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Slootbodem polderzijde";
+ }
+ }
+
+ [TestFixture]
+ public class SetBottomDitchDikeSideAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetBottomDitchDikeSideAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine)
+ {
+ return surfaceLine.BottomDitchDikeSide;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Slootbodem dijkzijde";
+ }
+ }
+
+ [TestFixture]
+ public class SetDitchDikeSideAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetDitchDikeSideAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine)
+ {
+ return surfaceLine.DitchDikeSide;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Insteek sloot dijkzijde";
+ }
+ }
+
+ [TestFixture]
+ public class SetDikeToeAtRiverAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetDikeToeAtRiverAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine)
+ {
+ return surfaceLine.DikeToeAtRiver;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Teen dijk buitenwaarts";
+ }
+ }
+
+ [TestFixture]
+ public class SetDikeToeAtPolderAtTest : SetCharacteristicPointTest
+ {
+ protected override void SetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine, Point3D point)
+ {
+ surfaceLine.SetDikeToeAtPolderAt(point);
+ }
+
+ protected override Point3D GetCharacteristicPoint(RingtoetsPipingSurfaceLine surfaceLine)
+ {
+ return surfaceLine.DikeToeAtPolder;
+ }
+
+ protected override string CharacteristicPointDescription()
+ {
+ return "Teen dijk binnenwaarts";
+ }
+ }
+
private static RingtoetsPipingSurfaceLine CreateSurfaceLineWithCharacteristicPoints()
{
var surfaceLine = new RingtoetsPipingSurfaceLine
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/RingtoetsPipingSurfaceLineExtensionsTest.cs
===================================================================
diff -u -r8e717411be3a9f6947737321832ec2ffe06f43dd -r5579d8fdef4f553fb4ba94160825ec960b89bab9
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/RingtoetsPipingSurfaceLineExtensionsTest.cs (.../RingtoetsPipingSurfaceLineExtensionsTest.cs) (revision 8e717411be3a9f6947737321832ec2ffe06f43dd)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Importers/RingtoetsPipingSurfaceLineExtensionsTest.cs (.../RingtoetsPipingSurfaceLineExtensionsTest.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9)
@@ -70,7 +70,7 @@
}
[Test]
- public void TrySetDitchPolderSide_NoPointInGeometry_PointSetAndReturnFalse()
+ public void TrySetDitchPolderSide_PointInGeometry_PointSetAndReturnTrue()
{
// Setup
var random = new Random(21);
@@ -130,7 +130,7 @@
}
[Test]
- public void TrySetBottomDitchDikeSide_NoPointInGeometry_PointSetAndReturnFalse()
+ public void TrySetBottomDitchDikeSide_PointInGeometry_PointSetAndReturnTrue()
{
// Setup
var random = new Random(21);
@@ -190,7 +190,7 @@
}
[Test]
- public void TrySetBottomDitchPolderSide_NoPointInGeometry_PointSetAndReturnFalse()
+ public void TrySetBottomDitchPolderSide_PointInGeometry_PointSetAndReturnTrue()
{
// Setup
var random = new Random(21);
@@ -250,7 +250,7 @@
}
[Test]
- public void TrySetDitchDikeSide_NoPointInGeometry_PointSetAndReturnFalse()
+ public void TrySetDitchDikeSide_PointInGeometry_PointSetAndReturnTrue()
{
// Setup
var random = new Random(21);
@@ -310,7 +310,7 @@
}
[Test]
- public void TrySetDikeToeAtPolder_NoPointInGeometry_PointSetAndReturnFalse()
+ public void TrySetDikeToeAtPolder_PointInGeometry_PointSetAndReturnTrue()
{
// Setup
var random = new Random(21);
@@ -370,7 +370,7 @@
}
[Test]
- public void TrySetDikeToeAtRiver_NoPointInGeometry_PointSetAndReturnFalse()
+ public void TrySetDikeToeAtRiver_PointInGeometry_PointSetAndReturnTrue()
{
// Setup
var random = new Random(21);