Index: Core/Common/src/Core.Common.Base/Geometry/Math2D.cs
===================================================================
diff -u -r01f52f7e7b49e5353c0fe2583ad9d906a047c5b5 -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Core/Common/src/Core.Common.Base/Geometry/Math2D.cs (.../Math2D.cs) (revision 01f52f7e7b49e5353c0fe2583ad9d906a047c5b5)
+++ Core/Common/src/Core.Common.Base/Geometry/Math2D.cs (.../Math2D.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -137,12 +137,12 @@
///
/// Determines the intersection points between multiple segments.
///
- /// A of .
- /// Another of which may or may not intersect with the from .
- /// A of intersection points.
+ /// A of .
+ /// Another of which may or may not intersect with the from .
+ /// A of intersection points.
public static IEnumerable SegmentsIntersectionsWithSegments(IEnumerable segments, IEnumerable segmentsToCompare)
{
- return segments.SelectMany(segment => segmentsToCompare, SingleSegmentIntersectionWithSingleSegment).Where(intersection => intersection != null).Distinct().ToList();
+ return segments.SelectMany(segment => segmentsToCompare, SegmentIntersectionWithSegment).Where(intersection => intersection != null).Distinct().ToList();
}
///
@@ -151,7 +151,7 @@
/// A segment.
/// Another segment which may or may not intersect with the from .
/// A intersection point, or null when there is no intersection.
- public static Point2D SingleSegmentIntersectionWithSingleSegment(Segment2D segment1, Segment2D segment2)
+ public static Point2D SegmentIntersectionWithSegment(Segment2D segment1, Segment2D segment2)
{
if (AreEqualPoints(segment1.FirstPoint, segment1.SecondPoint))
{
@@ -162,19 +162,7 @@
return segment1.SecondPoint;
}
- double intersectionPoint;
- var intersects = Intersects(segment1.FirstPoint, segment1.SecondPoint, segment2.FirstPoint, segment2.SecondPoint, out intersectionPoint);
-
- if (!intersects)
- {
- return null;
- }
-
- return new Point2D
- (
- segment1.FirstPoint.X + intersectionPoint*(segment1.SecondPoint.X - segment1.FirstPoint.X),
- segment1.FirstPoint.Y + intersectionPoint*(segment1.SecondPoint.Y - segment1.FirstPoint.Y)
- );
+ return GetIntersectionPoint(segment1, segment2);
}
///
@@ -216,24 +204,6 @@
}
///
- /// Creates an enumerator that converts a sequence of line points to a sequence of line segments.
- ///
- /// The points to convert.
- /// A sequence of N elements, where N is the number of elements in
- /// - 1, or 0 if only has one or no elements.
- public static IEnumerable Convert3DPointsToLineSegments(IEnumerable linePoints)
- {
- var points = new Collection();
-
- foreach (var point in linePoints)
- {
- points.Add(Convert3DPointTo2DPoint(point));
- }
-
- return ConvertLinePointsToLineSegments(points);
- }
-
- ///
/// Calculates the length of a line defined as a collection of .
///
/// The points that make up a 2D line.
@@ -255,28 +225,30 @@
return length;
}
- private static Point2D Convert3DPointTo2DPoint(Point3D point)
+ private static Point2D GetIntersectionPoint(Segment2D segment1, Segment2D segment2)
{
- return new Point2D(point.X, point.Y);
- }
+ var aLine = (segment1.FirstPoint.Y - segment2.FirstPoint.Y)*(segment2.SecondPoint.X - segment2.FirstPoint.X) - (segment1.FirstPoint.X - segment2.FirstPoint.X)*(segment2.SecondPoint.Y - segment2.FirstPoint.Y);
+ var bLine = (segment1.SecondPoint.X - segment1.FirstPoint.X)*(segment2.SecondPoint.Y - segment2.FirstPoint.Y) - (segment1.SecondPoint.Y - segment1.FirstPoint.Y)*(segment2.SecondPoint.X - segment2.FirstPoint.X);
- private static bool Intersects(Point2D point1, Point2D point2, Point2D point3, Point2D point4, out double result)
- {
- var aLine = (point1.Y - point3.Y)*(point4.X - point3.X) - (point1.X - point3.X)*(point4.Y - point3.Y);
- var bLine = (point2.X - point1.X)*(point4.Y - point3.Y) - (point2.Y - point1.Y)*(point4.X - point3.X);
-
- if (Math.Abs(bLine) < epsilonForComparisons) // parallel lines so no intersection anywhere in space (in curved space, maybe, but not here in Euclidian space.)
+ if (Math.Abs(bLine) < epsilonForComparisons)
{
- result = 0;
- return false;
+ return null;
}
- result = aLine/bLine;
+ var intersectionPoint = aLine/bLine;
- aLine = (point1.Y - point3.Y)*(point2.X - point1.X) - (point1.X - point3.X)*(point2.Y - point1.Y);
- var cLine = aLine/bLine;
+ var cLine = (segment1.FirstPoint.Y - segment2.FirstPoint.Y)*(segment1.SecondPoint.X - segment1.FirstPoint.X) - (segment1.FirstPoint.X - segment2.FirstPoint.X)*(segment1.SecondPoint.Y - segment1.FirstPoint.Y);
+ var dLine = cLine/bLine;
- return ((result >= 0 && result <= 1) && cLine >= 0) && cLine <= 1;
+ if (intersectionPoint >= 0 && intersectionPoint <= 1 && dLine >= 0 && dLine <= 1)
+ {
+ return new Point2D
+ (
+ segment1.FirstPoint.X + intersectionPoint*(segment1.SecondPoint.X - segment1.FirstPoint.X),
+ segment1.FirstPoint.Y + intersectionPoint*(segment1.SecondPoint.Y - segment1.FirstPoint.Y)
+ );
+ }
+ return null;
}
private static Point2D[][] SplitLineSegmentsAtLengths(Segment2D[] lineSegments, double[] lengths)
Index: Core/Common/src/Core.Common.Base/Properties/Resources.Designer.cs
===================================================================
diff -u -rb79e419a1fcdf3d80760ea4bc35ac354525911d2 -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Core/Common/src/Core.Common.Base/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b79e419a1fcdf3d80760ea4bc35ac354525911d2)
+++ Core/Common/src/Core.Common.Base/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -152,54 +152,6 @@
}
///
- /// Looks up a localized string similar to Profielmeting {0} komt niet overeen met de huidige referentielijn en kan niet worden geïmporteerd..
- ///
- public static string PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline__0__does_not_correspond_to_current_referenceline {
- get {
- return ResourceManager.GetString("PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline__0__doe" +
- "s_not_correspond_to_current_referenceline", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Profielmeting {0} komt niet overeen met de huidige referentielijn en kan niet worden geïmporteerd. {1}.
- ///
- public static string PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline__0__does_not_correspond_to_current_referenceline__1__ {
- get {
- return ResourceManager.GetString("PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline__0__doe" +
- "s_not_correspond_to_current_referenceline__1__", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Dit kan komen doordat de profielmeting een lokaal coordinaat systeem heeft..
- ///
- public static string PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_This_could_be_caused_coordinates_being_local_coordinate_system {
- get {
- return ResourceManager.GetString("PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_This_could_be_cause" +
- "d_coordinates_being_local_coordinate_system", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to {0} Er zijn geen profielmetingen geïmporteerd..
- ///
- public static string PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_No_sections_imported {
- get {
- return ResourceManager.GetString("PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_No_sections_imported", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Er is geen referentielijn beschikbaar om profielmetingen voor te definiëren..
- ///
- public static string PipingSurfaceLinesCsvImporter_Import_Required_referenceline_missing {
- get {
- return ResourceManager.GetString("PipingSurfaceLinesCsvImporter_Import_Required_referenceline_missing", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized string similar to Project.
///
public static string Project_Constructor_Default_name {
Index: Core/Common/src/Core.Common.Base/Properties/Resources.resx
===================================================================
diff -u -rb79e419a1fcdf3d80760ea4bc35ac354525911d2 -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Core/Common/src/Core.Common.Base/Properties/Resources.resx (.../Resources.resx) (revision b79e419a1fcdf3d80760ea4bc35ac354525911d2)
+++ Core/Common/src/Core.Common.Base/Properties/Resources.resx (.../Resources.resx) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -165,19 +165,4 @@
De tekst is een getal dat te groot of te klein is om gerepresenteerd te worden.
-
- Profielmeting {0} komt niet overeen met de huidige referentielijn en kan niet worden geïmporteerd.
-
-
- Profielmeting {0} komt niet overeen met de huidige referentielijn en kan niet worden geïmporteerd. {1}
-
-
- Dit kan komen doordat de profielmeting een lokaal coordinaat systeem heeft.
-
-
- {0} Er zijn geen profielmetingen geïmporteerd.
-
-
- Er is geen referentielijn beschikbaar om profielmetingen voor te definiëren.
-
\ No newline at end of file
Index: Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs
===================================================================
diff -u -r01f52f7e7b49e5353c0fe2583ad9d906a047c5b5 -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs (.../Math2DTest.cs) (revision 01f52f7e7b49e5353c0fe2583ad9d906a047c5b5)
+++ Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs (.../Math2DTest.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -414,39 +414,12 @@
}, lineSplits[3], doubleToleranceComparer);
}
- private double[] GetLengthsBasedOnReletative(double[] relativeLengths, IEnumerable lineGeometryPoints)
- {
- var lineLength = Math2D.ConvertLinePointsToLineSegments(lineGeometryPoints).Sum(s => s.Length);
- return relativeLengths.Select(l => lineLength*l).ToArray();
- }
-
- private class Point2DComparerWithTolerance : IComparer, IComparer
- {
- private readonly double tolerance;
-
- public Point2DComparerWithTolerance(double tolerance)
- {
- this.tolerance = tolerance;
- }
-
- public int Compare(object x, object y)
- {
- return Compare(x as Point2D, y as Point2D);
- }
-
- public int Compare(Point2D p0, Point2D p1)
- {
- double diff = p0.GetEuclideanDistanceTo(p1);
- return Math.Abs(diff) < tolerance ? 0 : 1;
- }
- }
-
[Test]
[TestCaseSource("IntersectingSegments")]
public void SingleSegmentIntersectionWithSingleSegment_DifferentLineSegmentsWithIntersections_ReturnsPoint(Point2D[] points, string testname = "")
{
// Call
- var result = Math2D.SingleSegmentIntersectionWithSingleSegment(new Segment2D(points[0], points[1]), new Segment2D(points[2], points[3]));
+ var result = Math2D.SegmentIntersectionWithSegment(new Segment2D(points[0], points[1]), new Segment2D(points[2], points[3]));
// Assert
Assert.AreEqual(points[4], result);
@@ -458,7 +431,7 @@
public void SingleSegmentIntersectionWithSingleSegment_DifferentParallelLineSegments_ReturnsPointWhenConnectedOtherwiseNull(Point2D[] points, string testname = "")
{
// Call
- var result = Math2D.SingleSegmentIntersectionWithSingleSegment(new Segment2D(points[0], points[1]), new Segment2D(points[2], points[3]));
+ var result = Math2D.SegmentIntersectionWithSegment(new Segment2D(points[0], points[1]), new Segment2D(points[2], points[3]));
// Assert
if (Math2D.AreEqualPoints(points[1], points[2]))
@@ -473,10 +446,10 @@
[Test]
[TestCaseSource("NonIntersectingSegments")]
- public void SingleSegmentIntersectionWithSingleSegment_DifferentLineSegmentsWithNoIntersection_ReturnsNull(Point2D[] points)
+ public void SegmentIntersectionWithSegment_DifferentLineSegmentsWithNoIntersection_ReturnsNull(Point2D[] points)
{
// Call
- var result = Math2D.SingleSegmentIntersectionWithSingleSegment(new Segment2D(points[0], points[1]), new Segment2D(points[2], points[3]));
+ var result = Math2D.SegmentIntersectionWithSegment(new Segment2D(points[0], points[1]), new Segment2D(points[2], points[3]));
// Assert
Assert.IsNull(result);
@@ -491,7 +464,7 @@
var start = 133;
// Call
- var result = Math2D.SingleSegmentIntersectionWithSingleSegment(new Segment2D(new Point2D(start, y1), new Point2D(start + 1, y2)), new Segment2D(new Point2D(start + 0.5, 0), new Point2D(start + 0.5, 1)));
+ var result = Math2D.SegmentIntersectionWithSegment(new Segment2D(new Point2D(start, y1), new Point2D(start + 1, y2)), new Segment2D(new Point2D(start + 0.5, 0), new Point2D(start + 0.5, 1)));
// Assert
Assert.IsNull(result);
@@ -697,5 +670,32 @@
// Assert
Assert.AreEqual(expectedLength, length);
}
+
+ private double[] GetLengthsBasedOnReletative(double[] relativeLengths, IEnumerable lineGeometryPoints)
+ {
+ var lineLength = Math2D.ConvertLinePointsToLineSegments(lineGeometryPoints).Sum(s => s.Length);
+ return relativeLengths.Select(l => lineLength * l).ToArray();
+ }
+
+ private class Point2DComparerWithTolerance : IComparer, IComparer
+ {
+ private readonly double tolerance;
+
+ public Point2DComparerWithTolerance(double tolerance)
+ {
+ this.tolerance = tolerance;
+ }
+
+ public int Compare(object x, object y)
+ {
+ return Compare(x as Point2D, y as Point2D);
+ }
+
+ public int Compare(Point2D p0, Point2D p1)
+ {
+ double diff = p0.GetEuclideanDistanceTo(p1);
+ return Math.Abs(diff) < tolerance ? 0 : 1;
+ }
+ }
}
}
\ No newline at end of file
Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs
===================================================================
diff -u -r95ef650c982927603a743b7ccd4f43b45a616f56 -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs (.../AddNewDemoDikeAssessmentSectionCommand.cs) (revision 95ef650c982927603a743b7ccd4f43b45a616f56)
+++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs (.../AddNewDemoDikeAssessmentSectionCommand.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -105,7 +105,7 @@
using (var embeddedResourceFileWriter = new EmbeddedResourceFileWriter(true, "DR6_surfacelines.csv", "DR6_surfacelines.krp.csv"))
{
var surfaceLinesImporter = new PipingSurfaceLinesCsvImporter();
- var context = new RingtoetsPipingSurfaceLineContext(pipingFailureMechanism, demoAssessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(pipingFailureMechanism, demoAssessmentSection);
surfaceLinesImporter.Import(context, Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "DR6_surfacelines.csv"));
}
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/ReferenceLineContext.cs
===================================================================
diff -u -rf03b38fb7ef00a60db346246b2fb738f960841c9 -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/ReferenceLineContext.cs (.../ReferenceLineContext.cs) (revision f03b38fb7ef00a60db346246b2fb738f960841c9)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/PresentationObjects/ReferenceLineContext.cs (.../ReferenceLineContext.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -61,7 +61,7 @@
///
public AssessmentSectionBase Parent { get; private set; }
- #region Implementation: IEquatable
+ #region Equatable
private bool Equals(ReferenceLineContext other)
{
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs
===================================================================
diff -u -rb79e419a1fcdf3d80760ea4bc35ac354525911d2 -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b79e419a1fcdf3d80760ea4bc35ac354525911d2)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -88,7 +88,7 @@
}
///
- /// Looks up a localized string similar to Als u de referentielijn vervangt zullen alle vakindelingen, berekende hydraulische randvoorwaarden en berekeningsresultaten worden verwijderd.
+ /// Looks up a localized string similar to Als u de referentielijn vervangt, zullen alle vakindelingen, berekende hydraulische randvoorwaarden en berekeningsresultaten worden verwijderd.
///
///Weet u zeker dat u wilt doorgaan?.
///
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx
===================================================================
diff -u -rb79e419a1fcdf3d80760ea4bc35ac354525911d2 -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx (.../Resources.resx) (revision b79e419a1fcdf3d80760ea4bc35ac354525911d2)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx (.../Resources.resx) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -133,7 +133,7 @@
Het bestand heeft een of meerdere multi-polylijnen, welke niet ondersteund worden.
- Als u de referentielijn vervangt zullen alle vakindelingen, berekende hydraulische randvoorwaarden en berekeningsresultaten worden verwijderd.
+ Als u de referentielijn vervangt, zullen alle vakindelingen, berekende hydraulische randvoorwaarden en berekeningsresultaten worden verwijderd.
Weet u zeker dat u wilt doorgaan?
Index: Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLineImporter.cs
===================================================================
diff -u -rb79e419a1fcdf3d80760ea4bc35ac354525911d2 -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLineImporter.cs (.../ReferenceLineImporter.cs) (revision b79e419a1fcdf3d80760ea4bc35ac354525911d2)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLineImporter.cs (.../ReferenceLineImporter.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -176,7 +176,7 @@
private static ReadResult HandleCriticalFileReadError(Exception e)
{
- var errorMessage = String.Format((string) Resources.ReferenceLineImporter_HandleCriticalFileReadError_Error_0_no_referenceline_imported,
+ var errorMessage = String.Format(Resources.ReferenceLineImporter_HandleCriticalFileReadError_Error_0_no_referenceline_imported,
e.Message);
log.Error(errorMessage);
return new ReadResult(true);
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLineImporterTest.cs
===================================================================
diff -u -rb79e419a1fcdf3d80760ea4bc35ac354525911d2 -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLineImporterTest.cs (.../ReferenceLineImporterTest.cs) (revision b79e419a1fcdf3d80760ea4bc35ac354525911d2)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/ReferenceLineImporterTest.cs (.../ReferenceLineImporterTest.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -52,7 +52,7 @@
Assert.IsTrue(importSuccesful);
Assert.IsInstanceOf(assessmentSection.ReferenceLine);
Assert.AreSame(assessmentSection.ReferenceLine, referenceLineContext.WrappedData);
- Point2D[] point2Ds = Enumerable.ToArray(assessmentSection.ReferenceLine.Points);
+ Point2D[] point2Ds = assessmentSection.ReferenceLine.Points.ToArray();
Assert.AreEqual(803, point2Ds.Length);
Assert.AreEqual(193515.719, point2Ds[467].X, 1e-6);
Assert.AreEqual(511444.750, point2Ds[467].Y, 1e-6);
@@ -208,7 +208,7 @@
Assert.AreSame(assessmentSection.ReferenceLine, referenceLineContext.WrappedData);
Assert.AreEqual("Bevestigen", messageBoxTitle);
- var expectedText = "Als u de referentielijn vervangt zullen alle vakindelingen, berekende hydraulische randvoorwaarden en berekeningsresultaten worden verwijderd." + Environment.NewLine +
+ var expectedText = "Als u de referentielijn vervangt, zullen alle vakindelingen, berekende hydraulische randvoorwaarden en berekeningsresultaten worden verwijderd." + Environment.NewLine +
Environment.NewLine + "Weet u zeker dat u wilt doorgaan?";
Assert.AreEqual(expectedText, messageBoxText);
@@ -279,13 +279,13 @@
// Assert
Assert.IsTrue(importSuccesful);
Assert.AreNotSame(originalReferenceLine, assessmentSection.ReferenceLine);
- Point2D[] point2Ds = Enumerable.ToArray(assessmentSection.ReferenceLine.Points);
+ Point2D[] point2Ds = assessmentSection.ReferenceLine.Points.ToArray();
Assert.AreEqual(803, point2Ds.Length);
Assert.AreEqual(198237.375, point2Ds[123].X, 1e-6);
Assert.AreEqual(514879.781, point2Ds[123].Y, 1e-6);
Assert.AreEqual("Bevestigen", messageBoxTitle);
- var expectedText = "Als u de referentielijn vervangt zullen alle vakindelingen, berekende hydraulische randvoorwaarden en berekeningsresultaten worden verwijderd." + Environment.NewLine +
+ var expectedText = "Als u de referentielijn vervangt, zullen alle vakindelingen, berekende hydraulische randvoorwaarden en berekeningsresultaten worden verwijderd." + Environment.NewLine +
Environment.NewLine + "Weet u zeker dat u wilt doorgaan?";
Assert.AreEqual(expectedText, messageBoxText);
@@ -452,7 +452,7 @@
Assert.IsTrue(importSuccesful);
Assert.IsInstanceOf(assessmentSection.ReferenceLine);
Assert.AreSame(assessmentSection.ReferenceLine, referenceLineContext.WrappedData);
- Point2D[] point2Ds = Enumerable.ToArray(assessmentSection.ReferenceLine.Points);
+ Point2D[] point2Ds = assessmentSection.ReferenceLine.Points.ToArray();
Assert.AreEqual(803, point2Ds.Length);
Assert.AreEqual(195203.563, point2Ds[321].X, 1e-6);
Assert.AreEqual(512826.406, point2Ds[321].Y, 1e-6);
Fisheye: Tag d36a95d2e88d98b7b92ff5d091abf711d1dd31d9 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Forms/PresentationObjects/RingtoetsPipingSurfaceLineContext.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PresentationObjects/RingtoetsPipingSurfaceLinesContext.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PresentationObjects/RingtoetsPipingSurfaceLinesContext.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PresentationObjects/RingtoetsPipingSurfaceLinesContext.cs (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -0,0 +1,109 @@
+// Copyright (C) Stichting Deltares 2016. 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;
+using Ringtoets.Common.Data;
+using Ringtoets.Piping.Data;
+
+namespace Ringtoets.Piping.Forms.PresentationObjects
+{
+ ///
+ /// The presentation object for .
+ ///
+ public class RingtoetsPipingSurfaceLinesContext : IObservable
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The failure mechanism to wrap.
+ /// The assessment section.
+ /// Thrown when or is null.
+ public RingtoetsPipingSurfaceLinesContext(PipingFailureMechanism failureMechanism, AssessmentSectionBase assessmentSection)
+ {
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException("failureMechanism");
+ }
+
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException("assessmentSection");
+ }
+
+ FailureMechanism = failureMechanism;
+ AssessmentSection = assessmentSection;
+ }
+
+ public PipingFailureMechanism FailureMechanism { get; private set; }
+ public AssessmentSectionBase AssessmentSection { get; private set; }
+
+ #region IObservable
+
+ public void Attach(IObserver observer)
+ {
+ FailureMechanism.Attach(observer);
+ }
+
+ public void Detach(IObserver observer)
+ {
+ FailureMechanism.Detach(observer);
+ }
+
+ public void NotifyObservers()
+ {
+ FailureMechanism.NotifyObservers();
+ }
+
+ #endregion
+
+ #region Equatible
+
+ private bool Equals(RingtoetsPipingSurfaceLinesContext other)
+ {
+ return Equals(FailureMechanism, other.FailureMechanism);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj))
+ {
+ return false;
+ }
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+ if (obj.GetType() != GetType())
+ {
+ return false;
+ }
+ return Equals((RingtoetsPipingSurfaceLinesContext)obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return FailureMechanism.GetHashCode();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj
===================================================================
diff -u -r89d85bbdb63102cec36c46902e2a5c18e249412a -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 89d85bbdb63102cec36c46902e2a5c18e249412a)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -60,7 +60,7 @@
-
+
True
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs
===================================================================
diff -u -rb79e419a1fcdf3d80760ea4bc35ac354525911d2 -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision b79e419a1fcdf3d80760ea4bc35ac354525911d2)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -49,7 +49,7 @@
/// Id;X1;Y1;Z1;...(Xn;Yn;Zn)
/// Where Xn;Yn;Zn form the n-th 3D point describing the geometry of the surface line.
///
- public class PipingSurfaceLinesCsvImporter : FileImporterBase
+ public class PipingSurfaceLinesCsvImporter : FileImporterBase
{
private const string characteristicPointsFileSubExtension = ".krp";
private const string csvFileExtension = ".csv";
@@ -97,14 +97,14 @@
public override bool Import(object targetItem, string filePath)
{
- var targetObject = (RingtoetsPipingSurfaceLineContext) targetItem;
-
if (!IsReferenceLineAvailable(targetItem))
{
- LogCriticalFileReadError(Resources.PipingSurfaceLinesCsvImporter_Import_Required_referenceline_missing);
+ LogCriticalFileReadError(RingtoetsPluginResources.PipingSurfaceLinesCsvImporter_Import_Required_referenceline_missing);
return false;
}
+ var surfaceLinesContext = (RingtoetsPipingSurfaceLinesContext)targetItem;
+
var importSurfaceLinesResult = ReadPipingSurfaceLines(filePath);
if (importSurfaceLinesResult.CriticalErrorOccurred)
{
@@ -129,14 +129,14 @@
return false;
}
- AddImportedDataToModel(targetObject, importSurfaceLinesResult.ImportedItems, importCharacteristicPointsResult.ImportedItems);
+ AddImportedDataToModel(surfaceLinesContext, importSurfaceLinesResult.ImportedItems, importCharacteristicPointsResult.ImportedItems);
return true;
}
private static bool IsReferenceLineAvailable(object targetItem)
{
- return ((RingtoetsPipingSurfaceLineContext)targetItem).AssessmentSection.ReferenceLine != null;
+ return ((RingtoetsPipingSurfaceLinesContext)targetItem).AssessmentSection.ReferenceLine != null;
}
private ReadResult HandleCriticalReadError(Exception e)
@@ -148,12 +148,12 @@
private void LogCriticalFileReadError(string message)
{
- var errorMessage = String.Format(Resources.PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_No_sections_imported,
+ var errorMessage = String.Format(RingtoetsPluginResources.PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_No_sections_imported,
message);
log.Error(errorMessage);
}
- private void AddImportedDataToModel(RingtoetsPipingSurfaceLineContext target, ICollection readSurfaceLines, ICollection readCharacteristicPointsLocations)
+ private void AddImportedDataToModel(RingtoetsPipingSurfaceLinesContext target, ICollection readSurfaceLines, ICollection readCharacteristicPointsLocations)
{
NotifyProgress(RingtoetsPluginResources.PipingSurfaceLinesCsvImporter_Adding_imported_data_to_model, readSurfaceLines.Count, readSurfaceLines.Count);
@@ -188,7 +188,7 @@
private bool CheckReferenceLineInterSections(RingtoetsPipingSurfaceLine readSurfaceLine, ReferenceLine referenceLine)
{
- var surfaceLineSegments = Math2D.Convert3DPointsToLineSegments(readSurfaceLine.Points);
+ var surfaceLineSegments = Math2D.ConvertLinePointsToLineSegments(readSurfaceLine.Points.Select(p => new Point2D(p.X, p.Y)));
var referenceLineSegments = Math2D.ConvertLinePointsToLineSegments(referenceLine.Points);
var intersections = Math2D.SegmentsIntersectionsWithSegments(referenceLineSegments, surfaceLineSegments).ToList();
@@ -200,13 +200,13 @@
if (intersections.Count == 0)
{
- log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline__0__does_not_correspond_to_current_referenceline__1__,
+ log.ErrorFormat(RingtoetsPluginResources.PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline_0_does_not_correspond_to_current_referenceline_1_,
readSurfaceLine.Name,
- Resources.PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_This_could_be_caused_coordinates_being_local_coordinate_system);
+ RingtoetsPluginResources.PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_This_could_be_caused_coordinates_being_local_coordinate_system);
}
else if (intersections.Count > 1)
{
- log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline__0__does_not_correspond_to_current_referenceline, readSurfaceLine.Name);
+ log.ErrorFormat(RingtoetsPluginResources.PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline_0_does_not_correspond_to_current_referenceline, readSurfaceLine.Name);
}
return false;
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs
===================================================================
diff -u -r39acd9de68e455ba8877ee8657bb54697be8b289 -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision 39acd9de68e455ba8877ee8657bb54697be8b289)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingGuiPlugin.cs (.../PipingGuiPlugin.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -137,7 +137,7 @@
.Build()
};
- yield return new TreeNodeInfo
+ yield return new TreeNodeInfo
{
Text = ringtoetsPipingSurfaceLine => PipingFormsResources.PipingSurfaceLinesCollection_DisplayName,
Image = ringtoetsPipingSurfaceLine => PipingFormsResources.FolderIcon,
@@ -417,7 +417,7 @@
return new ArrayList
{
new FailureMechanismSectionsContext(failureMechanism, assessmentSection),
- new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection),
+ new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection),
failureMechanism.SoilProfiles
};
}
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Properties/Resources.Designer.cs
===================================================================
diff -u -rc07cd8fac9f24f2271687838d7bcbb93b6f2fcdb -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c07cd8fac9f24f2271687838d7bcbb93b6f2fcdb)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
+// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -186,6 +186,36 @@
}
///
+ /// Looks up a localized string similar to Profielmeting {0} doorkruist de huidige referentielijn niet of op meer dan 1 punt en kan niet worden geïmporteerd..
+ ///
+ public static string PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline_0_does_not_correspond_to_current_referenceline {
+ get {
+ return ResourceManager.GetString("PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline_0_does_" +
+ "not_correspond_to_current_referenceline", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Profielmeting {0} doorkruist de huidige referentielijn niet of op meer dan 1 punt en kan niet worden geïmporteerd. {1}.
+ ///
+ public static string PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline_0_does_not_correspond_to_current_referenceline_1_ {
+ get {
+ return ResourceManager.GetString("PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline_0_does_" +
+ "not_correspond_to_current_referenceline_1_", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Dit kan komen doordat de profielmeting een lokaal coordinaat systeem heeft..
+ ///
+ public static string PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_This_could_be_caused_coordinates_being_local_coordinate_system {
+ get {
+ return ResourceManager.GetString("PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_This_could_be_cause" +
+ "d_coordinates_being_local_coordinate_system", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to {0}
///Het bestand wordt overgeslagen..
///
@@ -196,6 +226,15 @@
}
///
+ /// Looks up a localized string similar to {0} Er zijn geen profielmetingen geïmporteerd..
+ ///
+ public static string PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_No_sections_imported {
+ get {
+ return ResourceManager.GetString("PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_No_sections_imported", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Profielmetingen importeren afgebroken. Geen data ingelezen..
///
public static string PipingSurfaceLinesCsvImporter_Import_Import_cancelled {
@@ -215,6 +254,15 @@
}
///
+ /// Looks up a localized string similar to Er is geen referentielijn beschikbaar om profielmetingen voor te definiëren..
+ ///
+ public static string PipingSurfaceLinesCsvImporter_Import_Required_referenceline_missing {
+ get {
+ return ResourceManager.GetString("PipingSurfaceLinesCsvImporter_Import_Required_referenceline_missing", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Inlezen '{0}'.
///
public static string PipingSurfaceLinesCsvImporter_Read_PipingCharacteristicPoints_0_ {
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Properties/Resources.resx
===================================================================
diff -u -rc07cd8fac9f24f2271687838d7bcbb93b6f2fcdb -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Properties/Resources.resx (.../Resources.resx) (revision c07cd8fac9f24f2271687838d7bcbb93b6f2fcdb)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/Properties/Resources.resx (.../Resources.resx) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -191,4 +191,19 @@
Meerdere definities gevonden voor profielmeting '{0}'. Alleen de eerste definitie wordt geïmporteerd.
+
+ Profielmeting {0} doorkruist de huidige referentielijn niet of op meer dan 1 punt en kan niet worden geïmporteerd.
+
+
+ Profielmeting {0} doorkruist de huidige referentielijn niet of op meer dan 1 punt en kan niet worden geïmporteerd. {1}
+
+
+ Dit kan komen doordat de profielmeting een lokaal coordinaat systeem heeft.
+
+
+ {0} Er zijn geen profielmetingen geïmporteerd.
+
+
+ Er is geen referentielijn beschikbaar om profielmetingen voor te definiëren.
+
\ No newline at end of file
Fisheye: Tag d36a95d2e88d98b7b92ff5d091abf711d1dd31d9 refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/RingtoetsPipingSurfaceLineContextTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/RingtoetsPipingSurfaceLinesContextTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/RingtoetsPipingSurfaceLinesContextTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PresentationObjects/RingtoetsPipingSurfaceLinesContextTest.cs (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -0,0 +1,215 @@
+using System;
+using Core.Common.Base;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Forms.PresentationObjects;
+
+namespace Ringtoets.Piping.Forms.Test.PresentationObjects
+{
+ [TestFixture]
+ public class RingtoetsPipingSurfaceLinesContextTest
+ {
+ [Test]
+ public void ParameteredConstructor_DefaultValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var failureMechanism = new PipingFailureMechanism();
+ var assessmentSection = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ // Call
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
+
+ // Assert
+ Assert.IsInstanceOf(context);
+ Assert.AreSame(failureMechanism, context.FailureMechanism);
+ Assert.AreSame(assessmentSection, context.AssessmentSection);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ParameteredConstructor_FailureMechanismNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new RingtoetsPipingSurfaceLinesContext(null, assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ParameteredConstructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new PipingFailureMechanism();
+
+ // Call
+ TestDelegate test = () => new RingtoetsPipingSurfaceLinesContext(failureMechanism, null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
+ public void NotifyObservers_ObserverAttached_NotifyObserver()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.StrictMock();
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism();
+
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
+
+ context.Attach(observer);
+
+ // Call
+ context.NotifyObservers();
+
+ // Assert
+ mocks.VerifyAll(); // Expect attach and notify observers on failure mechanism
+ }
+
+ [Test]
+ public void NotifyObservers_ObserverDetached_NoCallsOnObserver()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.StrictMock();
+ var observer = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var failureMechanism = new PipingFailureMechanism();
+
+ var presentationObject = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
+
+ // Call
+ presentationObject.Detach(observer);
+
+ // Assert
+ mocks.VerifyAll(); // Expect detach from failure mechanism
+ }
+
+ [Test]
+ public void Equals_ToItself_ReturnTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.StrictMock();
+ var failureMechanism = new PipingFailureMechanism();
+ mocks.ReplayAll();
+
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
+
+ // Call
+ bool isEqual = context.Equals(context);
+
+ // Assert
+ Assert.IsTrue(isEqual);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Equals_ToNull_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.StrictMock();
+ var failureMechanism = new PipingFailureMechanism();
+ mocks.ReplayAll();
+
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
+ // Call
+ bool isEqual = context.Equals(null);
+
+ // Assert
+ Assert.IsFalse(isEqual);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Equals_ToEqualOtherInstance_ReturnTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.StrictMock();
+ var failureMechanism = new PipingFailureMechanism();
+ mocks.ReplayAll();
+
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
+
+ var otherContext = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
+
+ // Call
+ bool isEqual = context.Equals(otherContext);
+ bool isEqual2 = otherContext.Equals(context);
+
+ // Assert
+ Assert.IsTrue(isEqual);
+ Assert.IsTrue(isEqual2);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Equals_ToInequalOtherInstance_ReturnFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.StrictMock();
+ var failureMechanism = new PipingFailureMechanism();
+ var otherFailureMechanism = new PipingFailureMechanism();
+ mocks.ReplayAll();
+
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
+
+ var otherContext = new RingtoetsPipingSurfaceLinesContext(otherFailureMechanism, assessmentSection);
+
+ // Call
+ bool isEqual = context.Equals(otherContext);
+ bool isEqual2 = otherContext.Equals(context);
+
+ // Assert
+ Assert.IsFalse(isEqual);
+ Assert.IsFalse(isEqual2);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GetHashCode_TwoContextInstancesEqualToEachOther_ReturnIdenticalHashes()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.StrictMock();
+ var failureMechanism = new PipingFailureMechanism();
+ mocks.ReplayAll();
+
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
+
+ var otherContext = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
+ // Precondition
+ Assert.True(context.Equals(otherContext));
+
+ // Call
+ int contextHashCode = context.GetHashCode();
+ int otherContextHashCode = otherContext.GetHashCode();
+
+ // Assert
+ Assert.AreEqual(contextHashCode, otherContextHashCode);
+ mocks.VerifyAll();
+ }
+ }
+}
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj
===================================================================
diff -u -r746902d8ff996441c8d885dbea8bc605fcee8239 -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 746902d8ff996441c8d885dbea8bc605fcee8239)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -60,7 +60,7 @@
-
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs
===================================================================
diff -u -rde18e9d8a0324e9345f412eb6c1ffeed4f86f2fb -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs (.../PipingFailureMechanismTreeNodeInfoTest.cs) (revision de18e9d8a0324e9345f412eb6c1ffeed4f86f2fb)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/PipingFailureMechanismTreeNodeInfoTest.cs (.../PipingFailureMechanismTreeNodeInfoTest.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -123,7 +123,7 @@
Assert.AreSame(pipingFailureMechanism, failureMechanismSectionsContext.ParentFailureMechanism);
Assert.AreSame(assessmentSection, failureMechanismSectionsContext.ParentAssessmentSection);
- var surfaceLinesContext = (RingtoetsPipingSurfaceLineContext) inputsFolder.Contents[1];
+ var surfaceLinesContext = (RingtoetsPipingSurfaceLinesContext) inputsFolder.Contents[1];
Assert.AreSame(pipingFailureMechanism, surfaceLinesContext.FailureMechanism);
Assert.AreSame(assessmentSection, surfaceLinesContext.AssessmentSection);
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs
===================================================================
diff -u -r6a1df79cc36617a42d0016f9b7a9271020a2196e -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs (.../RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs) (revision 6a1df79cc36617a42d0016f9b7a9271020a2196e)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TreeNodeInfos/RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs (.../RingtoetsPipingSurfaceLineCollectionTreeNodeInfoTest.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -27,14 +27,14 @@
{
mocks = new MockRepository();
plugin = new PipingGuiPlugin();
- info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(RingtoetsPipingSurfaceLineContext));
+ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(RingtoetsPipingSurfaceLinesContext));
}
[Test]
public void Initialized_Always_ExpectedPropertiesSet()
{
// Assert
- Assert.AreEqual(typeof(RingtoetsPipingSurfaceLineContext), info.TagType);
+ Assert.AreEqual(typeof(RingtoetsPipingSurfaceLinesContext), info.TagType);
Assert.IsNull(info.EnsureVisibleOnCreate);
Assert.IsNull(info.CanRename);
Assert.IsNull(info.OnNodeRenamed);
@@ -55,7 +55,7 @@
// Setup
var failureMechanism = new PipingFailureMechanism();
var assessmentSection = mocks.StrictMock();
- var ringtoetsPipingSurfaceLines = mocks.StrictMock(failureMechanism, assessmentSection);
+ var ringtoetsPipingSurfaceLines = mocks.StrictMock(failureMechanism, assessmentSection);
mocks.ReplayAll();
@@ -74,7 +74,7 @@
// Setup
var failureMechanism = new PipingFailureMechanism();
var assessmentSection = mocks.StrictMock();
- var ringtoetsPipingSurfaceLines = mocks.StrictMock(failureMechanism, assessmentSection);
+ var ringtoetsPipingSurfaceLines = mocks.StrictMock(failureMechanism, assessmentSection);
mocks.ReplayAll();
@@ -93,7 +93,7 @@
// Setup
var failureMechanism = new PipingFailureMechanism();
var assessmentSection = mocks.StrictMock();
- var ringtoetsPipingSurfaceLines = mocks.StrictMock(failureMechanism, assessmentSection);
+ var ringtoetsPipingSurfaceLines = mocks.StrictMock(failureMechanism, assessmentSection);
mocks.ReplayAll();
@@ -118,7 +118,7 @@
failureMechanism.SurfaceLines.Add(ringtoetsPipingSurfaceLine1);
failureMechanism.SurfaceLines.Add(ringtoetsPipingSurfaceLine2);
- var ringtoetsPipingSurfaceLineContext = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var ringtoetsPipingSurfaceLineContext = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
mocks.ReplayAll();
@@ -143,7 +143,7 @@
failureMechanism.SurfaceLines.Add(ringtoetsPipingSurfaceLine1);
failureMechanism.SurfaceLines.Add(ringtoetsPipingSurfaceLine2);
- var ringtoetsPipingSurfaceLineContext = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var ringtoetsPipingSurfaceLineContext = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
mocks.ReplayAll();
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLinesCsvImporterTest.cs
===================================================================
diff -u -r586858a5a223713bad06da442f69b52192ee903b -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLinesCsvImporterTest.cs (.../PipingSurfaceLinesCsvImporterTest.cs) (revision 586858a5a223713bad06da442f69b52192ee903b)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLinesCsvImporterTest.cs (.../PipingSurfaceLinesCsvImporterTest.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -30,21 +30,14 @@
private readonly string krpFormat = "{0}.krp.csv";
private readonly string surfaceLineFormat = "{0}.csv";
- private ReferenceLine GetReferenceLine()
- {
- var referenceLine = new ReferenceLine();
-
- return referenceLine;
- }
-
[Test]
public void DefaultConstructor_ExpectedValues()
{
// Call
var importer = new PipingSurfaceLinesCsvImporter();
// Assert
- Assert.IsInstanceOf>(importer);
+ Assert.IsInstanceOf>(importer);
Assert.AreEqual(PipingFormsResources.PipingSurfaceLinesCollection_DisplayName, importer.Name);
Assert.AreEqual(RingtoetsFormsResources.Ringtoets_Category, importer.Category);
Assert.AreEqual(16, importer.Image.Width);
@@ -64,7 +57,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var targetContext = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var targetContext = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -86,7 +79,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var targetContext = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var targetContext = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -110,7 +103,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -149,7 +142,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -224,7 +217,7 @@
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -280,7 +273,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -326,7 +319,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -364,7 +357,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -399,7 +392,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -433,7 +426,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -469,7 +462,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -509,7 +502,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -566,7 +559,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -615,7 +608,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -666,7 +659,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -715,7 +708,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -763,7 +756,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -810,7 +803,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -848,7 +841,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -892,7 +885,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -945,7 +938,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -1017,7 +1010,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -1069,7 +1062,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -1131,7 +1124,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -1187,7 +1180,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -1251,7 +1244,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -1319,7 +1312,7 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -1412,9 +1405,9 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var mesagge = "Profielmeting ArtifcialLocal komt niet overeen met de huidige referentielijn en kan niet worden geïmporteerd. Dit kan komen doordat de profielmeting een lokaal coordinaat systeem heeft.";
+ var mesagge = "Profielmeting ArtifcialLocal doorkruist de huidige referentielijn niet of op meer dan 1 punt en kan niet worden geïmporteerd. Dit kan komen doordat de profielmeting een lokaal coordinaat systeem heeft.";
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
@@ -1469,9 +1462,9 @@
var failureMechanism = new PipingFailureMechanism();
mocks.ReplayAll();
- var mesagge = "Profielmeting Rotterdam1 komt niet overeen met de huidige referentielijn en kan niet worden geïmporteerd.";
+ var mesagge = "Profielmeting Rotterdam1 doorkruist de huidige referentielijn niet of op meer dan 1 punt en kan niet worden geïmporteerd.";
- var context = new RingtoetsPipingSurfaceLineContext(failureMechanism, assessmentSection);
+ var context = new RingtoetsPipingSurfaceLinesContext(failureMechanism, assessmentSection);
context.Attach(observer);
var importer = new PipingSurfaceLinesCsvImporter();
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs
===================================================================
diff -u -r89d85bbdb63102cec36c46902e2a5c18e249412a -rd36a95d2e88d98b7b92ff5d091abf711d1dd31d9
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision 89d85bbdb63102cec36c46902e2a5c18e249412a)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/PipingGuiPluginTest.cs (.../PipingGuiPluginTest.cs) (revision d36a95d2e88d98b7b92ff5d091abf711d1dd31d9)
@@ -121,7 +121,7 @@
// assert
Assert.AreEqual(11, treeNodeInfos.Length);
- Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(RingtoetsPipingSurfaceLineContext)));
+ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(RingtoetsPipingSurfaceLinesContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(RingtoetsPipingSurfaceLine)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(IEnumerable)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingSoilProfile)));