Index: Core/Common/src/Core.Common.Base/Core.Common.Base.csproj =================================================================== diff -u -r365f33fe0130eac94cacb979165488d9ae124f3c -r7b8a021f38d77546b7c3318f5f0dedda63168f91 --- Core/Common/src/Core.Common.Base/Core.Common.Base.csproj (.../Core.Common.Base.csproj) (revision 365f33fe0130eac94cacb979165488d9ae124f3c) +++ Core/Common/src/Core.Common.Base/Core.Common.Base.csproj (.../Core.Common.Base.csproj) (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -102,6 +102,7 @@ + Index: Core/Common/src/Core.Common.Base/Geometry/Math2D.cs =================================================================== diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r7b8a021f38d77546b7c3318f5f0dedda63168f91 --- Core/Common/src/Core.Common.Base/Geometry/Math2D.cs (.../Math2D.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a) +++ Core/Common/src/Core.Common.Base/Geometry/Math2D.cs (.../Math2D.cs) (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -321,6 +321,30 @@ } /// + /// Gets the angle between a horizontal line and a line running + /// from and + /// + /// The starting point of the line. + /// The end point of the line. + /// The calculated angle in degrees. + /// Thrown when + /// or is null. + public static double GetAngleBetween(Point2D pointA, Point2D pointB) + { + if (pointA == null) + { + throw new ArgumentNullException(nameof(pointA)); + } + if (pointB == null) + { + throw new ArgumentNullException(nameof(pointB)); + } + + return Math.Atan2(pointB.Y - pointA.Y, + pointB.X - pointA.X) * (180 / Math.PI); + } + + /// /// Determines if two parallel vectors are collinear. /// /// The first 2D vector. Fisheye: Tag 365f33fe0130eac94cacb979165488d9ae124f3c refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Base/Geometry/Segment2DCollectionExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/src/Core.Common.Base/Geometry/Segment2DExtensions.cs =================================================================== diff -u -r365f33fe0130eac94cacb979165488d9ae124f3c -r7b8a021f38d77546b7c3318f5f0dedda63168f91 --- Core/Common/src/Core.Common.Base/Geometry/Segment2DExtensions.cs (.../Segment2DExtensions.cs) (revision 365f33fe0130eac94cacb979165488d9ae124f3c) +++ Core/Common/src/Core.Common.Base/Geometry/Segment2DExtensions.cs (.../Segment2DExtensions.cs) (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -20,8 +20,6 @@ // All rights reserved. using System; -using System.Collections.Generic; -using System.Linq; namespace Core.Common.Base.Geometry { @@ -31,28 +29,8 @@ public static class Segment2DExtensions { /// - /// Interpolates the segments on . + /// Interpolate the segment on . /// - /// The segments to interpolate on. - /// The x value to use for interpolation. - /// The interpolated y value of the segment that is closest to - /// or when no interpolation was found. - /// Thrown when is null. - public static double Interpolate(this IEnumerable segments, double x) - { - if (segments == null) - { - throw new ArgumentNullException(nameof(segments)); - } - - Segment2D segment = segments.LastOrDefault(s => s.FirstPoint.X <= x) ?? segments.First(); - - return segment.Interpolate(x); - } - - /// - /// Interpolate the segment on - /// /// The segment to interpolate on. /// The x value to use for interpolation. /// The interpolated y value on the segment or Index: Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj =================================================================== diff -u -r365f33fe0130eac94cacb979165488d9ae124f3c -r7b8a021f38d77546b7c3318f5f0dedda63168f91 --- Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj (.../Core.Common.Base.Test.csproj) (revision 365f33fe0130eac94cacb979165488d9ae124f3c) +++ Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj (.../Core.Common.Base.Test.csproj) (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -93,6 +93,7 @@ + Index: Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs =================================================================== diff -u -r354316fca628a0f9dcdee5ff156ae4d87e662677 -r7b8a021f38d77546b7c3318f5f0dedda63168f91 --- Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs (.../Math2DTest.cs) (revision 354316fca628a0f9dcdee5ff156ae4d87e662677) +++ Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs (.../Math2DTest.cs) (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -1204,6 +1204,44 @@ "Fraction needs to be defined in range [0.0, 1.0] in order to reliably interpolate."); } + [Test] + public void GetAngleBetween_PointANull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => Math2D.GetAngleBetween(null, new Point2D(0.0, 0.0)); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("pointA", paramName); + } + + [Test] + public void GetAngleBetween_PointBNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => Math2D.GetAngleBetween(null, new Point2D(0.0, 0.0)); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("pointA", paramName); + } + + [Test] + [TestCase(0, 0, 10, 10, 45)] + [TestCase(0, 0, -10, 0, 180)] + [TestCase(0, 5, 0, 10, 90)] + [TestCase(0, 0, 0, 0, 0)] + public void GetAngleBetween_WithValidPoints_ReturnsExpectedAngle(double x1, double y1, + double x2, double y2, + double expectedAngle) + { + // Call + double angle = Math2D.GetAngleBetween(new Point2D(x1, y1), new Point2D(x2, y2)); + + // Assert + Assert.AreEqual(expectedAngle, angle); + } + private static void CollectionAssertAreEquivalent(Point2D[] expected, ReadOnlyCollection actual) { var comparer = new Point2DComparerWithTolerance(1e-6); Fisheye: Tag 365f33fe0130eac94cacb979165488d9ae124f3c refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Base.Test/Geometry/Segment2DCollectionExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/test/Core.Common.Base.Test/Geometry/Segment2DExtensionsTest.cs =================================================================== diff -u -r365f33fe0130eac94cacb979165488d9ae124f3c -r7b8a021f38d77546b7c3318f5f0dedda63168f91 --- Core/Common/test/Core.Common.Base.Test/Geometry/Segment2DExtensionsTest.cs (.../Segment2DExtensionsTest.cs) (revision 365f33fe0130eac94cacb979165488d9ae124f3c) +++ Core/Common/test/Core.Common.Base.Test/Geometry/Segment2DExtensionsTest.cs (.../Segment2DExtensionsTest.cs) (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -19,7 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using System.Collections.Generic; using Core.Common.Base.Geometry; using NUnit.Framework; @@ -30,53 +29,6 @@ public class Segment2DExtensionsTest { [Test] - public void InterpolateOnCollection_SegmentsNull_ThrowsArgumentNullException() - { - // Call - TestDelegate test = () => ((IEnumerable) null).Interpolate(0); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("segments", exception.ParamName); - } - - [Test] - [TestCaseSource(nameof(ValidInterpolationCollection))] - public void InterpolateOnCollection_ValidArguments_ReturnsExpectedResult(IEnumerable segments, - double interpolateOnX, - double expectedY) - { - // Call - double actualY = segments.Interpolate(interpolateOnX); - - // Assert - Assert.AreEqual(expectedY, actualY); - } - - [Test] - [TestCaseSource(nameof(InvalidInterpolationCollection))] - public void InterpolateOnCollection_InvalidArguments_ReturnsNaN(IEnumerable segments, - double interpolateOnX) - { - // Call - double actualY = segments.Interpolate(interpolateOnX); - - // Assert - Assert.IsNaN(actualY); - } - - [Test] - public void Interpolate_SegmentsNull_ThrowsArgumentNullException() - { - // Call - TestDelegate test = () => ((Segment2D) null).Interpolate(0); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("segment", exception.ParamName); - } - - [Test] [TestCaseSource(nameof(ValidInterpolationSegment))] public void Interpolate_ValidArguments_ReturnsExpectedResult(Segment2D segment, double interpolateOnX, @@ -170,84 +122,5 @@ new Point2D(double.NaN, double.NaN)), 20).SetName("NaN"); } - - private static IEnumerable ValidInterpolationCollection() - { - yield return new TestCaseData(new[] - { - new Segment2D(new Point2D(-1000, 0), new Point2D(1, 1)), - new Segment2D(new Point2D(1, 1), new Point2D(10, 10)), - new Segment2D(new Point2D(100, 100), new Point2D(1000, 10)) - }, 20, 20).SetName("Slope = 1, b = 0 with other segments"); - - yield return new TestCaseData(new[] - { - new Segment2D(new Point2D(0, 10), new Point2D(10, 100)) - }, 0, 10).SetName("Same as first point that passed through origin"); - - yield return new TestCaseData(new[] - { - new Segment2D(new Point2D(0, 10), new Point2D(10, 100)) - }, -10, -80).SetName("Left of first point"); - - yield return new TestCaseData(new[] - { - new Segment2D(new Point2D(1, 10), new Point2D(10, 100)) - }, 1, 10).SetName("Same as first point"); - - yield return new TestCaseData(new[] - { - new Segment2D(new Point2D(1, 10), new Point2D(10, 100)) - }, 10, 100).SetName("Same as second point"); - - yield return new TestCaseData(new[] - { - new Segment2D(new Point2D(0, 10), new Point2D(10, 10)), - new Segment2D(new Point2D(10, 10), new Point2D(20, 100)) - }, 30, 190).SetName("Right of last point"); - - yield return new TestCaseData(new[] - { - new Segment2D(new Point2D(1, 1), new Point2D(10, 10)) - }, 5, 5).SetName("Slope = 1, b = 0"); - - yield return new TestCaseData(new[] - { - new Segment2D(new Point2D(0, 0), new Point2D(10, 1000)) - }, 5, 500).SetName("Slope = 100, b = 0"); - - yield return new TestCaseData(new[] - { - new Segment2D(new Point2D(0, 0), new Point2D(-5, -9)) - }, 5, (9.0 / 5.0) * 5).SetName("Slope = 9/5, b = 0"); - - yield return new TestCaseData(new[] - { - new Segment2D(new Point2D(5, 2), new Point2D(90, 3)) - }, 50, ((1 / 85.0) * 50) + (33 / 17.0)).SetName("Slope = 1/85, b = 33/17"); - } - - private static IEnumerable InvalidInterpolationCollection() - { - yield return new TestCaseData(new[] - { - new Segment2D(new Point2D(0, 10), new Point2D(0, 10)) - }, 0).SetName("Vertical line"); - - yield return new TestCaseData(new[] - { - new Segment2D(new Point2D(0, 0), new Point2D(double.PositiveInfinity, double.PositiveInfinity)) - }, 20).SetName("PositiveInfinity"); - - yield return new TestCaseData(new[] - { - new Segment2D(new Point2D(0, 0), new Point2D(double.NegativeInfinity, double.NegativeInfinity)) - }, 20).SetName("NegativeInfinity"); - - yield return new TestCaseData(new[] - { - new Segment2D(new Point2D(0, 0), new Point2D(double.NaN, double.NaN)) - }, 20).SetName("NaN"); - } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsSlice.cs =================================================================== diff -u -r365f33fe0130eac94cacb979165488d9ae124f3c -r7b8a021f38d77546b7c3318f5f0dedda63168f91 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsSlice.cs (.../MacroStabilityInwardsSlice.cs) (revision 365f33fe0130eac94cacb979165488d9ae124f3c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsSlice.cs (.../MacroStabilityInwardsSlice.cs) (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using Core.Common.Base.Data; using Core.Common.Base.Geometry; namespace Ringtoets.MacroStabilityInwards.Data @@ -69,36 +70,43 @@ BottomLeftPoint = bottomLeftPoint; BottomRightPoint = bottomRightPoint; - Cohesion = properties.Cohesion; - FrictionAngle = properties.FrictionAngle; - CriticalPressure = properties.CriticalPressure; - OverConsolidationRatio = properties.OverConsolidationRatio; - Pop = properties.Pop; - DegreeOfConsolidationPorePressureSoil = properties.DegreeOfConsolidationPorePressureSoil; - DegreeOfConsolidationPorePressureLoad = properties.DegreeOfConsolidationPorePressureLoad; - Dilatancy = properties.Dilatancy; - ExternalLoad = properties.ExternalLoad; - HydrostaticPorePressure = properties.HydrostaticPorePressure; - LeftForce = properties.LeftForce; - LeftForceAngle = properties.LeftForceAngle; - LeftForceY = properties.LeftForceY; - RightForce = properties.RightForce; - RightForceAngle = properties.RightForceAngle; - RightForceY = properties.RightForceY; - LoadStress = properties.LoadStress; - NormalStress = properties.NormalStress; - PorePressure = properties.PorePressure; - HorizontalPorePressure = properties.HorizontalPorePressure; - VerticalPorePressure = properties.VerticalPorePressure; - PiezometricPorePressure = properties.PiezometricPorePressure; - EffectiveStress = properties.EffectiveStress; - EffectiveStressDaily = properties.EffectiveStressDaily; - ExcessPorePressure = properties.ExcessPorePressure; - ShearStress = properties.ShearStress; - SoilStress = properties.SoilStress; - TotalPorePressure = properties.TotalPorePressure; - TotalStress = properties.TotalStress; - Weight = properties.Weight; + XCenter = new RoundedDouble(2, (topLeftPoint.X + topRightPoint.X) / 2.0); + ZCenterBottom = new RoundedDouble(2, new Segment2D(bottomLeftPoint, bottomRightPoint).Interpolate(XCenter)); + Width = new RoundedDouble(2, topRightPoint.X - topLeftPoint.X); + ArcLength = new RoundedDouble(2, bottomLeftPoint.GetEuclideanDistanceTo(bottomRightPoint)); + BottomAngle = new RoundedDouble(2, Math2D.GetAngleBetween(bottomLeftPoint, bottomRightPoint)); + TopAngle = new RoundedDouble(2, Math2D.GetAngleBetween(topLeftPoint, topRightPoint)); + + Cohesion = new RoundedDouble(3, properties.Cohesion); + FrictionAngle = new RoundedDouble(3, properties.FrictionAngle); + CriticalPressure = new RoundedDouble(3, properties.CriticalPressure); + OverConsolidationRatio = new RoundedDouble(3, properties.OverConsolidationRatio); + Pop = new RoundedDouble(3, properties.Pop); + DegreeOfConsolidationPorePressureSoil = new RoundedDouble(3, properties.DegreeOfConsolidationPorePressureSoil); + DegreeOfConsolidationPorePressureLoad = new RoundedDouble(3, properties.DegreeOfConsolidationPorePressureLoad); + Dilatancy = new RoundedDouble(3, properties.Dilatancy); + ExternalLoad = new RoundedDouble(3, properties.ExternalLoad); + HydrostaticPorePressure = new RoundedDouble(3, properties.HydrostaticPorePressure); + LeftForce = new RoundedDouble(3, properties.LeftForce); + LeftForceAngle = new RoundedDouble(3, properties.LeftForceAngle); + LeftForceY = new RoundedDouble(3, properties.LeftForceY); + RightForce = new RoundedDouble(3, properties.RightForce); + RightForceAngle = new RoundedDouble(3, properties.RightForceAngle); + RightForceY = new RoundedDouble(3, properties.RightForceY); + LoadStress = new RoundedDouble(3, properties.LoadStress); + NormalStress = new RoundedDouble(3, properties.NormalStress); + PorePressure = new RoundedDouble(3, properties.PorePressure); + HorizontalPorePressure = new RoundedDouble(3, properties.HorizontalPorePressure); + VerticalPorePressure = new RoundedDouble(3, properties.VerticalPorePressure); + PiezometricPorePressure = new RoundedDouble(3, properties.PiezometricPorePressure); + EffectiveStress = new RoundedDouble(3, properties.EffectiveStress); + EffectiveStressDaily = new RoundedDouble(3, properties.EffectiveStressDaily); + ExcessPorePressure = new RoundedDouble(3, properties.ExcessPorePressure); + ShearStress = new RoundedDouble(3, properties.ShearStress); + SoilStress = new RoundedDouble(3, properties.SoilStress); + TotalPorePressure = new RoundedDouble(3, properties.TotalPorePressure); + TotalStress = new RoundedDouble(3, properties.TotalStress); + Weight = new RoundedDouble(3, properties.Weight); } /// @@ -122,183 +130,219 @@ public Point2D BottomRightPoint { get; private set; } /// + /// Gets the X center point of the slice. + /// [m] + /// + public RoundedDouble XCenter { get; } + + /// + /// Gets the Z center bottom point of the slice. + /// [m+NAP] + /// + public RoundedDouble ZCenterBottom { get; } + + /// + /// Gets the width of the slice. + /// [m] + /// + public RoundedDouble Width { get; } + + /// + /// Gets the arc length of the slice. + /// [m] + /// + public RoundedDouble ArcLength { get; } + + /// + /// Gets the top angle of the slice. + /// [°] + /// + public RoundedDouble TopAngle { get; } + + /// + /// Gets the bottom angle of the slice. + /// [°] + /// + public RoundedDouble BottomAngle { get; } + + /// /// Gets the cohesion. /// [kN/m²] /// - public double Cohesion { get; } + public RoundedDouble Cohesion { get; } /// /// Gets the friction angle. /// [°] /// - public double FrictionAngle { get; } + public RoundedDouble FrictionAngle { get; } /// /// Gets the critical pressure. /// [kN/m²] /// - public double CriticalPressure { get; } + public RoundedDouble CriticalPressure { get; } /// /// Gets the OCR. /// [-] /// - public double OverConsolidationRatio { get; } + public RoundedDouble OverConsolidationRatio { get; } /// /// Gets the POP. /// [kN/m²] /// - public double Pop { get; } + public RoundedDouble Pop { get; } /// /// Gets the pore pressure from degree of consolidation soil. /// [kN/m²] /// - public double DegreeOfConsolidationPorePressureSoil { get; } + public RoundedDouble DegreeOfConsolidationPorePressureSoil { get; } /// /// Gets the pore pressure from degree of consolidation load. /// [kN/m²] /// - public double DegreeOfConsolidationPorePressureLoad { get; } + public RoundedDouble DegreeOfConsolidationPorePressureLoad { get; } /// /// Gets the dilatancy of the slice. /// - public double Dilatancy { get; } + public RoundedDouble Dilatancy { get; } /// /// Gets the external load. /// [kN/m²] /// - public double ExternalLoad { get; } + public RoundedDouble ExternalLoad { get; } /// /// Gets the hydrostatic pore pressure. /// [kN/m²] /// - public double HydrostaticPorePressure { get; } + public RoundedDouble HydrostaticPorePressure { get; } /// /// Gets the left force. /// [kN/m²] /// - public double LeftForce { get; } + public RoundedDouble LeftForce { get; } /// /// Gets the left force angle. /// [°] /// - public double LeftForceAngle { get; } + public RoundedDouble LeftForceAngle { get; } /// /// Gets the left force y. /// [kN/m²] /// - public double LeftForceY { get; } + public RoundedDouble LeftForceY { get; } /// /// Gets the right force. /// [kN/m²] /// - public double RightForce { get; } + public RoundedDouble RightForce { get; } /// /// Gets the right force angle. /// [°] /// - public double RightForceAngle { get; } + public RoundedDouble RightForceAngle { get; } /// /// Gets the right force y. /// [kN/m²] /// - public double RightForceY { get; } + public RoundedDouble RightForceY { get; } /// /// Gets the load stress. /// [kN/m²] /// - public double LoadStress { get; } + public RoundedDouble LoadStress { get; } /// /// Gets the normal stress. /// [kN/m²] /// - public double NormalStress { get; } + public RoundedDouble NormalStress { get; } /// /// Gets the pore pressure. /// [kN/m²] /// - public double PorePressure { get; } + public RoundedDouble PorePressure { get; } /// /// Gets the horizontal pore pressure. /// [kN/m²] /// - public double HorizontalPorePressure { get; } + public RoundedDouble HorizontalPorePressure { get; } /// /// Gets the vertical pore pressure. /// [kN/m²] /// - public double VerticalPorePressure { get; } + public RoundedDouble VerticalPorePressure { get; } /// /// Gets the piezometric pore pressure. /// [kN/m²] /// - public double PiezometricPorePressure { get; } + public RoundedDouble PiezometricPorePressure { get; } /// /// Gets the effective stress. /// [kN/m²] /// - public double EffectiveStress { get; } + public RoundedDouble EffectiveStress { get; } /// /// Gets the daily effective stress. /// [kN/m²] /// - public double EffectiveStressDaily { get; } + public RoundedDouble EffectiveStressDaily { get; } /// /// Gets the excess pore pressure. /// [kN/m²] /// - public double ExcessPorePressure { get; } + public RoundedDouble ExcessPorePressure { get; } /// /// Gets the shear stress. /// [kN/m²] /// - public double ShearStress { get; } + public RoundedDouble ShearStress { get; } /// /// Gets the soil stress. /// [kN/m²] /// - public double SoilStress { get; } + public RoundedDouble SoilStress { get; } /// /// Gets the total pore pressure. /// [kN/m²] /// - public double TotalPorePressure { get; } + public RoundedDouble TotalPorePressure { get; } /// /// Gets the total stress. /// [kN/m²] /// - public double TotalStress { get; } + public RoundedDouble TotalStress { get; } /// /// Gets the weight. /// [kN/m] /// - public double Weight { get; } + public RoundedDouble Weight { get; } public object Clone() { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj =================================================================== diff -u -r365f33fe0130eac94cacb979165488d9ae124f3c -r7b8a021f38d77546b7c3318f5f0dedda63168f91 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj (.../Ringtoets.MacroStabilityInwards.Forms.csproj) (revision 365f33fe0130eac94cacb979165488d9ae124f3c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj (.../Ringtoets.MacroStabilityInwards.Forms.csproj) (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -96,7 +96,7 @@ - + UserControl Fisheye: Tag 7b8a021f38d77546b7c3318f5f0dedda63168f91 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFormattedSliceRow.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsSliceRow.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsSliceRow.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsSliceRow.cs (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -0,0 +1,217 @@ +// Copyright (C) Stichting Deltares ²017. 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.Data; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Forms.Properties; + +namespace Ringtoets.MacroStabilityInwards.Forms.Views +{ + /// + /// This class represents a row of . + /// + public class MacroStabilityInwardsSliceRow + { + /// + /// Creates a new instance of . + /// + /// The to use. + /// The index of the slice. + /// Thrown when + /// is null. + public MacroStabilityInwardsSliceRow(MacroStabilityInwardsSlice slice, int index) + { + if (slice == null) + { + throw new ArgumentNullException(nameof(slice)); + } + + Name = string.Format(Resources.MacroStabilityInwardsSlicesTable_Name_Slice_0, index); + XCenter = slice.XCenter; + ZCenterBottom = slice.ZCenterBottom; + Width = slice.Width; + ArcLength = slice.ArcLength; + BottomAngle = slice.BottomAngle; + TopAngle = slice.TopAngle; + FrictionAngle = slice.FrictionAngle; + Cohesion = slice.Cohesion; + EffectiveStress = slice.EffectiveStress; + TotalPorePressure = slice.TotalPorePressure; + Weight = slice.Weight; + PiezometricPorePressure = slice.PiezometricPorePressure; + DegreeOfConsolidationPorePressureSoil = slice.DegreeOfConsolidationPorePressureSoil; + DegreeOfConsolidationPorePressureLoad = slice.DegreeOfConsolidationPorePressureLoad; + PorePressure = slice.PorePressure; + VerticalPorePressure = slice.VerticalPorePressure; + HorizontalPorePressure = slice.HorizontalPorePressure; + ExternalLoad = slice.ExternalLoad; + OverConsolidationRatio = slice.OverConsolidationRatio; + Pop = slice.Pop; + NormalStress = slice.NormalStress; + ShearStress = slice.ShearStress; + LoadStress = slice.LoadStress; + } + + /// + /// Gets the name of the slice. + /// + public string Name { get; } + + /// + /// Gets the load stress of the slice. + /// [kN/m²] + /// + public RoundedDouble LoadStress { get; } + + /// + /// Gets the shear stress of the slice. + /// [kN/m²] + /// + public RoundedDouble ShearStress { get; } + + /// + /// Gets the normal stress of the slice. + /// [kN/m²] + /// + public RoundedDouble NormalStress { get; } + + /// + /// Gets the POP of the slice. + /// [kN/m²] + /// + public RoundedDouble Pop { get; } + + /// + /// Gets the over consolidation ratio of the slice. + /// [-] + /// + public RoundedDouble OverConsolidationRatio { get; } + + /// + /// Gets the external load of the slice. + /// [kN/m²] + /// + public RoundedDouble ExternalLoad { get; } + + /// + /// Gets the horizontal pressure of the slice. + /// [kN/m²] + /// + public RoundedDouble HorizontalPorePressure { get; } + + /// + /// Gets the vertical pore pressure of the slice. + /// [kN/m²] + /// + public RoundedDouble VerticalPorePressure { get; } + + /// + /// Gets the pore pressure of the slice. + /// [kN/m²] + /// + public RoundedDouble PorePressure { get; } + + /// + /// Gets the pore pressure from degree of consolidation load of the slice. + /// [kN/m²] + /// + public RoundedDouble DegreeOfConsolidationPorePressureLoad { get; } + + /// + /// Gets the pore pressure from degree of consolidation soil of the slice. + /// [kN/m²] + /// + public RoundedDouble DegreeOfConsolidationPorePressureSoil { get; } + + /// + /// Gets the piezometric pore pressure of the slice. + /// [kN/m²] + /// + public RoundedDouble PiezometricPorePressure { get; } + + /// + /// Gets the weight of the slice. + /// [kN/m] + /// + public RoundedDouble Weight { get; } + + /// + /// Gets the total pore pressure of the slice. + /// [kN/m²] + /// + public RoundedDouble TotalPorePressure { get; } + + /// + /// Gets the X center point of the slice. + /// [m] + /// + public RoundedDouble XCenter { get; } + + /// + /// Gets the Z center bottom point of the slice. + /// [m+NAP] + /// + public RoundedDouble ZCenterBottom { get; } + + /// + /// Gets the width of the slice. + /// [m] + /// + public RoundedDouble Width { get; } + + /// + /// Gets the arc length of the slice. + /// [m] + /// + public RoundedDouble ArcLength { get; } + + /// + /// Gets the top angle of the slice. + /// [°] + /// + public RoundedDouble TopAngle { get; } + + /// + /// Gets the bottom angle of the slice. + /// [°] + /// + public RoundedDouble BottomAngle { get; } + + /// + /// Gets the friction angle of the slice. + /// [°] + /// + public RoundedDouble FrictionAngle { get; } + + /// + /// Gets the cohesion of the slice. + /// [kN/m²] + /// + public RoundedDouble Cohesion { get; } + + /// + /// Gets the effective stress of the slice. + /// [kN/m²] + /// + public RoundedDouble EffectiveStress { get; } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsSlicesTable.cs =================================================================== diff -u -r365f33fe0130eac94cacb979165488d9ae124f3c -r7b8a021f38d77546b7c3318f5f0dedda63168f91 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsSlicesTable.cs (.../MacroStabilityInwardsSlicesTable.cs) (revision 365f33fe0130eac94cacb979165488d9ae124f3c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsSlicesTable.cs (.../MacroStabilityInwardsSlicesTable.cs) (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -48,81 +48,81 @@ /// The collection of slices to show. public void SetData(IEnumerable slices) { - SetDataSource(slices?.Select((data, index) => new MacroStabilityInwardsFormattedSliceRow(data, index + 1)).ToArray()); + SetDataSource(slices?.Select((slice, index) => new MacroStabilityInwardsSliceRow(slice, index + 1)).ToArray()); } private void AddColumns() { - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.Name), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.Name), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_Name, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.XCenter), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.XCenter), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_XCenter, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.ZCenterBottom), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.ZCenterBottom), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_ZCenterBottom, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.Width), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.Width), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_Width, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.ArcLength), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.ArcLength), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_ArcLength, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.TopAngle), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.TopAngle), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_TopAngle, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.BottomAngle), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.BottomAngle), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_BottomAngle, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.FrictionAngle), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.FrictionAngle), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_FrictionAngle, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.Cohesion), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.Cohesion), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_Cohesion, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.EffectiveStress), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.EffectiveStress), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_EffectiveStress, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.TotalPorePressure), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.TotalPorePressure), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_TotalPorePressure, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.Weight), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.Weight), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_Weight, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.PiezometricPorePressure), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.PiezometricPorePressure), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_PiezometricPorePressure, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.DegreeOfConsolidationPorePressureSoil), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.DegreeOfConsolidationPorePressureSoil), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_DegreeOfConsolidationPorePressureSoil, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.DegreeOfConsolidationPorePressureLoad), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.DegreeOfConsolidationPorePressureLoad), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_DegreeOfConsolidationPorePressureLoad, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.PorePressure), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.PorePressure), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_PorePressure, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.VerticalPorePressure), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.VerticalPorePressure), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_VerticalPorePressure, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.HorizontalPorePressure), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.HorizontalPorePressure), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_HorizontalPorePressure, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.ExternalLoad), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.ExternalLoad), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_ExternalLoad, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.OverConsolidationRatio), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.OverConsolidationRatio), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_OverConsolidationRatio, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.Pop), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.Pop), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_Pop, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.NormalStress), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.NormalStress), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_NormalStress, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.ShearStress), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.ShearStress), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_ShearStress, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSliceRow.LoadStress), + AddTextBoxColumn(nameof(MacroStabilityInwardsSliceRow.LoadStress), Resources.MacroStabilityInwardsSlicesTable_ColumnHeader_LoadStress, true); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsSliceTest.cs =================================================================== diff -u -r7b9d00d45b014b4689ee7f3104090e3c6c0f5a4d -r7b8a021f38d77546b7c3318f5f0dedda63168f91 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsSliceTest.cs (.../MacroStabilityInwardsSliceTest.cs) (revision 7b9d00d45b014b4689ee7f3104090e3c6c0f5a4d) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsSliceTest.cs (.../MacroStabilityInwardsSliceTest.cs) (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -23,6 +23,7 @@ using Core.Common.Base.Geometry; using Core.Common.Data.TestUtil; using NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Data.TestUtil; namespace Ringtoets.MacroStabilityInwards.Data.Test @@ -93,10 +94,10 @@ public void Constructor_WithCoordinates_ExpectedValues() { // Setup - var topLeftPoint = new Point2D(0, 0); - var topRightPoint = new Point2D(1, 1); - var bottomLeftPoint = new Point2D(2, 2); - var bottomRightPoint = new Point2D(3, 3); + var topLeftPoint = new Point2D(0, 5); + var topRightPoint = new Point2D(5, 4); + var bottomLeftPoint = new Point2D(0, 0); + var bottomRightPoint = new Point2D(5, 1); // Call var slice = new MacroStabilityInwardsSlice(topLeftPoint, topRightPoint, bottomLeftPoint, bottomRightPoint, @@ -109,6 +110,24 @@ Assert.AreEqual(topRightPoint, slice.TopRightPoint); Assert.AreEqual(bottomLeftPoint, slice.BottomLeftPoint); Assert.AreEqual(bottomRightPoint, slice.BottomRightPoint); + + Assert.AreEqual(2, slice.XCenter.NumberOfDecimalPlaces); + Assert.AreEqual(2.5, slice.XCenter, slice.XCenter.GetAccuracy()); + + Assert.AreEqual(2, slice.ZCenterBottom.NumberOfDecimalPlaces); + Assert.AreEqual(0.5, slice.ZCenterBottom, slice.ZCenterBottom.GetAccuracy()); + + Assert.AreEqual(2, slice.Width.NumberOfDecimalPlaces); + Assert.AreEqual(5.0, slice.Width, slice.Width.GetAccuracy()); + + Assert.AreEqual(2, slice.ArcLength.NumberOfDecimalPlaces); + Assert.AreEqual(5.1, slice.ArcLength, slice.ArcLength.GetAccuracy()); + + Assert.AreEqual(2, slice.BottomAngle.NumberOfDecimalPlaces); + Assert.AreEqual(11.31, slice.BottomAngle, slice.BottomAngle.GetAccuracy()); + + Assert.AreEqual(2, slice.TopAngle.NumberOfDecimalPlaces); + Assert.AreEqual(-11.31, slice.TopAngle, slice.TopAngle.GetAccuracy()); } [Test] @@ -227,36 +246,95 @@ properties); // Assert - Assert.AreEqual(cohesion, slice.Cohesion); - Assert.AreEqual(frictionAngle, slice.FrictionAngle); - Assert.AreEqual(criticalPressure, slice.CriticalPressure); - Assert.AreEqual(overConsolidationRatio, slice.OverConsolidationRatio); - Assert.AreEqual(pop, slice.Pop); - Assert.AreEqual(degreeOfConsolidationPorePressureSoil, slice.DegreeOfConsolidationPorePressureSoil); - Assert.AreEqual(degreeOfConsolidationPorePressureLoad, slice.DegreeOfConsolidationPorePressureLoad); - Assert.AreEqual(dilatancy, slice.Dilatancy); - Assert.AreEqual(externalLoad, slice.ExternalLoad); - Assert.AreEqual(hydrostaticPorePressure, slice.HydrostaticPorePressure); - Assert.AreEqual(leftForce, slice.LeftForce); - Assert.AreEqual(leftForceAngle, slice.LeftForceAngle); - Assert.AreEqual(leftForceY, slice.LeftForceY); - Assert.AreEqual(rightForce, slice.RightForce); - Assert.AreEqual(rightForceAngle, slice.RightForceAngle); - Assert.AreEqual(rightForceY, slice.RightForceY); - Assert.AreEqual(loadStress, slice.LoadStress); - Assert.AreEqual(normalStress, slice.NormalStress); - Assert.AreEqual(porePressure, slice.PorePressure); - Assert.AreEqual(horizontalPorePressure, slice.HorizontalPorePressure); - Assert.AreEqual(verticalPorePressure, slice.VerticalPorePressure); - Assert.AreEqual(piezometricPorePressure, slice.PiezometricPorePressure); - Assert.AreEqual(effectiveStress, slice.EffectiveStress); - Assert.AreEqual(effectiveStressDaily, slice.EffectiveStressDaily); - Assert.AreEqual(excessPorePressure, slice.ExcessPorePressure); - Assert.AreEqual(shearStress, slice.ShearStress); - Assert.AreEqual(soilStress, slice.SoilStress); - Assert.AreEqual(totalPorePressure, slice.TotalPorePressure); - Assert.AreEqual(totalStress, slice.TotalStress); - Assert.AreEqual(weight, slice.Weight); + Assert.AreEqual(3, slice.Cohesion.NumberOfDecimalPlaces); + Assert.AreEqual(cohesion, slice.Cohesion, slice.Cohesion.GetAccuracy()); + + Assert.AreEqual(3, slice.FrictionAngle.NumberOfDecimalPlaces); + Assert.AreEqual(frictionAngle, slice.FrictionAngle, slice.FrictionAngle.GetAccuracy()); + + Assert.AreEqual(3, slice.CriticalPressure.NumberOfDecimalPlaces); + Assert.AreEqual(criticalPressure, slice.CriticalPressure, slice.CriticalPressure.GetAccuracy()); + + Assert.AreEqual(3, slice.OverConsolidationRatio.NumberOfDecimalPlaces); + Assert.AreEqual(overConsolidationRatio, slice.OverConsolidationRatio, slice.OverConsolidationRatio.GetAccuracy()); + + Assert.AreEqual(3, slice.Pop.NumberOfDecimalPlaces); + Assert.AreEqual(pop, slice.Pop, slice.Pop.GetAccuracy()); + + Assert.AreEqual(3, slice.DegreeOfConsolidationPorePressureSoil.NumberOfDecimalPlaces); + Assert.AreEqual(degreeOfConsolidationPorePressureSoil, slice.DegreeOfConsolidationPorePressureSoil, slice.DegreeOfConsolidationPorePressureSoil.GetAccuracy()); + + Assert.AreEqual(3, slice.DegreeOfConsolidationPorePressureLoad.NumberOfDecimalPlaces); + Assert.AreEqual(degreeOfConsolidationPorePressureLoad, slice.DegreeOfConsolidationPorePressureLoad, slice.DegreeOfConsolidationPorePressureLoad.GetAccuracy()); + + Assert.AreEqual(3, slice.Dilatancy.NumberOfDecimalPlaces); + Assert.AreEqual(dilatancy, slice.Dilatancy, slice.Dilatancy.GetAccuracy()); + + Assert.AreEqual(3, slice.ExternalLoad.NumberOfDecimalPlaces); + Assert.AreEqual(externalLoad, slice.ExternalLoad, slice.ExternalLoad.GetAccuracy()); + + Assert.AreEqual(3, slice.HydrostaticPorePressure.NumberOfDecimalPlaces); + Assert.AreEqual(hydrostaticPorePressure, slice.HydrostaticPorePressure, slice.HydrostaticPorePressure.GetAccuracy()); + + Assert.AreEqual(3, slice.LeftForce.NumberOfDecimalPlaces); + Assert.AreEqual(leftForce, slice.LeftForce, slice.LeftForce.GetAccuracy()); + + Assert.AreEqual(3, slice.LeftForceAngle.NumberOfDecimalPlaces); + Assert.AreEqual(leftForceAngle, slice.LeftForceAngle, slice.LeftForceAngle.GetAccuracy()); + + Assert.AreEqual(3, slice.LeftForceY.NumberOfDecimalPlaces); + Assert.AreEqual(leftForceY, slice.LeftForceY, slice.LeftForceY.GetAccuracy()); + + Assert.AreEqual(3, slice.RightForce.NumberOfDecimalPlaces); + Assert.AreEqual(rightForce, slice.RightForce, slice.RightForce.GetAccuracy()); + + Assert.AreEqual(3, slice.RightForceAngle.NumberOfDecimalPlaces); + Assert.AreEqual(rightForceAngle, slice.RightForceAngle, slice.RightForceAngle.GetAccuracy()); + + Assert.AreEqual(3, slice.RightForceY.NumberOfDecimalPlaces); + Assert.AreEqual(rightForceY, slice.RightForceY, slice.RightForceY.GetAccuracy()); + + Assert.AreEqual(3, slice.LoadStress.NumberOfDecimalPlaces); + Assert.AreEqual(loadStress, slice.LoadStress, slice.LoadStress.GetAccuracy()); + + Assert.AreEqual(3, slice.NormalStress.NumberOfDecimalPlaces); + Assert.AreEqual(normalStress, slice.NormalStress, slice.NormalStress.GetAccuracy()); + + Assert.AreEqual(3, slice.PorePressure.NumberOfDecimalPlaces); + Assert.AreEqual(porePressure, slice.PorePressure, slice.PorePressure.GetAccuracy()); + + Assert.AreEqual(3, slice.HorizontalPorePressure.NumberOfDecimalPlaces); + Assert.AreEqual(horizontalPorePressure, slice.HorizontalPorePressure, slice.HorizontalPorePressure.GetAccuracy()); + + Assert.AreEqual(3, slice.VerticalPorePressure.NumberOfDecimalPlaces); + Assert.AreEqual(verticalPorePressure, slice.VerticalPorePressure, slice.VerticalPorePressure.GetAccuracy()); + + Assert.AreEqual(3, slice.PiezometricPorePressure.NumberOfDecimalPlaces); + Assert.AreEqual(piezometricPorePressure, slice.PiezometricPorePressure, slice.PiezometricPorePressure.GetAccuracy()); + + Assert.AreEqual(3, slice.EffectiveStress.NumberOfDecimalPlaces); + Assert.AreEqual(effectiveStress, slice.EffectiveStress, slice.EffectiveStress.GetAccuracy()); + + Assert.AreEqual(3, slice.EffectiveStressDaily.NumberOfDecimalPlaces); + Assert.AreEqual(effectiveStressDaily, slice.EffectiveStressDaily, slice.EffectiveStressDaily.GetAccuracy()); + + Assert.AreEqual(3, slice.ExcessPorePressure.NumberOfDecimalPlaces); + Assert.AreEqual(excessPorePressure, slice.ExcessPorePressure, slice.ExcessPorePressure.GetAccuracy()); + + Assert.AreEqual(3, slice.ShearStress.NumberOfDecimalPlaces); + Assert.AreEqual(shearStress, slice.ShearStress, slice.ShearStress.GetAccuracy()); + + Assert.AreEqual(3, slice.SoilStress.NumberOfDecimalPlaces); + Assert.AreEqual(soilStress, slice.SoilStress, slice.SoilStress.GetAccuracy()); + + Assert.AreEqual(3, slice.TotalPorePressure.NumberOfDecimalPlaces); + Assert.AreEqual(totalPorePressure, slice.TotalPorePressure, slice.TotalPorePressure.GetAccuracy()); + + Assert.AreEqual(3, slice.TotalStress.NumberOfDecimalPlaces); + Assert.AreEqual(totalStress, slice.TotalStress, slice.TotalStress.GetAccuracy()); + + Assert.AreEqual(3, slice.Weight.NumberOfDecimalPlaces); + Assert.AreEqual(weight, slice.Weight, slice.Weight.GetAccuracy()); } [Test] Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsCloneAssert.cs =================================================================== diff -u -r2bdb4415eafe18b5780dbc32408a7317d7b537e6 -r7b8a021f38d77546b7c3318f5f0dedda63168f91 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsCloneAssert.cs (.../MacroStabilityInwardsCloneAssert.cs) (revision 2bdb4415eafe18b5780dbc32408a7317d7b537e6) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsCloneAssert.cs (.../MacroStabilityInwardsCloneAssert.cs) (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -269,6 +269,12 @@ CoreCloneAssert.AreObjectClones(original.BottomLeftPoint, clone.BottomLeftPoint, GeometryCloneAssert.AreClones); CoreCloneAssert.AreObjectClones(original.BottomRightPoint, clone.BottomRightPoint, GeometryCloneAssert.AreClones); + Assert.AreEqual(original.XCenter, clone.XCenter); + Assert.AreEqual(original.ZCenterBottom, clone.ZCenterBottom); + Assert.AreEqual(original.Width, clone.Width); + Assert.AreEqual(original.ArcLength, clone.ArcLength); + Assert.AreEqual(original.BottomAngle, clone.BottomAngle); + Assert.AreEqual(original.TopAngle, clone.TopAngle); Assert.AreEqual(original.Cohesion, clone.Cohesion); Assert.AreEqual(original.FrictionAngle, clone.FrictionAngle); Assert.AreEqual(original.CriticalPressure, clone.CriticalPressure); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj =================================================================== diff -u -r365f33fe0130eac94cacb979165488d9ae124f3c -r7b8a021f38d77546b7c3318f5f0dedda63168f91 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj (.../Ringtoets.MacroStabilityInwards.Forms.Test.csproj) (revision 365f33fe0130eac94cacb979165488d9ae124f3c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj (.../Ringtoets.MacroStabilityInwards.Forms.Test.csproj) (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -104,7 +104,7 @@ - + Fisheye: Tag 7b8a021f38d77546b7c3318f5f0dedda63168f91 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFormattedSliceRowTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsOutputViewTest.cs =================================================================== diff -u -r365f33fe0130eac94cacb979165488d9ae124f3c -r7b8a021f38d77546b7c3318f5f0dedda63168f91 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsOutputViewTest.cs (.../MacroStabilityInwardsOutputViewTest.cs) (revision 365f33fe0130eac94cacb979165488d9ae124f3c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsOutputViewTest.cs (.../MacroStabilityInwardsOutputViewTest.cs) (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -21,12 +21,10 @@ using System.Linq; using System.Windows.Forms; -using Core.Common.Base; using Core.Common.Base.Geometry; using Core.Components.Chart.Data; using Core.Components.Chart.Forms; using NUnit.Framework; -using Rhino.Mocks; using Ringtoets.Common.Forms.TestUtil; using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; @@ -318,11 +316,6 @@ public void GivenViewWithOutputSet_WhenOutputUpdated_ThenTableUpdated() { // Given - var mocks = new MockRepository(); - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); - using (var view = new MacroStabilityInwardsOutputView()) { MacroStabilityInwardsSlicesTable slicesTable = GetSlicesTable(view); @@ -349,25 +342,18 @@ Assert.AreEqual(1, slicesTable.Rows.Count); // When - calculation.InputParameters.Attach(observer); calculation.Output = MacroStabilityInwardsOutputTestFactory.CreateOutput(); - calculation.InputParameters.NotifyObservers(); + calculation.NotifyObservers(); // Then Assert.AreEqual(3, slicesTable.Rows.Count); - mocks.VerifyAll(); } } [Test] public void GivenViewWithOutputSet_WhenOutputCleared_ThenTableCleared() { - // Given - var mocks = new MockRepository(); - var observer = mocks.StrictMock(); - observer.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); - + // Give using (var view = new MacroStabilityInwardsOutputView()) { MacroStabilityInwardsSlicesTable slicesTable = GetSlicesTable(view); @@ -383,13 +369,11 @@ Assert.AreEqual(3, slicesTable.Rows.Count); // When - calculation.InputParameters.Attach(observer); calculation.ClearOutput(); - calculation.InputParameters.NotifyObservers(); + calculation.NotifyObservers(); // Then Assert.AreEqual(0, slicesTable.Rows.Count); - mocks.VerifyAll(); } } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsSliceRowTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsSliceRowTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsSliceRowTest.cs (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -0,0 +1,105 @@ +// 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 NUnit.Framework; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.MacroStabilityInwards.Data; +using Ringtoets.MacroStabilityInwards.Forms.Views; + +namespace Ringtoets.MacroStabilityInwards.Forms.Test.Views +{ + public class MacroStabilityInwardsSliceRowTest + { + [Test] + public void Constructor_SliceNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new MacroStabilityInwardsSliceRow(null, new Random(22).Next()); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("slice", paramName); + } + + [Test] + public void Constructor_WithSlice_ExpectedValues() + { + // Setup + var slice = new MacroStabilityInwardsSlice( + new Point2D(0, 10), + new Point2D(10, 8), + new Point2D(0, 2), + new Point2D(10, 1), + new MacroStabilityInwardsSlice.ConstructionProperties + { + Cohesion = double.NaN, + FrictionAngle = 2.0, + EffectiveStress = 3.0, + TotalPorePressure = 4.0, + Weight = 5.0, + PiezometricPorePressure = 6.0, + DegreeOfConsolidationPorePressureSoil = 7.0, + DegreeOfConsolidationPorePressureLoad = 8.0, + PorePressure = 9.0, + VerticalPorePressure = 10.0, + HorizontalPorePressure = 11.0, + ExternalLoad = 12.0, + OverConsolidationRatio = 13.0, + Pop = 14.0, + NormalStress = 15.0, + ShearStress = 16.0, + LoadStress = 17.0 + }); + + // Call + var sliceRow = new MacroStabilityInwardsSliceRow(slice, 3); + + // Assert + Assert.AreEqual("Lamel 3", sliceRow.Name); + + Assert.AreEqual(5.0, sliceRow.XCenter, sliceRow.XCenter.GetAccuracy()); + Assert.AreEqual(1.5, sliceRow.ZCenterBottom, sliceRow.ZCenterBottom.GetAccuracy()); + Assert.AreEqual(10.0, sliceRow.Width, sliceRow.Width.GetAccuracy()); + Assert.AreEqual(10.05, sliceRow.ArcLength, sliceRow.ArcLength.GetAccuracy()); + Assert.AreEqual(-5.71, sliceRow.BottomAngle, sliceRow.BottomAngle.GetAccuracy()); + Assert.AreEqual(-11.31, sliceRow.TopAngle, sliceRow.TopAngle.GetAccuracy()); + Assert.AreEqual(2.0, sliceRow.FrictionAngle, sliceRow.FrictionAngle.GetAccuracy()); + Assert.AreEqual(double.NaN, sliceRow.Cohesion, sliceRow.Cohesion.GetAccuracy()); + Assert.AreEqual(3.0, sliceRow.EffectiveStress, sliceRow.EffectiveStress.GetAccuracy()); + Assert.AreEqual(4.0, sliceRow.TotalPorePressure, sliceRow.TotalPorePressure.GetAccuracy()); + Assert.AreEqual(5.0, sliceRow.Weight, sliceRow.Weight.GetAccuracy()); + Assert.AreEqual(6.0, sliceRow.PiezometricPorePressure, sliceRow.PiezometricPorePressure.GetAccuracy()); + Assert.AreEqual(7.0, sliceRow.DegreeOfConsolidationPorePressureSoil, sliceRow.DegreeOfConsolidationPorePressureSoil.GetAccuracy()); + Assert.AreEqual(8.0, sliceRow.DegreeOfConsolidationPorePressureLoad, sliceRow.DegreeOfConsolidationPorePressureLoad.GetAccuracy()); + Assert.AreEqual(9.0, sliceRow.PorePressure, sliceRow.PorePressure.GetAccuracy()); + Assert.AreEqual(10.0, sliceRow.VerticalPorePressure, sliceRow.VerticalPorePressure.GetAccuracy()); + Assert.AreEqual(11.0, sliceRow.HorizontalPorePressure, sliceRow.HorizontalPorePressure.GetAccuracy()); + Assert.AreEqual(12.0, sliceRow.ExternalLoad, sliceRow.ExternalLoad.GetAccuracy()); + Assert.AreEqual(13.0, sliceRow.OverConsolidationRatio, sliceRow.OverConsolidationRatio.GetAccuracy()); + Assert.AreEqual(14.0, sliceRow.Pop, sliceRow.Pop.GetAccuracy()); + Assert.AreEqual(15.0, sliceRow.NormalStress, sliceRow.NormalStress.GetAccuracy()); + Assert.AreEqual(16.0, sliceRow.ShearStress, sliceRow.ShearStress.GetAccuracy()); + Assert.AreEqual(17.0, sliceRow.LoadStress, sliceRow.LoadStress.GetAccuracy()); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsSlicesTableTest.cs =================================================================== diff -u -r365f33fe0130eac94cacb979165488d9ae124f3c -r7b8a021f38d77546b7c3318f5f0dedda63168f91 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsSlicesTableTest.cs (.../MacroStabilityInwardsSlicesTableTest.cs) (revision 365f33fe0130eac94cacb979165488d9ae124f3c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsSlicesTableTest.cs (.../MacroStabilityInwardsSlicesTableTest.cs) (revision 7b8a021f38d77546b7c3318f5f0dedda63168f91) @@ -201,10 +201,6 @@ MacroStabilityInwardsSliceTestFactory.CreateSlice(), MacroStabilityInwardsSliceTestFactory.CreateSlice() }; - table.SetData(new[] - { - MacroStabilityInwardsSliceTestFactory.CreateSlice() - }); // Call table.SetData(slices); @@ -240,12 +236,12 @@ arcLength.GetAccuracy()); var bottomAngle = (RoundedDouble) rowCells[bottomAngleColumnIndex].Value; - Assert.AreEqual(GetAngleBetween(slice.BottomRightPoint, slice.BottomLeftPoint), + Assert.AreEqual(Math2D.GetAngleBetween(slice.BottomLeftPoint, slice.BottomRightPoint), bottomAngle, bottomAngle.GetAccuracy()); var topAngle = (RoundedDouble) rowCells[topAngleColumnIndex].Value; - Assert.AreEqual(GetAngleBetween(slice.TopRightPoint, slice.TopLeftPoint), + Assert.AreEqual(Math2D.GetAngleBetween(slice.TopLeftPoint, slice.TopRightPoint), topAngle, topAngle.GetAccuracy()); @@ -336,11 +332,5 @@ } } } - - private static double GetAngleBetween(Point2D pointA, Point2D pointB) - { - return Math.Atan2(pointA.Y - pointB.Y, - pointA.X - pointB.X) * (180 / Math.PI); - } } } \ No newline at end of file