Index: Ringtoets/Common/src/Ringtoets.Common.Data/MechanismSurfaceLineBase.cs
===================================================================
diff -u -rfc7fef209ce94b913bf4bfb974abd71242b4769d -r620846e4cf00b13e9310c931d29bac47799a81d8
--- Ringtoets/Common/src/Ringtoets.Common.Data/MechanismSurfaceLineBase.cs (.../MechanismSurfaceLineBase.cs) (revision fc7fef209ce94b913bf4bfb974abd71242b4769d)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/MechanismSurfaceLineBase.cs (.../MechanismSurfaceLineBase.cs) (revision 620846e4cf00b13e9310c931d29bac47799a81d8)
@@ -185,6 +185,11 @@
return !(firstLocalPoint.X > roundedLocalCoordinateL) && !(lastLocalPoint.X < roundedLocalCoordinateL);
}
+ public override string ToString()
+ {
+ return Name;
+ }
+
///
/// Finds a point from which is at the same position as .
///
Fisheye: Tag 620846e4cf00b13e9310c931d29bac47799a81d8 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Exceptions/MacroStabilityInwardsSurfaceLineException.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSurfaceLine.cs
===================================================================
diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -r620846e4cf00b13e9310c931d29bac47799a81d8
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSurfaceLine.cs (.../MacroStabilityInwardsSurfaceLine.cs) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/MacroStabilityInwardsSurfaceLine.cs (.../MacroStabilityInwardsSurfaceLine.cs) (revision 620846e4cf00b13e9310c931d29bac47799a81d8)
@@ -20,58 +20,18 @@
// All rights reserved.
using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Globalization;
-using System.Linq;
-using Core.Common.Base;
-using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
using Ringtoets.Common.Data;
-using Ringtoets.MacroStabilityInwards.Primitives.Exceptions;
-using Ringtoets.MacroStabilityInwards.Primitives.Properties;
using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources;
namespace Ringtoets.MacroStabilityInwards.Primitives
{
///
/// Definition of a surface line for macro stability inwards.
///
- public class MacroStabilityInwardsSurfaceLine : Observable, IMechanismSurfaceLine
+ public class MacroStabilityInwardsSurfaceLine : MechanismSurfaceLineBase
{
- private const int numberOfDecimalPlaces = 2;
-
///
- /// Initializes a new instance of the class.
- ///
- public MacroStabilityInwardsSurfaceLine()
- {
- Name = string.Empty;
- Points = new Point3D[0];
- LocalGeometry = new RoundedPoint2DCollection(2, new Point2D[0]);
- }
-
- ///
- /// Gets or sets the name of the surface line.
- ///
- public string Name { get; set; }
-
- ///
- /// Gets the 3D points describing the geometry of the surface line.
- ///
- public Point3D[] Points { get; private set; }
-
- ///
- /// Gets the first 3D geometry point defining the surface line in world coordinates.
- ///
- public Point3D StartingWorldPoint { get; private set; }
-
- ///
- /// Gets the last 3D geometry point defining the surface line in world coordinates.
- ///
- public Point3D EndingWorldPoint { get; private set; }
-
- ///
/// Gets the location which generalizes the height of the surface
/// on the outside of the polder.
///
@@ -151,43 +111,6 @@
public Point3D SurfaceLevelInside { get; private set; }
///
- /// Gets or sets the reference line intersection point in world coordinates.
- ///
- public Point2D ReferenceLineIntersectionWorldPoint { get; set; }
-
- ///
- /// Gets the 2D points describing the local geometry of the surface line.
- ///
- public RoundedPoint2DCollection LocalGeometry { get; private set; }
-
- ///
- /// Sets the geometry of the surface line.
- ///
- /// The collection of points defining the surface line geometry.
- /// Thrown when is null.
- /// Thrown when any element of is null.
- public void SetGeometry(IEnumerable points)
- {
- if (points == null)
- {
- throw new ArgumentNullException(nameof(points), Resources.MacroStabilityInwardsSurfaceLine_Collection_of_points_for_geometry_is_null);
- }
- if (points.Any(p => p == null))
- {
- throw new ArgumentException(Resources.MacroStabilityInwardsSurfaceLine_A_point_in_the_collection_was_null);
- }
- Points = points.Select(p => new Point3D(p)).ToArray();
-
- if (Points.Length > 0)
- {
- StartingWorldPoint = Points[0];
- EndingWorldPoint = Points[Points.Length - 1];
- }
-
- LocalGeometry = new RoundedPoint2DCollection(numberOfDecimalPlaces, Points.ProjectToLZ().ToArray());
- }
-
- ///
/// Sets the at the given point.
///
/// The location as a which to set as the .
@@ -409,85 +332,6 @@
}
///
- /// Gets the height of the projected at a L=.
- ///
- /// The L coordinate from where to take the height of the .
- /// The height of the at L=.
- /// Thrown when the
- /// intersection point at have a significant difference in their y coordinate.
- /// Thrown when is not in range of the LZ-projected .
- /// Thrown when is empty.
- public double GetZAtL(RoundedDouble l)
- {
- ValidateHasPoints();
-
- if (!ValidateInRange(l))
- {
- var localRangeL = new Range(LocalGeometry.First().X, LocalGeometry.Last().X);
- string outOfRangeMessage = string.Format(Resources.MacroStabilityInwardsSurfaceLine_0_L_needs_to_be_in_Range_1_,
- Resources.MacroStabilityInwardsSurfaceLine_GetZAtL_Cannot_determine_height,
- localRangeL.ToString(FormattableConstants.ShowAtLeastOneDecimal, CultureInfo.CurrentCulture));
- throw new ArgumentOutOfRangeException(null, outOfRangeMessage);
- }
-
- var segments = new Collection();
- for (var i = 1; i < LocalGeometry.Count(); i++)
- {
- segments.Add(new Segment2D(LocalGeometry.ElementAt(i - 1), LocalGeometry.ElementAt(i)));
- }
-
- IEnumerable intersectionPoints = Math2D.SegmentsIntersectionWithVerticalLine(segments, l).OrderBy(p => p.Y).ToArray();
-
- const double intersectionTolerance = 1e-2;
- bool equalIntersections = Math.Abs(intersectionPoints.First().Y - intersectionPoints.Last().Y) < intersectionTolerance;
-
- if (equalIntersections)
- {
- return intersectionPoints.First().Y;
- }
-
- string message = string.Format(Resources.MacroStabilityInwardsSurfaceLine_Cannot_determine_reliable_z_when_surface_line_is_vertical_in_l, l);
- throw new MacroStabilityInwardsSurfaceLineException(message);
- }
-
- ///
- /// Checks whether is in range of the geometry projected in local coordinate system
- /// where the points are ordered on the L-coordinate being monotonically non-decreasing.
- ///
- /// The local L-coordinate value to check for.
- /// true when local L-coordinate is in range of the local geometry. false otherwise.
- public bool ValidateInRange(double localCoordinateL)
- {
- Point2D firstLocalPoint = LocalGeometry.First();
- Point2D lastLocalPoint = LocalGeometry.Last();
- var roundedLocalCoordinateL = new RoundedDouble(numberOfDecimalPlaces, localCoordinateL);
- return !(firstLocalPoint.X > roundedLocalCoordinateL) && !(lastLocalPoint.X < roundedLocalCoordinateL);
- }
-
- ///
- /// Gets the local coordinate with rounded values based on the geometry of the surface line and the given world coordinate.
- ///
- /// The world coordinate to get the local coordinate for.
- /// The local coordinate.
- public Point2D GetLocalPointFromGeometry(Point3D worldCoordinate)
- {
- int count = Points.Length;
- if (count <= 1)
- {
- return new Point2D(double.NaN, double.NaN);
- }
-
- Point3D first = Points.First();
- Point3D last = Points.Last();
- var firstPoint = new Point2D(first.X, first.Y);
- var lastPoint = new Point2D(last.X, last.Y);
-
- Point2D localCoordinate = worldCoordinate.ProjectIntoLocalCoordinates(firstPoint, lastPoint);
- return new Point2D(new RoundedDouble(numberOfDecimalPlaces, localCoordinate.X),
- new RoundedDouble(numberOfDecimalPlaces, localCoordinate.Y));
- }
-
- ///
/// Copies the property values of the to
/// the .
///
@@ -552,11 +396,6 @@
}
}
- public override string ToString()
- {
- return Name;
- }
-
private void SetCharacteristicPoints(MacroStabilityInwardsSurfaceLine fromSurfaceLine)
{
SurfaceLevelOutside = PointFromGeometryOrNull(fromSurfaceLine.SurfaceLevelOutside);
@@ -579,29 +418,6 @@
return point3D != null ? GetPointFromGeometry(point3D) : null;
}
- ///
- /// Finds a point from which is at the same position as .
- ///
- /// The location of a point from .
- /// The from at the same location as .
- /// Thrown when 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(MacroStabilityInwardsSurfaceLine other)
{
return string.Equals(Name, other.Name)
@@ -644,17 +460,5 @@
}
return true;
}
-
- ///
- /// Checks whether the current collection is not empty.
- ///
- /// Thrown when is empty.
- private void ValidateHasPoints()
- {
- if (!Points.Any())
- {
- throw new InvalidOperationException(Resources.MacroStabilityInwardsSurfaceLine_SurfaceLine_has_no_Geometry);
- }
- }
}
}
\ No newline at end of file
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Properties/Resources.Designer.cs
===================================================================
diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -r620846e4cf00b13e9310c931d29bac47799a81d8
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 620846e4cf00b13e9310c931d29bac47799a81d8)
@@ -98,70 +98,5 @@
return ResourceManager.GetString("MacroStabilityInwardsSoilProfile_Layers_Layer_top_below_profile_bottom", resourceCulture);
}
}
-
- ///
- /// Looks up a localized string similar to {0} De lokale coördinaat moet in het bereik {1} liggen..
- ///
- public static string MacroStabilityInwardsSurfaceLine_0_L_needs_to_be_in_Range_1_ {
- get {
- return ResourceManager.GetString("MacroStabilityInwardsSurfaceLine_0_L_needs_to_be_in_Range_1_", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Een punt in de geometrie voor de profielschematisatie heeft geen waarde..
- ///
- public static string MacroStabilityInwardsSurfaceLine_A_point_in_the_collection_was_null {
- get {
- return ResourceManager.GetString("MacroStabilityInwardsSurfaceLine_A_point_in_the_collection_was_null", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Kan geen hoogte bepalen op het punt met de lokale coördinaat {0}, omdat de profielschematisatie verticaal loopt op dat punt..
- ///
- public static string MacroStabilityInwardsSurfaceLine_Cannot_determine_reliable_z_when_surface_line_is_vertical_in_l {
- get {
- return ResourceManager.GetString("MacroStabilityInwardsSurfaceLine_Cannot_determine_reliable_z_when_surface_line_is" +
- "_vertical_in_l", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to De geometrie die opgegeven werd voor de profielschematisatie heeft geen waarde..
- ///
- public static string MacroStabilityInwardsSurfaceLine_Collection_of_points_for_geometry_is_null {
- get {
- return ResourceManager.GetString("MacroStabilityInwardsSurfaceLine_Collection_of_points_for_geometry_is_null", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Kan geen hoogte bepalen..
- ///
- public static string MacroStabilityInwardsSurfaceLine_GetZAtL_Cannot_determine_height {
- get {
- return ResourceManager.GetString("MacroStabilityInwardsSurfaceLine_GetZAtL_Cannot_determine_height", resourceCulture);
- }
- }
-
- ///
- /// 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 De profielschematisatie heeft geen geometrie..
- ///
- public static string MacroStabilityInwardsSurfaceLine_SurfaceLine_has_no_Geometry {
- get {
- return ResourceManager.GetString("MacroStabilityInwardsSurfaceLine_SurfaceLine_has_no_Geometry", resourceCulture);
- }
- }
}
}
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Properties/Resources.resx
===================================================================
diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -r620846e4cf00b13e9310c931d29bac47799a81d8
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Properties/Resources.resx (.../Resources.resx) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Properties/Resources.resx (.../Resources.resx) (revision 620846e4cf00b13e9310c931d29bac47799a81d8)
@@ -120,28 +120,7 @@
Geen lagen gevonden voor de ondergrondschematisatie.
-
- Kan geen hoogte bepalen op het punt met de lokale coördinaat {0}, omdat de profielschematisatie verticaal loopt op dat punt.
-
-
- Een punt in de geometrie voor de profielschematisatie heeft geen waarde.
-
-
- De geometrie die opgegeven werd voor de profielschematisatie heeft geen waarde.
-
-
- {0} De lokale coördinaat moet in het bereik {1} liggen.
-
-
- De profielschematisatie heeft geen geometrie.
-
-
- Kan geen hoogte bepalen.
-
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/Ringtoets.MacroStabilityInwards.Primitives.csproj
===================================================================
diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -r620846e4cf00b13e9310c931d29bac47799a81d8
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Ringtoets.MacroStabilityInwards.Primitives.csproj (.../Ringtoets.MacroStabilityInwards.Primitives.csproj) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Ringtoets.MacroStabilityInwards.Primitives.csproj (.../Ringtoets.MacroStabilityInwards.Primitives.csproj) (revision 620846e4cf00b13e9310c931d29bac47799a81d8)
@@ -42,7 +42,6 @@
Properties\GlobalAssembly.cs
-
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj
===================================================================
diff -u -r650fc7b43cb6729baee51d079f0377df8d7a3de9 -r620846e4cf00b13e9310c931d29bac47799a81d8
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision 650fc7b43cb6729baee51d079f0377df8d7a3de9)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test/Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj (.../Ringtoets.MacroStabilityInwards.KernelWrapper.Test.csproj) (revision 620846e4cf00b13e9310c931d29bac47799a81d8)
@@ -67,6 +67,10 @@
{D749EE4C-CE50-4C17-BF01-9A953028C126}Core.Common.TestUtil
+
+ {d4200f43-3f72-4f42-af0a-8ced416a38ec}
+ Ringtoets.Common.Data
+ {3c0d3b38-a9f7-4b22-9705-513da26ae2cc}Ringtoets.MacroStabilityInwards.KernelWrapper
Fisheye: Tag 620846e4cf00b13e9310c931d29bac47799a81d8 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/Exceptions/MacroStabilityInwardsSurfaceLineExceptionTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSurfaceLineTest.cs
===================================================================
diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -r620846e4cf00b13e9310c931d29bac47799a81d8
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSurfaceLineTest.cs (.../MacroStabilityInwardsSurfaceLineTest.cs) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/MacroStabilityInwardsSurfaceLineTest.cs (.../MacroStabilityInwardsSurfaceLineTest.cs) (revision 620846e4cf00b13e9310c931d29bac47799a81d8)
@@ -28,7 +28,7 @@
using Core.Common.TestUtil;
using Core.Common.Utils;
using NUnit.Framework;
-using Ringtoets.MacroStabilityInwards.Primitives.Exceptions;
+using Ringtoets.Common.Data.Exceptions;
namespace Ringtoets.MacroStabilityInwards.Primitives.Test
{
@@ -223,7 +223,7 @@
}
[Test]
- public void GetZAtL_SurfaceLineVerticalAtL_ThrowsMacroStabilityInwardsSurfaceLineException()
+ public void GetZAtL_SurfaceLineVerticalAtL_ThrowsMechanismSurfaceLineException()
{
// Setup
double testZ = new Random(22).NextDouble();
@@ -242,7 +242,7 @@
TestDelegate test = () => surfaceLine.GetZAtL(l);
// Assert
- var exception = Assert.Throws(test);
+ var exception = Assert.Throws(test);
string message = $"Kan geen hoogte bepalen op het punt met de lokale coördinaat {l}, omdat de profielschematisatie verticaal loopt op dat punt.";
Assert.AreEqual(message, exception.Message);
}
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/Ringtoets.MacroStabilityInwards.Primitives.Test.csproj
===================================================================
diff -u -rcd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213 -r620846e4cf00b13e9310c931d29bac47799a81d8
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/Ringtoets.MacroStabilityInwards.Primitives.Test.csproj (.../Ringtoets.MacroStabilityInwards.Primitives.Test.csproj) (revision cd90ebf744fb74f0d4b0dd6ee06f9c39b5faf213)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/Ringtoets.MacroStabilityInwards.Primitives.Test.csproj (.../Ringtoets.MacroStabilityInwards.Primitives.Test.csproj) (revision 620846e4cf00b13e9310c931d29bac47799a81d8)
@@ -53,7 +53,6 @@
Properties\GlobalAssembly.cs
-
Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSurfaceLine.cs
===================================================================
diff -u -rfc7fef209ce94b913bf4bfb974abd71242b4769d -r620846e4cf00b13e9310c931d29bac47799a81d8
--- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSurfaceLine.cs (.../PipingSurfaceLine.cs) (revision fc7fef209ce94b913bf4bfb974abd71242b4769d)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSurfaceLine.cs (.../PipingSurfaceLine.cs) (revision 620846e4cf00b13e9310c931d29bac47799a81d8)
@@ -228,11 +228,6 @@
}
}
- public override string ToString()
- {
- return Name;
- }
-
private void SetCharacteristicPoints(PipingSurfaceLine fromSurfaceLine)
{
if (fromSurfaceLine.BottomDitchDikeSide != null)