Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer1DCreateExtensions.cs =================================================================== diff -u -r69d647795daacbf48e17d0cf3a02a21865ab4ae6 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer1DCreateExtensions.cs (.../MacroStabilityInwardsSoilLayer1DCreateExtensions.cs) (revision 69d647795daacbf48e17d0cf3a02a21865ab4ae6) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer1DCreateExtensions.cs (.../MacroStabilityInwardsSoilLayer1DCreateExtensions.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -23,6 +23,7 @@ using Application.Ringtoets.Storage.DbContext; using Core.Common.Utils.Extensions; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.Create.MacroStabilityInwards { @@ -48,7 +49,7 @@ throw new ArgumentNullException(nameof(soilLayer)); } - MacroStabilityInwardsSoilLayerData data = soilLayer.Data; + IMacroStabilityInwardsSoilLayerData data = soilLayer.Data; return new MacroStabilityInwardsSoilLayerOneDEntity { Top = soilLayer.Top.ToNaNAsNull(), Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer2DCreateExtensions.cs =================================================================== diff -u -r69d647795daacbf48e17d0cf3a02a21865ab4ae6 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer2DCreateExtensions.cs (.../MacroStabilityInwardsSoilLayer2DCreateExtensions.cs) (revision 69d647795daacbf48e17d0cf3a02a21865ab4ae6) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer2DCreateExtensions.cs (.../MacroStabilityInwardsSoilLayer2DCreateExtensions.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Serializers; using Core.Common.Utils.Extensions; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.Create.MacroStabilityInwards { @@ -49,7 +50,7 @@ throw new ArgumentNullException(nameof(soilLayer)); } - MacroStabilityInwardsSoilLayerData data = soilLayer.Data; + IMacroStabilityInwardsSoilLayerData data = soilLayer.Data; return new MacroStabilityInwardsSoilLayerTwoDEntity { OuterRingXml = new Point2DXmlSerializer().ToXml(soilLayer.OuterRing.Points), Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileCreateExtensions.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileCreateExtensions.cs (.../MacroStabilityInwardsStochasticSoilProfileCreateExtensions.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileCreateExtensions.cs (.../MacroStabilityInwardsStochasticSoilProfileCreateExtensions.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -22,6 +22,7 @@ using System; using Application.Ringtoets.Storage.DbContext; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.Create.MacroStabilityInwards { Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerOneDEntityReadExtensions.cs =================================================================== diff -u -r90a9502badff5788374461a1b2179a5dd0e866a2 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerOneDEntityReadExtensions.cs (.../MacroStabilityInwardsSoilLayerOneDEntityReadExtensions.cs) (revision 90a9502badff5788374461a1b2179a5dd0e866a2) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerOneDEntityReadExtensions.cs (.../MacroStabilityInwardsSoilLayerOneDEntityReadExtensions.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -51,7 +51,7 @@ return new MacroStabilityInwardsSoilLayer1D(entity.Top.ToNullAsNaN()) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = Convert.ToBoolean(entity.IsAquifer), MaterialName = entity.MaterialName ?? string.Empty, Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityReadExtensions.cs =================================================================== diff -u -r90a9502badff5788374461a1b2179a5dd0e866a2 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityReadExtensions.cs (.../MacroStabilityInwardsSoilLayerTwoDEntityReadExtensions.cs) (revision 90a9502badff5788374461a1b2179a5dd0e866a2) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityReadExtensions.cs (.../MacroStabilityInwardsSoilLayerTwoDEntityReadExtensions.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -55,7 +55,7 @@ return new MacroStabilityInwardsSoilLayer2D(outerRing, holes) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = Convert.ToBoolean(entity.IsAquifer), MaterialName = entity.MaterialName ?? string.Empty, Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityReadExtensions.cs =================================================================== diff -u -rc91246ef0f88eff9950857a6f2c404653a022dcc -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityReadExtensions.cs (.../MacroStabilityInwardsStochasticSoilProfileEntityReadExtensions.cs) (revision c91246ef0f88eff9950857a6f2c404653a022dcc) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityReadExtensions.cs (.../MacroStabilityInwardsStochasticSoilProfileEntityReadExtensions.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -22,6 +22,7 @@ using System; using Application.Ringtoets.Storage.DbContext; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.Read.MacroStabilityInwards { Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Serializers/RingXmlSerializer.cs =================================================================== diff -u -r9f936b0b29f490a024df02345df182133b1c041a -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Serializers/RingXmlSerializer.cs (.../RingXmlSerializer.cs) (revision 9f936b0b29f490a024df02345df182133b1c041a) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Serializers/RingXmlSerializer.cs (.../RingXmlSerializer.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -23,6 +23,7 @@ using System.Collections.Generic; using System.Linq; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.Serializers { Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer1DCreateExtensionsTest.cs =================================================================== diff -u -r90a9502badff5788374461a1b2179a5dd0e866a2 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer1DCreateExtensionsTest.cs (.../MacroStabilityInwardsSoilLayer1DCreateExtensionsTest.cs) (revision 90a9502badff5788374461a1b2179a5dd0e866a2) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer1DCreateExtensionsTest.cs (.../MacroStabilityInwardsSoilLayer1DCreateExtensionsTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -52,7 +52,7 @@ var random = new Random(31); var soilLayer = new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = random.NextBoolean(), MaterialName = "MaterialName", @@ -107,7 +107,7 @@ Assert.IsNotNull(entity); Assert.AreEqual(soilLayer.Top, entity.Top); - MacroStabilityInwardsSoilLayerData data = soilLayer.Data; + IMacroStabilityInwardsSoilLayerData data = soilLayer.Data; Assert.AreEqual(Convert.ToByte(data.IsAquifer), entity.IsAquifer); Assert.AreEqual(data.MaterialName, entity.MaterialName); Assert.AreEqual(data.Color.ToArgb(), Convert.ToInt32(entity.Color)); @@ -138,7 +138,7 @@ // Setup var soilLayer = new MacroStabilityInwardsSoilLayer1D(double.NaN) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { AbovePhreaticLevel = { @@ -211,7 +211,7 @@ const string materialName = "MaterialName"; var soilLayer = new MacroStabilityInwardsSoilLayer1D(0) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { MaterialName = materialName } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer2DCreateExtensionsTest.cs =================================================================== diff -u -r90a9502badff5788374461a1b2179a5dd0e866a2 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer2DCreateExtensionsTest.cs (.../MacroStabilityInwardsSoilLayer2DCreateExtensionsTest.cs) (revision 90a9502badff5788374461a1b2179a5dd0e866a2) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer2DCreateExtensionsTest.cs (.../MacroStabilityInwardsSoilLayer2DCreateExtensionsTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -58,7 +58,7 @@ CreateRandomRing(random) }) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = random.NextBoolean(), MaterialName = "MaterialName", @@ -112,7 +112,7 @@ // Assert Assert.IsNotNull(entity); - MacroStabilityInwardsSoilLayerData data = soilLayer.Data; + IMacroStabilityInwardsSoilLayerData data = soilLayer.Data; Assert.AreEqual(Convert.ToByte(data.IsAquifer), entity.IsAquifer); Assert.AreEqual(data.MaterialName, entity.MaterialName); Assert.AreEqual(data.Color.ToArgb(), Convert.ToInt32(entity.Color)); @@ -147,7 +147,7 @@ var random = new Random(31); var soilLayer = new MacroStabilityInwardsSoilLayer2D(CreateRandomRing(random), Enumerable.Empty()) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { AbovePhreaticLevel = { @@ -224,7 +224,7 @@ CreateRandomRing(random) }) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { MaterialName = materialName } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile1DCreateExtensionsTest.cs =================================================================== diff -u -rd0d3ed3067ec66c52283bd4d1c44011b1a412492 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile1DCreateExtensionsTest.cs (.../MacroStabilityInwardsSoilProfile1DCreateExtensionsTest.cs) (revision d0d3ed3067ec66c52283bd4d1c44011b1a412492) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile1DCreateExtensionsTest.cs (.../MacroStabilityInwardsSoilProfile1DCreateExtensionsTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -72,8 +72,14 @@ double bottom = -random.NextDouble(); var soilProfile = new MacroStabilityInwardsSoilProfile1D(name, bottom, new[] { - new MacroStabilityInwardsSoilLayer1D(random.NextDouble()), new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, + new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) + { + Data = new MacroStabilityInwardsSoilLayerData() + } }); var registry = new PersistenceRegistry(); @@ -100,6 +106,9 @@ var soilProfile = new MacroStabilityInwardsSoilProfile1D("some name", double.NaN, new[] { new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) + { + Data = new MacroStabilityInwardsSoilLayerData() + } }); var registry = new PersistenceRegistry(); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile2DCreateExtensionsTest.cs =================================================================== diff -u -r342550ddfacbc6b0253b9b452da4aa68c3fac73f -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile2DCreateExtensionsTest.cs (.../MacroStabilityInwardsSoilProfile2DCreateExtensionsTest.cs) (revision 342550ddfacbc6b0253b9b452da4aa68c3fac73f) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile2DCreateExtensionsTest.cs (.../MacroStabilityInwardsSoilProfile2DCreateExtensionsTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -33,6 +33,7 @@ using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.Test.Create.MacroStabilityInwards { @@ -151,6 +152,9 @@ new Point2D(random.NextDouble(), random.NextDouble()), new Point2D(random.NextDouble(), random.NextDouble()) }), Enumerable.Empty()) + { + Data = new MacroStabilityInwardsSoilLayerData() + } }; return new MacroStabilityInwardsSoilProfile2D(name, layers, Enumerable.Empty()); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileCreateExtensionsTest.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileCreateExtensionsTest.cs (.../MacroStabilityInwardsStochasticSoilProfileCreateExtensionsTest.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileCreateExtensionsTest.cs (.../MacroStabilityInwardsStochasticSoilProfileCreateExtensionsTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -28,6 +28,7 @@ using Rhino.Mocks; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.Test.Create.MacroStabilityInwards { Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs =================================================================== diff -u -r66396d7a91ffdfadfcd6a94759ce579c611c78b9 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 66396d7a91ffdfadfcd6a94759ce579c611c78b9) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -1509,8 +1509,8 @@ AssertMacroStabilityInwardsSoilLayerData(expectedLayer.Data, actualLayer.Data); } - private static void AssertMacroStabilityInwardsSoilLayerData(MacroStabilityInwardsSoilLayerData expectedData, - MacroStabilityInwardsSoilLayerData actualData) + private static void AssertMacroStabilityInwardsSoilLayerData(IMacroStabilityInwardsSoilLayerData expectedData, + IMacroStabilityInwardsSoilLayerData actualData) { Assert.AreEqual(expectedData.IsAquifer, actualData.IsAquifer); Assert.AreEqual(expectedData.MaterialName, actualData.MaterialName); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerOneDEntityReadExtensionsTest.cs =================================================================== diff -u -r69d647795daacbf48e17d0cf3a02a21865ab4ae6 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerOneDEntityReadExtensionsTest.cs (.../MacroStabilityInwardsSoilLayerOneDEntityReadExtensionsTest.cs) (revision 69d647795daacbf48e17d0cf3a02a21865ab4ae6) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerOneDEntityReadExtensionsTest.cs (.../MacroStabilityInwardsSoilLayerOneDEntityReadExtensionsTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -29,6 +29,7 @@ using Ringtoets.Common.Data.Probabilistics; using Ringtoets.Common.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.Test.Read.MacroStabilityInwards { @@ -101,7 +102,7 @@ // Assert Assert.IsNotNull(layer); Assert.AreEqual(top, layer.Top); - MacroStabilityInwardsSoilLayerData data = layer.Data; + IMacroStabilityInwardsSoilLayerData data = layer.Data; Assert.AreEqual(isAquifer, data.IsAquifer); Assert.AreEqual(Color.FromArgb(color), data.Color); Assert.AreEqual(entity.MaterialName, data.MaterialName); @@ -165,7 +166,7 @@ // Assert Assert.IsNotNull(layer); - MacroStabilityInwardsSoilLayerData data = layer.Data; + IMacroStabilityInwardsSoilLayerData data = layer.Data; Assert.AreEqual(entity.MaterialName, data.MaterialName); Assert.IsNaN(layer.Top); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityReadExtensionsTest.cs =================================================================== diff -u -re7264aaab63be7a266ae8340fdb9eac7dba28c4e -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityReadExtensionsTest.cs (.../MacroStabilityInwardsSoilLayerTwoDEntityReadExtensionsTest.cs) (revision e7264aaab63be7a266ae8340fdb9eac7dba28c4e) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityReadExtensionsTest.cs (.../MacroStabilityInwardsSoilLayerTwoDEntityReadExtensionsTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -31,6 +31,7 @@ using Ringtoets.Common.Data.Probabilistics; using Ringtoets.Common.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.Test.Read.MacroStabilityInwards { @@ -116,7 +117,7 @@ // Assert Assert.IsNotNull(layer); - MacroStabilityInwardsSoilLayerData data = layer.Data; + IMacroStabilityInwardsSoilLayerData data = layer.Data; Assert.AreEqual(isAquifer, data.IsAquifer); Assert.AreEqual(Color.FromArgb(color), data.Color); Assert.AreEqual(entity.MaterialName, data.MaterialName); @@ -185,7 +186,7 @@ // Assert Assert.IsNotNull(layer); - MacroStabilityInwardsSoilLayerData data = layer.Data; + IMacroStabilityInwardsSoilLayerData data = layer.Data; Assert.AreEqual(entity.MaterialName, data.MaterialName); DistributionAssert.AreEqual(new VariationCoefficientLogNormalDistribution(2) Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilProfileTwoDEntityReadExtensionsTest.cs =================================================================== diff -u -r1844676af787acac007941758f0bce03431fd777 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilProfileTwoDEntityReadExtensionsTest.cs (.../MacroStabilityInwardsSoilProfileTwoDEntityReadExtensionsTest.cs) (revision 1844676af787acac007941758f0bce03431fd777) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilProfileTwoDEntityReadExtensionsTest.cs (.../MacroStabilityInwardsSoilProfileTwoDEntityReadExtensionsTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -31,6 +31,7 @@ using NUnit.Framework; using Ringtoets.Common.Data.Probabilistics; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.Test.Read.MacroStabilityInwards { Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityReadExtensionsTest.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityReadExtensionsTest.cs (.../MacroStabilityInwardsStochasticSoilProfileEntityReadExtensionsTest.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityReadExtensionsTest.cs (.../MacroStabilityInwardsStochasticSoilProfileEntityReadExtensionsTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -26,6 +26,7 @@ using Application.Ringtoets.Storage.TestUtil.MacroStabilityInwards; using NUnit.Framework; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.Test.Read.MacroStabilityInwards { Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ReadConversionCollectorTest.cs =================================================================== diff -u -r57bc6a475f6cdd57b1a0ebf70cdf533014afd1ff -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ReadConversionCollectorTest.cs (.../ReadConversionCollectorTest.cs) (revision 57bc6a475f6cdd57b1a0ebf70cdf533014afd1ff) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ReadConversionCollectorTest.cs (.../ReadConversionCollectorTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -556,7 +556,7 @@ { new MacroStabilityInwardsSoilLayer1D(0.0) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = true } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Serializers/RingXmlSerializerTest.cs =================================================================== diff -u -r2a585c57b57dac62d39293e51dda15c7392305de -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Serializers/RingXmlSerializerTest.cs (.../RingXmlSerializerTest.cs) (revision 2a585c57b57dac62d39293e51dda15c7392305de) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Serializers/RingXmlSerializerTest.cs (.../RingXmlSerializerTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -24,6 +24,7 @@ using Core.Common.Base.Geometry; using NUnit.Framework; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.Test.Serializers { Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityTestFactoryTest.cs =================================================================== diff -u -r6b60edb4d7f04f83c74089d70a72c4f79ed413dd -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityTestFactoryTest.cs (.../MacroStabilityInwardsSoilLayerTwoDEntityTestFactoryTest.cs) (revision 6b60edb4d7f04f83c74089d70a72c4f79ed413dd) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil.Test/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityTestFactoryTest.cs (.../MacroStabilityInwardsSoilLayerTwoDEntityTestFactoryTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -25,6 +25,7 @@ using Core.Common.Base.Geometry; using NUnit.Framework; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.TestUtil.Test.MacroStabilityInwards { Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.cs =================================================================== diff -u -raf575930a392dbf1fb1d5073f3df48110af72686 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.cs (.../MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.cs) (revision af575930a392dbf1fb1d5073f3df48110af72686) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.cs (.../MacroStabilityInwardsSoilLayerTwoDEntityTestFactory.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -24,6 +24,7 @@ using Application.Ringtoets.Storage.Serializers; using Core.Common.Base.Geometry; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Application.Ringtoets.Storage.TestUtil.MacroStabilityInwards { Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs =================================================================== diff -u -r10e060be0b77c159b3e99a7200e43c4326b17642 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision 10e060be0b77c159b3e99a7200e43c4326b17642) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -1065,7 +1065,7 @@ var soilLayer1D = new MacroStabilityInwardsSoilLayer1D(5) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = true, MaterialName = "SeaShellLayer", @@ -1132,7 +1132,7 @@ }) }) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = false, MaterialName = "GainsboroLayer", Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs =================================================================== diff -u -rb13759ad077f9e2b4104de000b5bdeafa9abe358 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs (.../AddNewDemoAssessmentSectionCommand.cs) (revision b13759ad077f9e2b4104de000b5bdeafa9abe358) +++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs (.../AddNewDemoAssessmentSectionCommand.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -48,6 +48,7 @@ using Ringtoets.Integration.Plugin.Handlers; using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; using Ringtoets.Piping.Data; using Ringtoets.Piping.Data.SoilProfile; using Ringtoets.Piping.Plugin.FileImporter; @@ -440,7 +441,7 @@ { new MacroStabilityInwardsSoilLayer1D(30.1267) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { MaterialName = "1D Layer", IsAquifer = true @@ -476,7 +477,7 @@ }) }) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { MaterialName = "2D Layer" } Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs =================================================================== diff -u -rb13759ad077f9e2b4104de000b5bdeafa9abe358 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs (.../AddNewDemoAssessmentSectionCommandTest.cs) (revision b13759ad077f9e2b4104de000b5bdeafa9abe358) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs (.../AddNewDemoAssessmentSectionCommandTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -44,6 +44,7 @@ using Ringtoets.Integration.Data; using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; using Ringtoets.Piping.Data; using Ringtoets.Piping.Data.SoilProfile; using Ringtoets.Piping.Primitives; Index: Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj =================================================================== diff -u -re40a14c4d5b76ae6e2d9c13407e231b8929f800a -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision e40a14c4d5b76ae6e2d9c13407e231b8929f800a) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -139,6 +139,7 @@ + @@ -148,6 +149,7 @@ + Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer2D.cs =================================================================== diff -u -rf2ce3973407bf490446cd53e3c1306f39f659561 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer2D.cs (.../SoilLayer2D.cs) (revision f2ce3973407bf490446cd53e3c1306f39f659561) +++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer2D.cs (.../SoilLayer2D.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -21,10 +21,6 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using Core.Common.Base.Geometry; -using Ringtoets.Common.IO.Properties; namespace Ringtoets.Common.IO.SoilProfile { @@ -33,99 +29,41 @@ /// public class SoilLayer2D : SoilLayerBase { - private readonly Collection innerLoops; - private Segment2D[] outerLoop; - /// /// Creates a new instance of . /// - public SoilLayer2D() + /// The outer loop of the soil layer. + /// The inner loops of the soil layer. + /// Thrown when any input parameter is null. + public SoilLayer2D(SoilLayer2DLoop outerLoop, IEnumerable innerLoops) { - innerLoops = new Collection(); - } - - /// - /// Gets the outer loop of the as a of , - /// for which each of the segments are connected to the next. - /// - /// Thrown when is null. - /// Thrown when the in - /// do not form a loop. - public IEnumerable OuterLoop - { - get + if (outerLoop == null) { - return outerLoop; + throw new ArgumentNullException(nameof(outerLoop)); } - internal set - { - if (value == null) - { - throw new ArgumentNullException(nameof(value)); - } - Segment2D[] loop = value.ToArray(); - CheckValidLoop(loop); - outerLoop = loop; + if (innerLoops == null) + { + throw new ArgumentNullException(nameof(innerLoops)); } + + OuterLoop = outerLoop; + InnerLoops = innerLoops; } /// - /// Gets the of inner loops (as of , - /// for which each of the segments are connected to the next) of the . + /// Gets the outer loop of the geometry. /// - public IEnumerable InnerLoops - { - get - { - return innerLoops; - } - } + public SoilLayer2DLoop OuterLoop { get; } /// - /// Adds an inner loop to the geometry. + /// Gets the inner loops of the geometry. /// - /// The inner loop to add. - /// Thrown when the in - /// do not form a loop. - internal void AddInnerLoop(IEnumerable innerLoop) - { - Segment2D[] loop = innerLoop.ToArray(); - CheckValidLoop(loop); - innerLoops.Add(loop); - } + public IEnumerable InnerLoops { get; } /// - /// Validates that form a loop. + /// Gets or sets the nested layers of the geometry. /// - /// The segments to validate. - /// Thrown when do not form a loop. - /// The points in must be ordered. - private static void CheckValidLoop(Segment2D[] segments) - { - if (segments.Length == 1 || !IsValidLoop(segments)) - { - throw new ArgumentException(Resources.Loop_contains_disconnected_segments); - } - } - - private static bool IsValidLoop(Segment2D[] segments) - { - int segmentCount = segments.Length; - if (segmentCount == 2) - { - return segments[0].Equals(segments[1]); - } - for (var i = 0; i < segmentCount; i++) - { - Segment2D segmentA = segments[i]; - Segment2D segmentB = segments[(i + 1) % segmentCount]; - if (!segmentA.SecondPoint.Equals(segmentB.FirstPoint)) - { - return false; - } - } - return true; - } + public IEnumerable NestedLayers { get; set; } } } \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer2DGeometry.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer2DGeometry.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer2DGeometry.cs (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -0,0 +1,47 @@ +// 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.Collections.Generic; + +namespace Ringtoets.Common.IO.SoilProfile +{ + /// + /// Class representing the full geometry of a 2D soil layer, taking into account + /// layer properties, an outer loop and zero to many inner loops. + /// + internal class SoilLayer2DGeometry + { + /// + /// Gets or sets the layer properties going with the geometry. + /// + public LayerProperties LayerProperties { get; set; } + + /// + /// Gets or sets the outer loop of the geometry. + /// + public SoilLayer2DLoop OuterLoop { get; set; } + + /// + /// Gets or sets the inner loops of the geometry. + /// + public IEnumerable InnerLoops { get; set; } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer2DGeometryReader.cs =================================================================== diff -u -r7733b872eca9cfa426bc0979f25ae3f7e2f78453 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer2DGeometryReader.cs (.../SoilLayer2DGeometryReader.cs) (revision 7733b872eca9cfa426bc0979f25ae3f7e2f78453) +++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer2DGeometryReader.cs (.../SoilLayer2DGeometryReader.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -35,15 +35,15 @@ { /// /// This class is responsible for reading an array of bytes and interpret this as an XML document, - /// which contains information about the geometry of a soil layer. + /// which contains information about the geometry of a 2D soil layer. /// internal class SoilLayer2DGeometryReader { private const string outerLoopElementName = "OuterLoop"; private const string innerLoopsElementName = "InnerLoops"; private const string innerLoopElementName = "GeometryLoop"; - private const string endPointElementName = "EndPoint"; private const string headPointElementName = "HeadPoint"; + private const string endPointElementName = "EndPoint"; private const string geometryCurveElementName = "GeometryCurve"; private const string xElementName = "X"; private const string zElementName = "Z"; @@ -59,21 +59,20 @@ } /// - /// Reads a new using the as the source of the - /// geometry for a soil layer. + /// Reads a from . /// /// An of which contains the information - /// of a soil layer in an XML document. - /// A new with information taken from the XML document. + /// of a soil layer 2D geometry as an XML document. + /// A with information taken from the XML document. /// Thrown when is null. /// Thrown when: /// /// is not valid XML; - /// does not pass schema validation. + /// does not pass the schema validation. /// /// /// - public SoilLayer2D Read(byte[] geometry) + public SoilLayer2DGeometry Read(byte[] geometry) { if (geometry == null) { @@ -93,28 +92,29 @@ } /// - /// Reads a new using the . + /// Reads a from . /// - /// An which contains the information - /// of a soil layer in an XML document. - /// A new with information taken from the XML document. + /// An which contains the information + /// of a soil layer 2D geometry. + /// A with information taken from the XML document. /// Thrown when is null. /// Thrown when: /// /// is not valid XML; - /// does not pass schema validation. + /// does not pass the schema validation. /// /// /// - public SoilLayer2D Read(XDocument geometry) + public SoilLayer2DGeometry Read(XDocument geometry) { if (geometry == null) { throw new ArgumentNullException(nameof(geometry)); } + ValidateToSchema(geometry); - return ParseLayer(geometry); + return ParseGeometry(geometry); } /// @@ -142,65 +142,114 @@ } /// - /// Parses the XML element to create a 2D soil layer. + /// Parses in order to create a 2D soil layer geometry. /// - /// The geometry. - /// Thrown when - /// XML for inner or outer geometry loops is invalid. - private static SoilLayer2D ParseLayer(XDocument geometry) + /// An which contains the information + /// of a 2D soil layer geometry. + /// A with data set for the outer loop and the inner loops. + /// Thrown when the XML for the outer + /// or inner geometry loops is invalid. + private static SoilLayer2DGeometry ParseGeometry(XDocument geometry) { - var soilLayer = new SoilLayer2D(); - XElement xmlOuterLoop = geometry.XPathSelectElement($"//{outerLoopElementName}"); IEnumerable xmlInnerLoops = geometry.XPathSelectElements($"//{innerLoopsElementName}//{innerLoopElementName}"); - if (xmlOuterLoop != null) + return new SoilLayer2DGeometry { - soilLayer.OuterLoop = ParseGeometryLoop(xmlOuterLoop); - } - foreach (XElement loop in xmlInnerLoops) - { - soilLayer.AddInnerLoop(ParseGeometryLoop(loop)); - } - return soilLayer; + OuterLoop = ParseLoop(xmlOuterLoop), + InnerLoops = xmlInnerLoops.Select(ParseLoop).ToArray() + }; } /// - /// Parses the XML element to create a collection of sorted describing - /// a geometric loop. + /// Parses in order to create a . /// - /// The geometric loop element. + /// An which contains the information + /// of a 2D soil layer loop. + /// A . /// Thrown when the XML: /// /// for any geometry curve is invalid; /// only contains one curve; /// contains disconnected curves. /// /// - /// As the description states, the returned segments are sorted. The sorting is - /// necessary for hiding some insufficiencies in D-Soilmodel. - private static IEnumerable ParseGeometryLoop(XElement loop) + private static SoilLayer2DLoop ParseLoop(XElement loop) { IEnumerable curves = loop.XPathSelectElements($".//{geometryCurveElementName}"); - Segment2D[] unsortedSegments = curves.Select(ParseGeometryCurve).ToArray(); + Segment2D[] unsortedSegments = curves.Select(ParseCurve).ToArray(); if (unsortedSegments.Length == 1) { throw new SoilLayerConversionException(Resources.Loop_contains_disconnected_segments); } - return CreateSortedSegments(unsortedSegments); + return new SoilLayer2DLoop(GetSortedSegments(unsortedSegments).ToArray()); } /// + /// Parses in order to create a . + /// + /// An which contains the information + /// of a 2D segment. + /// A . + /// Thrown when the XML for the curve + /// is invalid. + private static Segment2D ParseCurve(XElement curve) + { + XElement headDefinition = curve.Element(headPointElementName); + XElement endDefinition = curve.Element(endPointElementName); + if (headDefinition == null || endDefinition == null) + { + throw new SoilLayerConversionException(Resources.SoilLayer2DGeometryReader_Geometry_contains_no_valid_xml); + } + + return new Segment2D(ParsePoint(headDefinition), ParsePoint(endDefinition)); + } + + /// + /// Parses in order to create a . + /// + /// An which contains the information + /// of a 2D point. + /// A . + /// Thrown when any of the following occurs: + /// + /// A coordinate value cannot be parsed. + /// The XML for the point is invalid. + /// + private static Point2D ParsePoint(XElement point) + { + XElement xElement = point.Element(xElementName); + XElement yElement = point.Element(zElementName); + if (xElement == null || yElement == null) + { + throw new SoilLayerConversionException(Resources.SoilLayer2DGeometryReader_Geometry_contains_no_valid_xml); + } + + try + { + double x = XmlConvert.ToDouble(xElement.Value); + double y = XmlConvert.ToDouble(yElement.Value); + return new Point2D(x, y); + } + catch (SystemException e) when (e is ArgumentNullException + || e is FormatException + || e is OverflowException) + { + throw new SoilLayerConversionException(Resources.SoilLayer2DGeometryReader_Could_not_parse_point_location, e); + } + } + + /// /// Creates sorted segments from . /// /// The unsorted segments to get the sorted segments from. /// An array of sorted segments. /// Thrown when /// contains disconnected segments. - private static IEnumerable CreateSortedSegments(Segment2D[] unsortedSegments) + private static IEnumerable GetSortedSegments(Segment2D[] unsortedSegments) { Point2D[] sortedPoints = GetSortedPoints(unsortedSegments); int sortedPointsLength = sortedPoints.Length; @@ -269,55 +318,5 @@ return sortedPoints.ToArray(); } - - /// - /// Parses the XML element to create a . - /// - /// The geometry curve element. - /// Thrown when - /// XML for geometry curve is invalid. - private static Segment2D ParseGeometryCurve(XElement curve) - { - XElement headDefinition = curve.Element(headPointElementName); - XElement endDefinition = curve.Element(endPointElementName); - if (headDefinition == null || endDefinition == null) - { - throw new SoilLayerConversionException(Resources.SoilLayer2DGeometryReader_Geometry_contains_no_valid_xml); - } - - return new Segment2D(ParsePoint(headDefinition), ParsePoint(endDefinition)); - } - - /// - /// Parses the XML element to create a . - /// - /// The 2D point element. - /// Thrown when any of the following occurs: - /// - /// A coordinate value cannot be parsed; - /// XML for 2D point is invalid. - /// - private static Point2D ParsePoint(XElement point) - { - XElement xElement = point.Element(xElementName); - XElement yElement = point.Element(zElementName); - if (xElement == null || yElement == null) - { - throw new SoilLayerConversionException(Resources.SoilLayer2DGeometryReader_Geometry_contains_no_valid_xml); - } - - try - { - double x = XmlConvert.ToDouble(xElement.Value); - double y = XmlConvert.ToDouble(yElement.Value); - return new Point2D(x, y); - } - catch (SystemException e) when (e is ArgumentNullException - || e is FormatException - || e is OverflowException) - { - throw new SoilLayerConversionException(Resources.SoilLayer2DGeometryReader_Could_not_parse_point_location, e); - } - } } } \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer2DLoop.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer2DLoop.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilLayer2DLoop.cs (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -0,0 +1,86 @@ +// 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 Ringtoets.Common.IO.Properties; + +namespace Ringtoets.Common.IO.SoilProfile +{ + /// + /// Class containing the outer geometry of a 2D soil layer. + /// + public class SoilLayer2DLoop + { + /// + /// Creates a new instance of . + /// + /// Thrown when do not form a loop. + public SoilLayer2DLoop(Segment2D[] segments) + { + CheckValidLoop(segments); + + Segments = segments; + } + + /// + /// Gets the segments of the loop. + /// + /// The points in the segments are ordered. + public Segment2D[] Segments { get; } + + /// + /// Validates that form a loop. + /// + /// The segments to validate. + /// Thrown when do not form a loop. + /// The points in must be ordered. + private static void CheckValidLoop(Segment2D[] segments) + { + if (segments.Length == 1 || !IsValidLoop(segments)) + { + throw new ArgumentException(Resources.Loop_contains_disconnected_segments); + } + } + + private static bool IsValidLoop(Segment2D[] segments) + { + int segmentCount = segments.Length; + if (segmentCount == 2) + { + return segments[0].Equals(segments[1]); + } + + for (var i = 0; i < segmentCount; i++) + { + Segment2D segmentA = segments[i]; + Segment2D segmentB = segments[(i + 1) % segmentCount]; + + if (!segmentA.SecondPoint.Equals(segmentB.FirstPoint)) + { + return false; + } + } + + return true; + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile2DReader.cs =================================================================== diff -u -r0fa0d88d03cc6adb9d820c65c4c7a43e853ef5a3 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile2DReader.cs (.../SoilProfile2DReader.cs) (revision 0fa0d88d03cc6adb9d820c65c4c7a43e853ef5a3) +++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/SoilProfile2DReader.cs (.../SoilProfile2DReader.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -171,19 +171,19 @@ private SoilProfile2D TryReadSoilProfile() { var criticalProperties = new CriticalProfileProperties(this); - var soilLayers = new List(); + var soilLayerGeometries = new List(); var stresses = new List(); long soilProfileId = criticalProperties.ProfileId; RequiredProfileProperties properties; - + try { properties = new RequiredProfileProperties(this, criticalProperties.ProfileName); for (var i = 1; i <= criticalProperties.LayerCount; i++) { - soilLayers.Add(ReadSoilLayerFrom(this, criticalProperties.ProfileName)); + soilLayerGeometries.Add(ReadSoilLayerGeometryFrom(this, criticalProperties.ProfileName)); MoveNext(); } @@ -199,7 +199,7 @@ { return new SoilProfile2D(soilProfileId, criticalProperties.ProfileName, - soilLayers, + GetSoilLayers(soilLayerGeometries), stresses) { IntersectionX = properties.IntersectionX @@ -232,28 +232,105 @@ return preconsolidationStressReader.ReadPreconsolidationStresses().ToArray(); } + private static IEnumerable GetSoilLayers(List soilLayerGeometries) + { + SoilLayer2DLoop[] innerLoops = soilLayerGeometries.SelectMany(slg => slg.InnerLoops).ToArray(); + + foreach (SoilLayer2DGeometry soilLayerGeometry in soilLayerGeometries) + { + if (IsNestedLayer(innerLoops, soilLayerGeometry)) + { + continue; + } + + SoilLayer2D soilLayer = CreateSoilLayer2D(soilLayerGeometry); + + CreateNestedSoilLayersRecursively(soilLayerGeometries, soilLayerGeometry, soilLayer); + + yield return soilLayer; + } + } + + private static void CreateNestedSoilLayersRecursively(List soilLayerGeometries, SoilLayer2DGeometry soilLayerGeometry, SoilLayer2D soilLayer) + { + var nestedLayers = new List(); + + foreach (SoilLayer2DLoop innerLoop in soilLayerGeometry.InnerLoops) + { + SoilLayer2DGeometry nestedSoilLayerGeometry = soilLayerGeometries.First(slg => slg.OuterLoop.Segments.SequenceEqual(innerLoop.Segments)); + SoilLayer2D nestedSoilLayer = CreateSoilLayer2D(nestedSoilLayerGeometry); + + CreateNestedSoilLayersRecursively(soilLayerGeometries, nestedSoilLayerGeometry, nestedSoilLayer); + + nestedLayers.Add(nestedSoilLayer); + } + + soilLayer.NestedLayers = StripDuplicateNestedLayers(nestedLayers); + } + + private static SoilLayer2D CreateSoilLayer2D(SoilLayer2DGeometry soilLayerGeometry) + { + var soilLayer = new SoilLayer2D(soilLayerGeometry.OuterLoop, soilLayerGeometry.InnerLoops); + + SoilLayerHelper.SetSoilLayerBaseProperties(soilLayer, soilLayerGeometry.LayerProperties); + + return soilLayer; + } + + private static bool IsNestedLayer(IEnumerable innerLoops, SoilLayer2DGeometry soilLayerGeometry) + { + return innerLoops.Any(il => il.Segments.SequenceEqual(soilLayerGeometry.OuterLoop.Segments)); + } + + private static IEnumerable StripDuplicateNestedLayers(List nestedLayers) + { + return nestedLayers.Where(nl => !nestedLayers.Except( + new[] + { + nl + }) + .SelectMany(GetLayersRecursively) + .Any(l => l.OuterLoop.Segments.SequenceEqual(nl.OuterLoop.Segments))); + } + + private static IEnumerable GetLayersRecursively(SoilLayer2D soilLayer) + { + var layers = new List + { + soilLayer + }; + + foreach (SoilLayer2D nestedLayer in soilLayer.NestedLayers) + { + layers.AddRange(GetLayersRecursively(nestedLayer)); + } + + return layers; + } + /// - /// Reads a from the given . + /// Reads a from the given . /// - /// Thrown when reading properties of the layers failed. - private static SoilLayer2D ReadSoilLayerFrom(IRowBasedDatabaseReader reader, string profileName) + /// The reader to read the geometry from. + /// The name of the profile to read the geometry for. + /// A . + /// Thrown when reading properties of the geometry failed. + private static SoilLayer2DGeometry ReadSoilLayerGeometryFrom(IRowBasedDatabaseReader reader, string profileName) { var properties = new Layer2DProperties(reader, profileName); - byte[] geometryValue = properties.GeometryValue; - SoilLayer2D soilLayer; try { - soilLayer = new SoilLayer2DGeometryReader().Read(geometryValue); + SoilLayer2DGeometry soilLayerGeometry = new SoilLayer2DGeometryReader().Read(properties.GeometryValue); + + soilLayerGeometry.LayerProperties = properties; + + return soilLayerGeometry; } catch (SoilLayerConversionException e) { throw CreateSoilProfileReadException(reader.Path, profileName, e); } - - SoilLayerHelper.SetSoilLayerBaseProperties(soilLayer, properties); - - return soilLayer; } private static SoilProfileReadException CreateSoilProfileReadException(string filePath, string profileName, Exception innerException) Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj =================================================================== diff -u -r4840075b1266d759456ee0bc4a0d561e428cf5f1 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 4840075b1266d759456ee0bc4a0d561e428cf5f1) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -122,6 +122,7 @@ + Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilLayer2DGeometryReaderTest.cs =================================================================== diff -u -r7733b872eca9cfa426bc0979f25ae3f7e2f78453 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilLayer2DGeometryReaderTest.cs (.../SoilLayer2DGeometryReaderTest.cs) (revision 7733b872eca9cfa426bc0979f25ae3f7e2f78453) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilLayer2DGeometryReaderTest.cs (.../SoilLayer2DGeometryReaderTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -41,10 +41,10 @@ public void Constructor_ReturnsNewInstance() { // Call - var result = new SoilLayer2DGeometryReader(); + var reader = new SoilLayer2DGeometryReader(); // Assert - Assert.NotNull(result); + Assert.NotNull(reader); } [Test] @@ -121,36 +121,36 @@ } [Test] - public void Read_XmlDocumentWithEmptyInnerLoopsAndEmptyOuterLoop_ReturnsLayerWithoutInnerLoopsAndWithEmptyOuterLoop() + public void Read_XmlDocumentWithEmptyInnerLoopsAndEmptyOuterLoop_ReturnsLayerGeometryWithoutInnerLoopsAndWithEmptyOuterLoop() { // Setup XDocument xmlDoc = GetXmlDocument(""); var reader = new SoilLayer2DGeometryReader(); // Call - SoilLayer2D result = reader.Read(xmlDoc); + SoilLayer2DGeometry geometry = reader.Read(xmlDoc); // Assert - Assert.NotNull(result); - CollectionAssert.IsEmpty(result.OuterLoop); - Assert.AreEqual(0, result.InnerLoops.Count()); + Assert.NotNull(geometry); + CollectionAssert.IsEmpty(geometry.OuterLoop.Segments); + Assert.AreEqual(0, geometry.InnerLoops.Count()); } [Test] - public void Read_XmlDocumentWithEmptyInnerLoopAndEmptyOuterLoop_ReturnsLayerWithEmptyInnerLoopAndEmptyOuterLoop() + public void Read_XmlDocumentWithEmptyInnerLoopAndEmptyOuterLoop_ReturnsLayerGeometryWithEmptyInnerLoopAndEmptyOuterLoop() { // Setup XDocument xmlDoc = GetXmlDocument(""); var reader = new SoilLayer2DGeometryReader(); // Call - SoilLayer2D result = reader.Read(xmlDoc); + SoilLayer2DGeometry geometry = reader.Read(xmlDoc); // Assert - Assert.NotNull(result); - CollectionAssert.IsEmpty(result.OuterLoop); - Assert.AreEqual(1, result.InnerLoops.Count()); - CollectionAssert.IsEmpty(result.InnerLoops.ElementAt(0)); + Assert.NotNull(geometry); + CollectionAssert.IsEmpty(geometry.OuterLoop.Segments); + Assert.AreEqual(1, geometry.InnerLoops.Count()); + CollectionAssert.IsEmpty(geometry.InnerLoops.ElementAt(0).Segments); } [Test] @@ -230,7 +230,7 @@ } [Test] - public void Read_XmlDocumentWithOneSegment_ThrowSoilLayerConversionException() + public void Read_XmlDocumentWithOneSegment_ThrowsSoilLayerConversionException() { // Setup XDocument xmlDoc = GetXmlDocument( @@ -252,34 +252,34 @@ [Test] [SetCulture("nl-NL")] - public void Read_NLXmlDocumentWithSegmentsInOuterLoop_ReturnsLayerWithOuterLoopWithSegments() + public void Read_NLXmlDocumentWithSegmentsInOuterLoop_ReturnsLayerGeometryWithOuterLoopWithSegments() { - Read_XmlDocumentWithSegmentsInOuterLoop_ReturnsLayerWithOuterLoopWithSegments(); + Read_XmlDocumentWithSegmentsInOuterLoop_ReturnsLayerGeometryWithOuterLoopWithSegments(); } [Test] [SetCulture("en-US")] - public void Read_ENXmlDocumentWithSegmentsInOuterLoop_ReturnsLayerWithOuterLoopWithSegments() + public void Read_ENXmlDocumentWithSegmentsInOuterLoop_ReturnsLayerGeometryWithOuterLoopWithSegments() { - Read_XmlDocumentWithSegmentsInOuterLoop_ReturnsLayerWithOuterLoopWithSegments(); + Read_XmlDocumentWithSegmentsInOuterLoop_ReturnsLayerGeometryWithOuterLoopWithSegments(); } [Test] [SetCulture("nl-NL")] - public void Read_NLXmlDocumentWithSegmentsInInnerLoop_ReturnsLayerWithInnerLoopWithSegments() + public void Read_NLXmlDocumentWithSegmentsInInnerLoop_ReturnsLayerGeometryWithInnerLoopWithSegments() { - Read_XmlDocumentWithSegmentsInInnerLoop_ReturnsLayerWithInnerLoopWithSegments(); + Read_XmlDocumentWithSegmentsInInnerLoop_ReturnsLayerGeometryWithInnerLoopWithSegments(); } [Test] [SetCulture("en-US")] - public void Read_ENXmlDocumentWithSegmentsInInnerLoop_ReturnsLayerWithInnerLoopWithSegments() + public void Read_ENXmlDocumentWithSegmentsInInnerLoop_ReturnsLayerGeometryWithInnerLoopWithSegments() { - Read_XmlDocumentWithSegmentsInInnerLoop_ReturnsLayerWithInnerLoopWithSegments(); + Read_XmlDocumentWithSegmentsInInnerLoop_ReturnsLayerGeometryWithInnerLoopWithSegments(); } [Test] - public static void Read_XmlDocumentWithTwoEqualSegmentsInOuterLoop_ReturnsLayerWithOuterLoopWithSegments() + public static void Read_XmlDocumentWithTwoEqualSegmentsInOuterLoop_ReturnsLayerGeometryWithOuterLoopWithSegments() { // Setup CultureInfo invariantCulture = CultureInfo.InvariantCulture; @@ -303,19 +303,19 @@ var reader = new SoilLayer2DGeometryReader(); // Call - SoilLayer2D result = reader.Read(bytes); + SoilLayer2DGeometry geometry = reader.Read(bytes); // Assert - Assert.NotNull(result); + Assert.NotNull(geometry); CollectionAssert.AreEqual(new List { new Segment2D(new Point2D(point1, point1), new Point2D(point2, point2)), new Segment2D(new Point2D(point2, point2), new Point2D(point1, point1)) - }, result.OuterLoop); + }, geometry.OuterLoop.Segments); } [Test] - public static void Read_XmlDocumentWithTwoEqualSegmentsInInnerLoop_ReturnsLayerWithInnerLoopWithSegments() + public static void Read_XmlDocumentWithTwoEqualSegmentsInInnerLoop_ReturnsLayerGeometryWithInnerLoopWithSegments() { // Setup CultureInfo invariantCulture = CultureInfo.InvariantCulture; @@ -340,19 +340,19 @@ var reader = new SoilLayer2DGeometryReader(); // Call - SoilLayer2D result = reader.Read(bytes); + SoilLayer2DGeometry geometry = reader.Read(bytes); // Assert - Assert.NotNull(result); + Assert.NotNull(geometry); CollectionAssert.AreEqual(new List { new Segment2D(new Point2D(point1, point1), new Point2D(point2, point2)), new Segment2D(new Point2D(point2, point2), new Point2D(point1, point1)) - }, result.InnerLoops.ElementAt(0)); + }, geometry.InnerLoops.ElementAt(0).Segments); } [Test] - public static void Read_XmlDocumentWithScrambledSegmentsInOuterLoop_ReturnsLayerWithOuterLoopWithSortedSegments( + public static void Read_XmlDocumentWithScrambledSegmentsInOuterLoop_ReturnsLayerGeometryWithOuterLoopWithSortedSegments( [Values(true, false)] bool firstSegmentInverted, [Values(true, false)] bool secondSegmentInverted) { @@ -391,20 +391,20 @@ var reader = new SoilLayer2DGeometryReader(); // Call - SoilLayer2D result = reader.Read(bytes); + SoilLayer2DGeometry geometry = reader.Read(bytes); // Assert - Assert.NotNull(result); + Assert.NotNull(geometry); CollectionAssert.AreEqual(new List { new Segment2D(new Point2D(1.1, 1.1), new Point2D(2.2, 2.2)), new Segment2D(new Point2D(2.2, 2.2), new Point2D(3.3, 3.3)), new Segment2D(new Point2D(3.3, 3.3), new Point2D(1.1, 1.1)) - }, result.OuterLoop); + }, geometry.OuterLoop.Segments); } [Test] - public static void Read_XmlDocumentWithScrambledSegmentsInInnerLoop_ReturnsLayerWithInnerLoopWithSortedSegments( + public static void Read_XmlDocumentWithScrambledSegmentsInInnerLoop_ReturnsLayerGeometryWithInnerLoopWithSortedSegments( [Values(true, false)] bool firstSegmentInverted, [Values(true, false)] bool secondSegmentInverted) { @@ -443,20 +443,20 @@ var reader = new SoilLayer2DGeometryReader(); // Call - SoilLayer2D result = reader.Read(bytes); + SoilLayer2DGeometry geometry = reader.Read(bytes); // Assert - Assert.NotNull(result); + Assert.NotNull(geometry); CollectionAssert.AreEqual(new List { new Segment2D(new Point2D(1.1, 1.1), new Point2D(2.2, 2.2)), new Segment2D(new Point2D(2.2, 2.2), new Point2D(3.3, 3.3)), new Segment2D(new Point2D(3.3, 3.3), new Point2D(1.1, 1.1)) - }, result.InnerLoops.ElementAt(0)); + }, geometry.InnerLoops.ElementAt(0).Segments); } [Test] - public static void Read_XmlDocumentWithSegmentsInOuterLoopThatAreNotConnected_ThrowSoilLayerConversionException() + public static void Read_XmlDocumentWithSegmentsInOuterLoopThatAreNotConnected_ThrowsSoilLayerConversionException() { // Setup CultureInfo invariantCulture = CultureInfo.InvariantCulture; @@ -494,7 +494,7 @@ } [Test] - public static void Read_XmlDocumentWithSegmentsInInnerLoopThatAreNotConnected_ThrowSoilLayerConversionException() + public static void Read_XmlDocumentWithSegmentsInInnerLoopThatAreNotConnected_ThrowsSoilLayerConversionException() { // Setup CultureInfo invariantCulture = CultureInfo.InvariantCulture; @@ -531,7 +531,7 @@ Assert.AreEqual("De segmenten van de geometrie van de laag vormen geen lus.", exception.Message); } - private static void Read_XmlDocumentWithSegmentsInOuterLoop_ReturnsLayerWithOuterLoopWithSegments() + private static void Read_XmlDocumentWithSegmentsInOuterLoop_ReturnsLayerGeometryWithOuterLoopWithSegments() { // Setup CultureInfo invariantCulture = CultureInfo.InvariantCulture; @@ -560,19 +560,19 @@ var reader = new SoilLayer2DGeometryReader(); // Call - SoilLayer2D result = reader.Read(bytes); + SoilLayer2DGeometry geometry = reader.Read(bytes); // Assert - Assert.NotNull(result); + Assert.NotNull(geometry); CollectionAssert.AreEqual(new List { new Segment2D(new Point2D(point1, point1), new Point2D(point2, point2)), new Segment2D(new Point2D(point2, point2), new Point2D(point3, point3)), new Segment2D(new Point2D(point3, point3), new Point2D(point1, point1)) - }, result.OuterLoop); + }, geometry.OuterLoop.Segments); } - private static void Read_XmlDocumentWithSegmentsInInnerLoop_ReturnsLayerWithInnerLoopWithSegments() + private static void Read_XmlDocumentWithSegmentsInInnerLoop_ReturnsLayerGeometryWithInnerLoopWithSegments() { // Setup CultureInfo invariantCulture = CultureInfo.InvariantCulture; @@ -604,16 +604,16 @@ var reader = new SoilLayer2DGeometryReader(); // Call - SoilLayer2D result = reader.Read(bytes); + SoilLayer2DGeometry geometry = reader.Read(bytes); // Assert - Assert.NotNull(result); + Assert.NotNull(geometry); CollectionAssert.AreEqual(new List { new Segment2D(new Point2D(point1, point1), new Point2D(point2, point2)), new Segment2D(new Point2D(point2, point2), new Point2D(point3, point3)), new Segment2D(new Point2D(point3, point3), new Point2D(point1, point1)) - }, result.InnerLoops.ElementAt(0)); + }, geometry.InnerLoops.ElementAt(0).Segments); } /// Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilLayer2DLoopTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilLayer2DLoopTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilLayer2DLoopTest.cs (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -0,0 +1,99 @@ +// 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.IO.SoilProfile; + +namespace Ringtoets.Common.IO.Test.SoilProfile +{ + [TestFixture] + public class SoilLayer2DLoopTest + { + [Test] + public void Constructor_ConnectedSegments_SetsSegments() + { + // Setup + var pointA = new Point2D(0.0, 0.0); + var pointB = new Point2D(1.0, 0.0); + + var arrayWithConnectedSegments = new[] + { + new Segment2D(pointA, pointB), + new Segment2D(pointB, pointA) + }; + + // Call + var loop = new SoilLayer2DLoop(arrayWithConnectedSegments); + + // Assert + Assert.AreSame(arrayWithConnectedSegments, loop.Segments); + } + + [Test] + public void Constructor_DisconnectedSegment_ThrowsArgumentException() + { + // Setup + var pointA = new Point2D(0.0, 0.0); + var pointB = new Point2D(1.0, 0.0); + var pointC = new Point2D(0.0, 1.0e-20); + + var arrayWithDisconnectedSegment = new[] + { + new Segment2D(pointA, pointB), + new Segment2D(pointB, pointC) + }; + + // Call + TestDelegate test = () => { new SoilLayer2DLoop(arrayWithDisconnectedSegment); }; + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("De segmenten van de geometrie van de laag vormen geen lus.", exception.Message); + } + + [Test] + public void Constructor_InversedSegment_ThrowsArgumentException() + { + // Setup + var pointA = new Point2D(0.0, 0.0); + var pointB = new Point2D(1.0, 0.0); + var pointC = new Point2D(2.0, 0.0); + var pointD = new Point2D(0.0, 0.0); + + var arrayWithInversedSegment = new[] + { + new Segment2D(pointA, pointB), + new Segment2D(pointB, pointC), + new Segment2D(pointD, pointC), + new Segment2D(pointD, pointA) + }; + + // Call + TestDelegate test = () => { new SoilLayer2DLoop(arrayWithInversedSegment); }; + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("De segmenten van de geometrie van de laag vormen geen lus.", exception.Message); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilLayer2DTest.cs =================================================================== diff -u -r81c5d66d833f70321f62b685004c46cd5e835131 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilLayer2DTest.cs (.../SoilLayer2DTest.cs) (revision 81c5d66d833f70321f62b685004c46cd5e835131) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilLayer2DTest.cs (.../SoilLayer2DTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -32,160 +32,41 @@ public class SoilLayer2DTest { [Test] - public void DefaultConstructor_ExpectedPropertiesSet() + public void Constructor_ExpectedPropertiesSet() { + // Setup + var outerLoop = new SoilLayer2DLoop(new Segment2D[0]); + IEnumerable innerLoops = Enumerable.Empty(); + // Call - var layer = new SoilLayer2D(); + var layer = new SoilLayer2D(outerLoop, innerLoops); // Assert Assert.IsInstanceOf(layer); + Assert.AreSame(outerLoop, layer.OuterLoop); + Assert.AreSame(innerLoops, layer.InnerLoops); } [Test] - public void OuterLoop_NullValue_ThrowsArgumentNullException() + public void Constructor_OuterLoopNull_ThrowsArgumentNullException() { - // Setup - var layer = new SoilLayer2D(); - // Call - TestDelegate test = () => layer.OuterLoop = null; + TestDelegate test = () => new SoilLayer2D(null, Enumerable.Empty()); // Assert string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("value", paramName); + Assert.AreEqual("outerLoop", paramName); } [Test] - public void OuterLoop_DisconnectedSegment_ThrowsArgumentException() + public void Constructor_InnerLoopsNull_ThrowsArgumentNullException() { - // Setup - var layer = new SoilLayer2D(); - // Call - TestDelegate test = () => layer.OuterLoop = CreateLoopWithDisconnectedSegment(); + TestDelegate test = () => new SoilLayer2D(new SoilLayer2DLoop(new Segment2D[0]), null); // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("De segmenten van de geometrie van de laag vormen geen lus.", exception.Message); + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("innerLoops", paramName); } - - [Test] - public void OuterLoop_InversedSegment_ThrowsArgumentException() - { - // Setup - var layer = new SoilLayer2D(); - - // Call - TestDelegate test = () => layer.OuterLoop = CreateLoopWithInversedSegment(); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("De segmenten van de geometrie van de laag vormen geen lus.", exception.Message); - } - - [Test] - public void OuterLoop_ConnectedSegments_SetsNewLoop() - { - // Setup - var layer = new SoilLayer2D(); - var pointA = new Point2D(0.0, 0.0); - var pointB = new Point2D(1.0, 0.0); - - // Call - layer.OuterLoop = new List - { - new Segment2D(pointA, pointB), - new Segment2D(pointB, pointA) - }; - - // Assert - Assert.NotNull(layer.OuterLoop); - CollectionAssert.AreEqual(new [] - { - new Segment2D(pointA, pointB), - new Segment2D(pointB, pointA) - }, layer.OuterLoop); - } - - [Test] - public void AddInnerLoop_DisconnectedSegment_ThrowsArgumentException() - { - // Setup - var layer = new SoilLayer2D(); - - // Call - TestDelegate test = () => layer.AddInnerLoop(CreateLoopWithDisconnectedSegment()); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("De segmenten van de geometrie van de laag vormen geen lus.", exception.Message); - } - - [Test] - public void AddInnerLoop_InversedSegment_ThrowsArgumentException() - { - // Setup - var layer = new SoilLayer2D(); - - // Call - TestDelegate test = () => layer.AddInnerLoop(CreateLoopWithInversedSegment()); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("De segmenten van de geometrie van de laag vormen geen lus.", exception.Message); - } - - [Test] - public void AddInnerLoop_ConnectedSegments_SetsNewLoop() - { - // Setup - var layer = new SoilLayer2D(); - var pointA = new Point2D(0.0, 0.0); - var pointB = new Point2D(1.0, 0.0); - - // Call - layer.AddInnerLoop(new List - { - new Segment2D(pointA, pointB), - new Segment2D(pointB, pointA) - }); - - // Assert - Assert.AreEqual(1, layer.InnerLoops.Count()); - CollectionAssert.AreEqual(new[] - { - new Segment2D(pointA, pointB), - new Segment2D(pointB, pointA) - }, layer.InnerLoops.ElementAt(0)); - } - - private static IEnumerable CreateLoopWithDisconnectedSegment() - { - var pointA = new Point2D(0.0, 0.0); - var pointB = new Point2D(1.0, 0.0); - var pointC = new Point2D(0.0, 1.0e-20); - - return new List - { - new Segment2D(pointA, pointB), - new Segment2D(pointB, pointC) - }; - } - - private static IEnumerable CreateLoopWithInversedSegment() - { - var pointA = new Point2D(0.0, 0.0); - var pointB = new Point2D(1.0, 0.0); - var pointC = new Point2D(2.0, 0.0); - var pointD = new Point2D(0.0, 0.0); - - return new List - { - new Segment2D(pointA, pointB), - new Segment2D(pointB, pointC), - new Segment2D(pointD, pointC), - new Segment2D(pointD, pointA) - }; - } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilProfile2DTest.cs =================================================================== diff -u -rd0d3ed3067ec66c52283bd4d1c44011b1a412492 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilProfile2DTest.cs (.../SoilProfile2DTest.cs) (revision d0d3ed3067ec66c52283bd4d1c44011b1a412492) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/SoilProfile/SoilProfile2DTest.cs (.../SoilProfile2DTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -23,6 +23,7 @@ using System.Linq; using NUnit.Framework; using Ringtoets.Common.IO.SoilProfile; +using Ringtoets.Common.IO.TestUtil; namespace Ringtoets.Common.IO.Test.SoilProfile { @@ -35,7 +36,7 @@ // Setup var soilLayer2Ds = new[] { - new SoilLayer2D() + SoilLayer2DTestFactory.CreateSoilLayer2D() }; // Call @@ -63,7 +64,7 @@ // Setup var soilLayer2Ds = new[] { - new SoilLayer2D() + SoilLayer2DTestFactory.CreateSoilLayer2D() }; // Call @@ -82,7 +83,7 @@ const string name = "some name"; var soilLayer2Ds = new[] { - new SoilLayer2D() + SoilLayer2DTestFactory.CreateSoilLayer2D() }; var stresses = new[] Index: Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil.Test/SoilLayer2DTestFactoryTest.cs =================================================================== diff -u -rec201316303aa676976655dcdfd9285dcc3ec4f1 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil.Test/SoilLayer2DTestFactoryTest.cs (.../SoilLayer2DTestFactoryTest.cs) (revision ec201316303aa676976655dcdfd9285dcc3ec4f1) +++ Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil.Test/SoilLayer2DTestFactoryTest.cs (.../SoilLayer2DTestFactoryTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -129,12 +129,12 @@ }); // Assert - Assert.AreEqual(new Segment2D(pointA, pointB), soilLayer.OuterLoop.ElementAt(0)); - Assert.AreEqual(new Segment2D(pointB, pointA), soilLayer.OuterLoop.ElementAt(1)); + Assert.AreEqual(new Segment2D(pointA, pointB), soilLayer.OuterLoop.Segments.ElementAt(0)); + Assert.AreEqual(new Segment2D(pointB, pointA), soilLayer.OuterLoop.Segments.ElementAt(1)); Assert.AreEqual(1, soilLayer.InnerLoops.Count()); - Assert.AreEqual(new Segment2D(pointC, pointD), soilLayer.InnerLoops.ElementAt(0)[0]); - Assert.AreEqual(new Segment2D(pointD, pointC), soilLayer.InnerLoops.ElementAt(0)[1]); + Assert.AreEqual(new Segment2D(pointC, pointD), soilLayer.InnerLoops.ElementAt(0).Segments[0]); + Assert.AreEqual(new Segment2D(pointD, pointC), soilLayer.InnerLoops.ElementAt(0).Segments[1]); } [Test] @@ -149,12 +149,12 @@ var pointC = new Point2D(1.0, 1.0); var pointD = new Point2D(2.0, 1.0); - Assert.AreEqual(new Segment2D(pointA, pointB), soilLayer.OuterLoop.ElementAt(0)); - Assert.AreEqual(new Segment2D(pointB, pointA), soilLayer.OuterLoop.ElementAt(1)); + Assert.AreEqual(new Segment2D(pointA, pointB), soilLayer.OuterLoop.Segments.ElementAt(0)); + Assert.AreEqual(new Segment2D(pointB, pointA), soilLayer.OuterLoop.Segments.ElementAt(1)); Assert.AreEqual(1, soilLayer.InnerLoops.Count()); - Assert.AreEqual(new Segment2D(pointC, pointD), soilLayer.InnerLoops.ElementAt(0)[0]); - Assert.AreEqual(new Segment2D(pointD, pointC), soilLayer.InnerLoops.ElementAt(0)[1]); + Assert.AreEqual(new Segment2D(pointC, pointD), soilLayer.InnerLoops.ElementAt(0).Segments[0]); + Assert.AreEqual(new Segment2D(pointD, pointC), soilLayer.InnerLoops.ElementAt(0).Segments[1]); } [Test] @@ -170,12 +170,12 @@ var pointD = new Point2D(2.0, 1.0); Assert.AreEqual(0.0, soilLayer.IsAquifer); - Assert.AreEqual(new Segment2D(pointA, pointB), soilLayer.OuterLoop.ElementAt(0)); - Assert.AreEqual(new Segment2D(pointB, pointA), soilLayer.OuterLoop.ElementAt(1)); + Assert.AreEqual(new Segment2D(pointA, pointB), soilLayer.OuterLoop.Segments.ElementAt(0)); + Assert.AreEqual(new Segment2D(pointB, pointA), soilLayer.OuterLoop.Segments.ElementAt(1)); Assert.AreEqual(1, soilLayer.InnerLoops.Count()); - Assert.AreEqual(new Segment2D(pointC, pointD), soilLayer.InnerLoops.ElementAt(0)[0]); - Assert.AreEqual(new Segment2D(pointD, pointC), soilLayer.InnerLoops.ElementAt(0)[1]); + Assert.AreEqual(new Segment2D(pointC, pointD), soilLayer.InnerLoops.ElementAt(0).Segments[0]); + Assert.AreEqual(new Segment2D(pointD, pointC), soilLayer.InnerLoops.ElementAt(0).Segments[1]); } [Test] @@ -276,12 +276,12 @@ }); // Assert - Assert.AreEqual(new Segment2D(pointA, pointB), soilLayer.OuterLoop.ElementAt(0)); - Assert.AreEqual(new Segment2D(pointB, pointA), soilLayer.OuterLoop.ElementAt(1)); + Assert.AreEqual(new Segment2D(pointA, pointB), soilLayer.OuterLoop.Segments.ElementAt(0)); + Assert.AreEqual(new Segment2D(pointB, pointA), soilLayer.OuterLoop.Segments.ElementAt(1)); Assert.AreEqual(1, soilLayer.InnerLoops.Count()); - Assert.AreEqual(new Segment2D(pointC, pointD), soilLayer.InnerLoops.ElementAt(0)[0]); - Assert.AreEqual(new Segment2D(pointD, pointC), soilLayer.InnerLoops.ElementAt(0)[1]); + Assert.AreEqual(new Segment2D(pointC, pointD), soilLayer.InnerLoops.ElementAt(0).Segments[0]); + Assert.AreEqual(new Segment2D(pointD, pointC), soilLayer.InnerLoops.ElementAt(0).Segments[1]); } } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/SoilLayer2DTestFactory.cs =================================================================== diff -u -rec201316303aa676976655dcdfd9285dcc3ec4f1 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/SoilLayer2DTestFactory.cs (.../SoilLayer2DTestFactory.cs) (revision ec201316303aa676976655dcdfd9285dcc3ec4f1) +++ Ringtoets/Common/test/Ringtoets.Common.IO.TestUtil/SoilLayer2DTestFactory.cs (.../SoilLayer2DTestFactory.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; +using System.Linq; using Core.Common.Base.Geometry; using Ringtoets.Common.IO.SoilProfile; @@ -81,17 +82,11 @@ throw new ArgumentNullException(nameof(outerLoop)); } - var soilLayer2D = new SoilLayer2D + return new SoilLayer2D(new SoilLayer2DLoop(outerLoop.ToArray()), + innerLoops.Select(il => new SoilLayer2DLoop(il.ToArray())).ToArray()) { - OuterLoop = outerLoop + NestedLayers = Enumerable.Empty() }; - - foreach (IEnumerable innerLoop in innerLoops) - { - soilLayer2D.AddInnerLoop(innerLoop); - } - - return soilLayer2D; } /// Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/SoilProfileConverter.cs =================================================================== diff -u -rcfa7dc2bce5e37f5677d9c8772b68599f9e26a0c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/SoilProfileConverter.cs (.../SoilProfileConverter.cs) (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.CalculatedInput/Converters/SoilProfileConverter.cs (.../SoilProfileConverter.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -23,6 +23,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; +using Core.Common.Base.Geometry; using Ringtoets.MacroStabilityInwards.KernelWrapper.Calculators.Input; using Ringtoets.MacroStabilityInwards.Primitives; @@ -73,30 +74,37 @@ /// Thrown when /// /// is a valid value but unsupported. - private static IEnumerable ConvertLayers(IEnumerable layers) + private static IEnumerable ConvertLayers(IEnumerable layers) { return layers.Select(l => { IMacroStabilityInwardsSoilLayerData data = l.Data; - return new SoilLayer(l.OuterRing, l.Holes, new SoilLayer.ConstructionProperties - { - MaterialName = data.MaterialName, - UsePop = data.UsePop, - IsAquifer = data.IsAquifer, - ShearStrengthModel = ConvertShearStrengthModel(data.ShearStrengthModel), - AbovePhreaticLevel = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(data).GetDesignValue(), - BelowPhreaticLevel = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(data).GetDesignValue(), - Cohesion = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(data).GetDesignValue(), - FrictionAngle = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(data).GetDesignValue(), - ShearStrengthRatio = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(data).GetDesignValue(), - StrengthIncreaseExponent = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(data).GetDesignValue(), - Pop = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(data).GetDesignValue(), - DilatancyType = DilatancyType.Zero, - WaterPressureInterpolationModel = WaterPressureInterpolationModel.Automatic - }); + return new SoilLayer(RingToPoints(l.OuterRing), + l.Holes.Select(RingToPoints).ToArray(), + new SoilLayer.ConstructionProperties + { + MaterialName = data.MaterialName, + UsePop = data.UsePop, + IsAquifer = data.IsAquifer, + ShearStrengthModel = ConvertShearStrengthModel(data.ShearStrengthModel), + AbovePhreaticLevel = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(data).GetDesignValue(), + BelowPhreaticLevel = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(data).GetDesignValue(), + Cohesion = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(data).GetDesignValue(), + FrictionAngle = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(data).GetDesignValue(), + ShearStrengthRatio = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(data).GetDesignValue(), + StrengthIncreaseExponent = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(data).GetDesignValue(), + Pop = MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(data).GetDesignValue(), + DilatancyType = DilatancyType.Zero, + WaterPressureInterpolationModel = WaterPressureInterpolationModel.Automatic + }); }).ToArray(); } + private static Point2D[] RingToPoints(Ring ring) + { + return ring.Points.ToArray(); + } + private static IEnumerable ConvertPreconsolidationStresses( IEnumerable preconsolidationStresses) { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/Ringtoets.MacroStabilityInwards.Data.csproj =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/Ringtoets.MacroStabilityInwards.Data.csproj (.../Ringtoets.MacroStabilityInwards.Data.csproj) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/Ringtoets.MacroStabilityInwards.Data.csproj (.../Ringtoets.MacroStabilityInwards.Data.csproj) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -69,23 +69,21 @@ - - + - Fisheye: Tag 7585d2fd78627d94d55ffa16423af90a91e4efd4 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/IMacroStabilityInwardsSoilLayer.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/IMacroStabilityInwardsSoilProfile.cs =================================================================== diff -u -rdbde8403414339f201e9c9250d4931f1d37f1f24 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/IMacroStabilityInwardsSoilProfile.cs (.../IMacroStabilityInwardsSoilProfile.cs) (revision dbde8403414339f201e9c9250d4931f1d37f1f24) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/IMacroStabilityInwardsSoilProfile.cs (.../IMacroStabilityInwardsSoilProfile.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -20,6 +20,7 @@ // All rights reserved. using System.Collections.Generic; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Data.SoilProfile { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilLayer1D.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilLayer1D.cs (.../MacroStabilityInwardsSoilLayer1D.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilLayer1D.cs (.../MacroStabilityInwardsSoilLayer1D.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -19,6 +19,8 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using Ringtoets.MacroStabilityInwards.Primitives; + namespace Ringtoets.MacroStabilityInwards.Data.SoilProfile { /// @@ -33,15 +35,14 @@ public MacroStabilityInwardsSoilLayer1D(double top) { Top = top; - Data = new MacroStabilityInwardsSoilLayerData(); } /// /// Gets the top level of the . /// public double Top { get; } - public MacroStabilityInwardsSoilLayerData Data { get; } + public IMacroStabilityInwardsSoilLayerData Data { get; set; } public override bool Equals(object obj) { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilLayer2D.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilLayer2D.cs (.../MacroStabilityInwardsSoilLayer2D.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilLayer2D.cs (.../MacroStabilityInwardsSoilLayer2D.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -22,13 +22,14 @@ using System; using System.Collections.Generic; using System.Linq; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Data.SoilProfile { /// /// This class represents a 2D layer that was imported from D-Soil Model. /// - public class MacroStabilityInwardsSoilLayer2D : IMacroStabilityInwardsSoilLayer + public class MacroStabilityInwardsSoilLayer2D : IMacroStabilityInwardsSoilLayer2D { /// /// Creates a new instance of . @@ -48,23 +49,18 @@ throw new ArgumentNullException(nameof(holes)); } - Data = new MacroStabilityInwardsSoilLayerData(); OuterRing = outerRing; Holes = holes.ToArray(); } - /// - /// Gets the outer ring of the polygon with holes describing the surface of the . - /// public Ring OuterRing { get; } - /// - /// Gets the holes of the polygon with holes describing the surface of the . - /// public Ring[] Holes { get; } - public MacroStabilityInwardsSoilLayerData Data { get; } + public IEnumerable NestedLayers { get; set; } + public IMacroStabilityInwardsSoilLayerData Data { get; set; } + public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) @@ -87,11 +83,19 @@ unchecked { int hashCode = Data.GetHashCode(); + hashCode = (hashCode * 397) ^ OuterRing.GetHashCode(); + foreach (Ring hole in Holes) { hashCode = (hashCode * 397) ^ hole.GetHashCode(); } + + foreach (IMacroStabilityInwardsSoilLayer2D nestedLayer in NestedLayers) + { + hashCode = (hashCode * 397) ^ nestedLayer.GetHashCode(); + } + return hashCode; } } @@ -100,7 +104,8 @@ { return Data.Equals(other.Data) && OuterRing.Equals(other.OuterRing) - && Holes.SequenceEqual(other.Holes); + && Holes.SequenceEqual(other.Holes) + && NestedLayers.SequenceEqual(other.NestedLayers); } } } \ No newline at end of file Fisheye: Tag 7585d2fd78627d94d55ffa16423af90a91e4efd4 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilLayerUnderSurfaceLine.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLine.cs =================================================================== diff -u -r90a9502badff5788374461a1b2179a5dd0e866a2 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLine.cs (.../MacroStabilityInwardsSoilProfileUnderSurfaceLine.cs) (revision 90a9502badff5788374461a1b2179a5dd0e866a2) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLine.cs (.../MacroStabilityInwardsSoilProfileUnderSurfaceLine.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -36,7 +36,7 @@ /// The layers in the profile. /// The preconsolidation stresses defined for the profile. /// Thrown when any parameter is null. - public MacroStabilityInwardsSoilProfileUnderSurfaceLine(IEnumerable layers, + public MacroStabilityInwardsSoilProfileUnderSurfaceLine(IEnumerable layers, IEnumerable preconsolidationStresses) { if (layers == null) @@ -50,9 +50,9 @@ Layers = layers; PreconsolidationStresses = preconsolidationStresses; } - - public IEnumerable Layers { get; } + public IEnumerable Layers { get; } + public IEnumerable PreconsolidationStresses { get; } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineExtensions.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineExtensions.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineExtensions.cs (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -0,0 +1,65 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Ringtoets.MacroStabilityInwards.Data.SoilProfile +{ + /// + /// Extension methods dealing with instances. + /// + public static class MacroStabilityInwardsSoilProfileUnderSurfaceLineExtensions + { + /// + /// Method for obtaining all in recursively. + /// + /// The profile to get the layers from. + /// An enumerable with . + /// Thrown when is null. + public static IEnumerable GetLayersRecursively(this IMacroStabilityInwardsSoilProfileUnderSurfaceLine profile) + { + if (profile == null) + { + throw new ArgumentNullException(nameof(profile)); + } + + return profile.Layers.SelectMany(GetLayersRecursively); + } + + private static IEnumerable GetLayersRecursively(IMacroStabilityInwardsSoilLayer2D layer) + { + var layers = new List + { + layer + }; + + foreach (IMacroStabilityInwardsSoilLayer2D nestedLayer in layer.NestedLayers) + { + layers.AddRange(GetLayersRecursively(nestedLayer)); + } + + return layers; + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.cs =================================================================== diff -u -rc91246ef0f88eff9950857a6f2c404653a022dcc -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.cs (.../MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.cs) (revision c91246ef0f88eff9950857a6f2c404653a022dcc) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.cs (.../MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -90,35 +90,28 @@ private static MacroStabilityInwardsSoilProfileUnderSurfaceLine Create(MacroStabilityInwardsSoilProfile2D soilProfile) { - IEnumerable layersUnderSurfaceLine = soilProfile.Layers.Select( - layer => new MacroStabilityInwardsSoilLayerUnderSurfaceLine( - RingToPoints(layer.OuterRing), - layer.Holes.Select(RingToPoints).ToArray(), - layer.Data)).ToArray(); - - return new MacroStabilityInwardsSoilProfileUnderSurfaceLine(layersUnderSurfaceLine, soilProfile.PreconsolidationStresses); + return new MacroStabilityInwardsSoilProfileUnderSurfaceLine(soilProfile.Layers, soilProfile.PreconsolidationStresses); } - private static Point2D[] RingToPoints(Ring ring) - { - return ring.Points.ToArray(); - } - private static MacroStabilityInwardsSoilProfileUnderSurfaceLine GeometriesToIntersections(IEnumerable layerGeometries, IEnumerable surfaceLineGeometry) { - var collection = new Collection(); + var soilLayers = new Collection(); IEnumerable surfaceLineGeometryArray = surfaceLineGeometry.ToArray(); foreach (TempSoilLayerGeometry layer in layerGeometries) { foreach (Point2D[] soilLayerArea in GetSoilLayerWithSurfaceLineIntersection(surfaceLineGeometryArray, layer.OuterLoop)) { - collection.Add(new MacroStabilityInwardsSoilLayerUnderSurfaceLine(soilLayerArea, layer.Data)); + soilLayers.Add(new MacroStabilityInwardsSoilLayer2D(new Ring(soilLayerArea), Enumerable.Empty()) + { + Data = layer.Data, + NestedLayers = Enumerable.Empty() + }); } } - return new MacroStabilityInwardsSoilProfileUnderSurfaceLine(collection, Enumerable.Empty()); + return new MacroStabilityInwardsSoilProfileUnderSurfaceLine(soilLayers, Enumerable.Empty()); } private static TempSoilLayerGeometry As2DGeometry(MacroStabilityInwardsSoilLayer1D layer, MacroStabilityInwardsSoilProfile1D soilProfile, double minX, double maxX) @@ -142,15 +135,15 @@ private class TempSoilLayerGeometry { - public TempSoilLayerGeometry(Point2D[] outerLoop, MacroStabilityInwardsSoilLayerData data) + public TempSoilLayerGeometry(Point2D[] outerLoop, IMacroStabilityInwardsSoilLayerData data) { OuterLoop = outerLoop; Data = data; } public Point2D[] OuterLoop { get; } - public MacroStabilityInwardsSoilLayerData Data { get; } + public IMacroStabilityInwardsSoilLayerData Data { get; } } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsStochasticSoilModel.cs =================================================================== diff -u -rc91246ef0f88eff9950857a6f2c404653a022dcc -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsStochasticSoilModel.cs (.../MacroStabilityInwardsStochasticSoilModel.cs) (revision c91246ef0f88eff9950857a6f2c404653a022dcc) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsStochasticSoilModel.cs (.../MacroStabilityInwardsStochasticSoilModel.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -25,6 +25,7 @@ using Core.Common.Base; using Core.Common.Base.Geometry; using Ringtoets.Common.Data; +using Ringtoets.MacroStabilityInwards.Primitives; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; namespace Ringtoets.MacroStabilityInwards.Data.SoilProfile Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsStochasticSoilProfile.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsStochasticSoilProfile.cs (.../MacroStabilityInwardsStochasticSoilProfile.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/MacroStabilityInwardsStochasticSoilProfile.cs (.../MacroStabilityInwardsStochasticSoilProfile.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -23,6 +23,7 @@ using Core.Common.Base; using Ringtoets.Common.Data.Probability; using Ringtoets.MacroStabilityInwards.Data.Properties; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Data.SoilProfile { Fisheye: Tag 7585d2fd78627d94d55ffa16423af90a91e4efd4 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/SoilProfile/Ring.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs =================================================================== diff -u -re5c91cd69bfa9341f55b6fe46da5aaf23c4d64e4 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs (.../MacroStabilityInwardsChartDataFactory.cs) (revision e5c91cd69bfa9341f55b6fe46da5aaf23c4d64e4) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataFactory.cs (.../MacroStabilityInwardsChartDataFactory.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -21,7 +21,6 @@ using System; using System.Drawing; -using System.Linq; using Core.Components.Chart.Data; using Core.Components.Chart.Styles; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; @@ -199,52 +198,23 @@ } /// - /// Create for a based on its color. + /// Create for a . /// - /// The index of the in for which to create . - /// The which contains the . + /// The name of the . + /// The fill color of the . /// The created . - /// Thrown when is null. - /// Thrown when is outside the allowable range of values ([0, number_of_soil_layers>). - public static ChartMultipleAreaData CreateSoilLayerChartData(int soilLayerIndex, IMacroStabilityInwardsSoilProfile soilProfile) + public static ChartMultipleAreaData CreateSoilLayerChartData(string name, Color fillColor) { - if (soilProfile == null) - { - throw new ArgumentNullException(nameof(soilProfile)); - } - - if (soilLayerIndex < 0 || soilLayerIndex >= soilProfile.Layers.Count()) - { - throw new ArgumentOutOfRangeException(nameof(soilLayerIndex)); - } - - IMacroStabilityInwardsSoilLayer soilLayer = soilProfile.Layers.ElementAt(soilLayerIndex); - - return new ChartMultipleAreaData($"{soilLayerIndex + 1} {soilLayer.Data.MaterialName}", + return new ChartMultipleAreaData(name, new ChartAreaStyle { - FillColor = soilLayer.Data.Color, + FillColor = fillColor, StrokeColor = Color.Black, StrokeThickness = 1 }); } /// - /// Create for the holes in a . - /// - /// The created . - public static ChartMultipleAreaData CreateHolesChartData() - { - return new ChartMultipleAreaData(Resources.MacroStabilityInwardsChartDataFactory_Holes_ChartDataName, - new ChartAreaStyle - { - FillColor = Color.White, - StrokeColor = Color.Black, - StrokeThickness = 1 - }); - } - - /// /// Updates the name of based on . /// /// The to update the name for. Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataPointsFactory.cs =================================================================== diff -u -r1c8c4b9df5454eb8fb0cfa88ae328f8fb034461c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataPointsFactory.cs (.../MacroStabilityInwardsChartDataPointsFactory.cs) (revision 1c8c4b9df5454eb8fb0cfa88ae328f8fb034461c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Factories/MacroStabilityInwardsChartDataPointsFactory.cs (.../MacroStabilityInwardsChartDataPointsFactory.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -227,30 +227,19 @@ } /// - /// Create areas of holes in 2D space based on the provided . - /// - /// The soil profile to create the holes for. - /// An array with an array of points in 2D space or an empty array when - /// is null. - public static IEnumerable CreateHolesAreas(IMacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfile) - { - return soilProfile?.Layers.SelectMany(l => l.Holes).ToArray() ?? new Point2D[0][]; - } - - /// /// Create an area of the outer ring in 2D space based on the provided . /// /// The soil layer to create the outer ring for. /// A collection containing a single array of points in 2D space /// or an empty collection when is null. - public static IEnumerable CreateOuterRingArea(IMacroStabilityInwardsSoilLayerUnderSurfaceLine soilLayer) + public static IEnumerable CreateOuterRingArea(IMacroStabilityInwardsSoilLayer2D soilLayer) { return soilLayer != null - ? new[] + ? new List { - soilLayer.OuterRing + soilLayer.OuterRing.Points.ToArray() } - : new Point2D[0][]; + : Enumerable.Empty(); } /// Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r89a30d666e2e684db9d72ed16c3be18a6afad391 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 89a30d666e2e684db9d72ed16c3be18a6afad391) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -482,15 +482,6 @@ } /// - /// Looks up a localized string similar to Binnenringen. - /// - public static string MacroStabilityInwardsChartDataFactory_Holes_ChartDataName { - get { - return ResourceManager.GetString("MacroStabilityInwardsChartDataFactory_Holes_ChartDataName", resourceCulture); - } - } - - /// /// Looks up a localized string similar to De locatie met hydraulische randvoorwaarden waarvan het berekende toetspeil wordt gebruikt.. /// public static string MacroStabilityInwardsInput_HydraulicBoundaryLocation_Description { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx =================================================================== diff -u -r89a30d666e2e684db9d72ed16c3be18a6afad391 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 89a30d666e2e684db9d72ed16c3be18a6afad391) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -643,9 +643,6 @@ Eigenschappen van de waterspanningslijnen. - - Binnenringen - Zones dagelijks Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/RingProperties.cs =================================================================== diff -u -r9f936b0b29f490a024df02345df182133b1c041a -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/RingProperties.cs (.../RingProperties.cs) (revision 9f936b0b29f490a024df02345df182133b1c041a) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/RingProperties.cs (.../RingProperties.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -27,6 +27,7 @@ using Core.Common.Gui.PropertyBag; using Core.Common.Utils.Attributes; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; namespace Ringtoets.MacroStabilityInwards.Forms.PropertyClasses Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsInputView.cs =================================================================== diff -u -re5c91cd69bfa9341f55b6fe46da5aaf23c4d64e4 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsInputView.cs (.../MacroStabilityInwardsInputView.cs) (revision e5c91cd69bfa9341f55b6fe46da5aaf23c4d64e4) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsInputView.cs (.../MacroStabilityInwardsInputView.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -66,6 +66,7 @@ private readonly List soilLayerChartDataLookup; private IMacroStabilityInwardsSoilProfile currentSoilProfile; + private MacroStabilityInwardsSurfaceLine currentSurfaceLine; private MacroStabilityInwardsCalculationScenario data; @@ -146,6 +147,7 @@ chartControl.Data = chartDataCollection; UpdateChartTitle(); } + UpdateTableData(); } } @@ -172,7 +174,7 @@ private void UpdateTableData() { - soilLayerDataTable.SetData(data?.InputParameters.StochasticSoilProfile?.SoilProfile.Layers.Select(l => l.Data)); + soilLayerDataTable.SetData(GetSoilLayers().Select(l => l.Data)); } private void UpdateChartTitle() @@ -253,69 +255,49 @@ private void SetSoilProfileChartData(MacroStabilityInwardsSurfaceLine surfaceLine, IMacroStabilityInwardsSoilProfile soilProfile) { - if (!ReferenceEquals(currentSoilProfile, soilProfile)) + if (!ReferenceEquals(currentSoilProfile, soilProfile) || !ReferenceEquals(currentSurfaceLine, surfaceLine)) { currentSoilProfile = soilProfile; + currentSurfaceLine = surfaceLine; - SetSoilProfileChartData(soilProfile); + SetSoilProfileChartData(); } - if (soilProfile != null) - { - if (surfaceLine != null) - { - SetSoilLayerAreas(); - } - else - { - SetEmptySoilLayerAreas(); - } - } + SetSoilLayerAreas(); } - private void SetSoilProfileChartData(IMacroStabilityInwardsSoilProfile soilProfile) + private void SetSoilProfileChartData() { soilProfileChartData.Clear(); soilLayerChartDataLookup.Clear(); - GetSoilLayers().Select((layer, layerIndex) => MacroStabilityInwardsChartDataFactory.CreateSoilLayerChartData(layerIndex, soilProfile)) - .ForEachElementDo(sl => - { - soilProfileChartData.Insert(0, sl); - soilLayerChartDataLookup.Add(sl); - }); - MacroStabilityInwardsChartDataFactory.UpdateSoilProfileChartDataName(soilProfileChartData, soilProfile); + IEnumerable soilLayers = GetSoilLayers().Reverse(); - ChartMultipleAreaData holesChartData = MacroStabilityInwardsChartDataFactory.CreateHolesChartData(); - soilProfileChartData.Insert(soilLayerChartDataLookup.Count, holesChartData); - soilLayerChartDataLookup.Add(holesChartData); + soilLayers.Select((layer, layerIndex) => MacroStabilityInwardsChartDataFactory.CreateSoilLayerChartData( + $"{layerIndex + 1} {layer.Data.MaterialName}", + layer.Data.Color)) + .ForEachElementDo(sl => + { + soilProfileChartData.Insert(0, sl); + soilLayerChartDataLookup.Add(sl); + }); + + MacroStabilityInwardsChartDataFactory.UpdateSoilProfileChartDataName(soilProfileChartData, data.InputParameters.StochasticSoilProfile?.SoilProfile); } private void SetSoilLayerAreas() { - IMacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfileUnderSurfaceLine = data.InputParameters.SoilProfileUnderSurfaceLine; - var i = 0; - foreach (IMacroStabilityInwardsSoilLayerUnderSurfaceLine soilLayer in soilProfileUnderSurfaceLine.Layers) + foreach (IMacroStabilityInwardsSoilLayer2D soilLayer in GetSoilLayers().Reverse()) { ChartMultipleAreaData soilLayerData = soilLayerChartDataLookup[i++]; soilLayerData.Areas = MacroStabilityInwardsChartDataPointsFactory.CreateOuterRingArea(soilLayer); } - - soilLayerChartDataLookup.Last().Areas = MacroStabilityInwardsChartDataPointsFactory.CreateHolesAreas(soilProfileUnderSurfaceLine); } - private void SetEmptySoilLayerAreas() + private IEnumerable GetSoilLayers() { - foreach (ChartMultipleAreaData soilLayerChartData in soilLayerChartDataLookup) - { - soilLayerChartData.Areas = Enumerable.Empty(); - } + return data?.InputParameters.SoilProfileUnderSurfaceLine?.GetLayersRecursively() ?? new List(); } - - private IEnumerable GetSoilLayers() - { - return data?.InputParameters.StochasticSoilProfile?.SoilProfile.Layers.ToList() ?? new List(); - } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsOutputChartControl.cs =================================================================== diff -u -r45144248b1c5d3ee3577e21bfb5d25ebb66c4a35 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsOutputChartControl.cs (.../MacroStabilityInwardsOutputChartControl.cs) (revision 45144248b1c5d3ee3577e21bfb5d25ebb66c4a35) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsOutputChartControl.cs (.../MacroStabilityInwardsOutputChartControl.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -59,6 +59,7 @@ private readonly List soilLayerChartDataLookup; private MacroStabilityInwardsCalculationScenario data; private IMacroStabilityInwardsSoilProfile currentSoilProfile; + private MacroStabilityInwardsSurfaceLine currentSurfaceLine; /// /// Creates a new instance of . @@ -99,8 +100,6 @@ chartDataCollection.Add(surfaceLevelOutsideChartData); soilLayerChartDataLookup = new List(); - - Chart.Data = chartDataCollection; } public IChartControl Chart @@ -121,6 +120,8 @@ { data = value as MacroStabilityInwardsCalculationScenario; + chartControl.Data = data != null ? chartDataCollection : null; + UpdateChartData(); } } @@ -130,35 +131,55 @@ /// public void UpdateChartData() { - if (data?.Output != null) + if (data == null) { - SetChartData(); + return; } + + MacroStabilityInwardsInput macroStabilityInwardsInput = data.InputParameters; + MacroStabilityInwardsSurfaceLine surfaceLine = macroStabilityInwardsInput.SurfaceLine; + IMacroStabilityInwardsSoilProfile soilProfile = macroStabilityInwardsInput.StochasticSoilProfile?.SoilProfile; + + if (!ReferenceEquals(currentSoilProfile, soilProfile) || !ReferenceEquals(currentSurfaceLine, surfaceLine)) + { + currentSoilProfile = soilProfile; + currentSurfaceLine = surfaceLine; + + SetSoilProfileChartData(); + } + + if (data.Output != null) + { + SetSurfaceLineChartData(surfaceLine); + SetSoilLayerAreas(); + } else { - SetChartDataEmpty(); + SetSurfaceLineChartData(null); + SetEmptySoilLayerAreas(); } chartDataCollection.Collection.ForEachElementDo(cd => cd.NotifyObservers()); soilProfileChartData.Collection.ForEachElementDo(sp => sp.NotifyObservers()); } - private void SetChartDataEmpty() + private void SetSoilProfileChartData() { - IMacroStabilityInwardsSoilProfile soilProfile = data?.InputParameters.StochasticSoilProfile?.SoilProfile; + soilProfileChartData.Clear(); + soilLayerChartDataLookup.Clear(); - SetSurfaceLineChartData(null); - SetSoilProfileChartData(null, soilProfile); - } + IEnumerable soilLayers = GetSoilLayers().Reverse(); - private void SetChartData() - { - MacroStabilityInwardsInput macroStabilityInwardsInput = data.InputParameters; - MacroStabilityInwardsSurfaceLine surfaceLine = macroStabilityInwardsInput.SurfaceLine; - IMacroStabilityInwardsSoilProfile soilProfile = macroStabilityInwardsInput.StochasticSoilProfile?.SoilProfile; + soilLayers.Select((layer, layerIndex) => MacroStabilityInwardsChartDataFactory.CreateSoilLayerChartData( + $"{layerIndex + 1} {layer.Data.MaterialName}", + layer.Data.Color)) + .ForEachElementDo(sl => + { + soilProfileChartData.Insert(0, sl); + soilLayerChartDataLookup.Add(sl); + }); - SetSurfaceLineChartData(surfaceLine); - SetSoilProfileChartData(surfaceLine, soilProfile); + MacroStabilityInwardsChartDataFactory.UpdateSoilProfileChartDataName(soilProfileChartData, data?.InputParameters.StochasticSoilProfile?.SoilProfile); } private void SetSurfaceLineChartData(MacroStabilityInwardsSurfaceLine surfaceLine) @@ -180,58 +201,14 @@ surfaceLevelOutsideChartData.Points = MacroStabilityInwardsChartDataPointsFactory.CreateSurfaceLevelOutsidePoint(surfaceLine); } - private void SetSoilProfileChartData(MacroStabilityInwardsSurfaceLine surfaceLine, - IMacroStabilityInwardsSoilProfile soilProfile) - { - if (!ReferenceEquals(currentSoilProfile, soilProfile)) - { - currentSoilProfile = soilProfile; - - SetSoilProfileChartData(soilProfile); - } - - if (soilProfile != null) - { - if (surfaceLine != null) - { - SetSoilLayerAreas(); - } - else - { - SetEmptySoilLayerAreas(); - } - } - } - - private void SetSoilProfileChartData(IMacroStabilityInwardsSoilProfile soilProfile) - { - soilProfileChartData.Clear(); - soilLayerChartDataLookup.Clear(); - GetSoilLayers().Select((layer, layerIndex) => MacroStabilityInwardsChartDataFactory.CreateSoilLayerChartData(layerIndex, soilProfile)) - .ForEachElementDo(sl => - { - soilProfileChartData.Insert(0, sl); - soilLayerChartDataLookup.Add(sl); - }); - - ChartMultipleAreaData holesChartData = MacroStabilityInwardsChartDataFactory.CreateHolesChartData(); - soilProfileChartData.Insert(soilLayerChartDataLookup.Count, holesChartData); - soilLayerChartDataLookup.Add(holesChartData); - - MacroStabilityInwardsChartDataFactory.UpdateSoilProfileChartDataName(soilProfileChartData, soilProfile); - } - private void SetSoilLayerAreas() { - IMacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfileUnderSurfaceLine = data.InputParameters.SoilProfileUnderSurfaceLine; var i = 0; - foreach (IMacroStabilityInwardsSoilLayerUnderSurfaceLine soilLayer in soilProfileUnderSurfaceLine.Layers) + foreach (IMacroStabilityInwardsSoilLayer2D soilLayer in GetSoilLayers().Reverse()) { ChartMultipleAreaData soilLayerData = soilLayerChartDataLookup[i++]; soilLayerData.Areas = MacroStabilityInwardsChartDataPointsFactory.CreateOuterRingArea(soilLayer); } - - soilLayerChartDataLookup.Last().Areas = MacroStabilityInwardsChartDataPointsFactory.CreateHolesAreas(soilProfileUnderSurfaceLine); } private void SetEmptySoilLayerAreas() @@ -242,9 +219,9 @@ } } - private IEnumerable GetSoilLayers() + private IEnumerable GetSoilLayers() { - return data?.InputParameters.StochasticSoilProfile?.SoilProfile.Layers.ToList() ?? new List(); + return data?.InputParameters.SoilProfileUnderSurfaceLine?.GetLayersRecursively() ?? new List(); } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilLayerTransformer.cs =================================================================== diff -u -r7733b872eca9cfa426bc0979f25ae3f7e2f78453 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilLayerTransformer.cs (.../MacroStabilityInwardsSoilLayerTransformer.cs) (revision 7733b872eca9cfa426bc0979f25ae3f7e2f78453) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilLayerTransformer.cs (.../MacroStabilityInwardsSoilLayerTransformer.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -27,7 +27,6 @@ using Ringtoets.Common.Data.Probabilistics; using Ringtoets.Common.IO.Exceptions; using Ringtoets.Common.IO.SoilProfile; -using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.IO.Properties; using Ringtoets.MacroStabilityInwards.Primitives; @@ -62,10 +61,10 @@ ValidateStochasticParameters(soilLayer); - var layer = new MacroStabilityInwardsSoilLayer1D(soilLayer.Top); - SetProperties(soilLayer, layer.Data); - - return layer; + return new MacroStabilityInwardsSoilLayer1D(soilLayer.Top) + { + Data = ConvertSoilLayerData(soilLayer) + }; } /// @@ -87,72 +86,75 @@ ValidateStochasticParameters(soilLayer); - if (soilLayer.OuterLoop == null) - { - throw new ImportedDataTransformException(); - } + return ConvertLayerRecursively(soilLayer); + } - Ring outerRing = TransformSegmentsToRing(soilLayer.OuterLoop); - Ring[] innerRings = soilLayer.InnerLoops.Select(TransformSegmentsToRing).ToArray(); + private static MacroStabilityInwardsSoilLayer2D ConvertLayerRecursively(SoilLayer2D soilLayer) + { + Ring outerRing = TransformSegmentsToRing(soilLayer.OuterLoop.Segments); + Ring[] innerRings = soilLayer.InnerLoops.Select(il => TransformSegmentsToRing(il.Segments)).ToArray(); - var layer = new MacroStabilityInwardsSoilLayer2D(outerRing, innerRings); - SetProperties(soilLayer, layer.Data); - - return layer; + return new MacroStabilityInwardsSoilLayer2D(outerRing, innerRings) + { + Data = ConvertSoilLayerData(soilLayer), + NestedLayers = soilLayer.NestedLayers.Select(ConvertLayerRecursively).ToArray() + }; } /// - /// Sets the properties of the . + /// Converts into . /// /// The soil layer to get the data from. - /// The data to set the properties upon. /// Thrown when transformation would not result /// in a valid transformed instance. - private static void SetProperties(SoilLayerBase soilLayer, IMacroStabilityInwardsSoilLayerData data) + private static MacroStabilityInwardsSoilLayerData ConvertSoilLayerData(SoilLayerBase soilLayer) { - data.ShearStrengthModel = TransformShearStrengthModel(soilLayer.ShearStrengthModel); - data.UsePop = TransformUsePop(soilLayer.UsePop); - - data.MaterialName = soilLayer.MaterialName; - data.IsAquifer = TransformIsAquifer(soilLayer.IsAquifer); - data.Color = SoilLayerColorConverter.Convert(soilLayer.Color); - data.AbovePhreaticLevel = new VariationCoefficientLogNormalDistribution + return new MacroStabilityInwardsSoilLayerData { - Mean = (RoundedDouble) soilLayer.AbovePhreaticLevelMean, - CoefficientOfVariation = (RoundedDouble) soilLayer.AbovePhreaticLevelCoefficientOfVariation, - Shift = (RoundedDouble) soilLayer.AbovePhreaticLevelShift + ShearStrengthModel = TransformShearStrengthModel(soilLayer.ShearStrengthModel), + UsePop = TransformUsePop(soilLayer.UsePop), + + MaterialName = soilLayer.MaterialName, + IsAquifer = TransformIsAquifer(soilLayer.IsAquifer), + Color = SoilLayerColorConverter.Convert(soilLayer.Color), + AbovePhreaticLevel = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) soilLayer.AbovePhreaticLevelMean, + CoefficientOfVariation = (RoundedDouble) soilLayer.AbovePhreaticLevelCoefficientOfVariation, + Shift = (RoundedDouble) soilLayer.AbovePhreaticLevelShift + }, + BelowPhreaticLevel = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) soilLayer.BelowPhreaticLevelMean, + CoefficientOfVariation = (RoundedDouble) soilLayer.BelowPhreaticLevelCoefficientOfVariation, + Shift = (RoundedDouble) soilLayer.BelowPhreaticLevelShift + }, + Cohesion = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) soilLayer.CohesionMean, + CoefficientOfVariation = (RoundedDouble) soilLayer.CohesionCoefficientOfVariation + }, + FrictionAngle = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) soilLayer.FrictionAngleMean, + CoefficientOfVariation = (RoundedDouble) soilLayer.FrictionAngleCoefficientOfVariation + }, + ShearStrengthRatio = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) soilLayer.ShearStrengthRatioMean, + CoefficientOfVariation = (RoundedDouble) soilLayer.ShearStrengthRatioCoefficientOfVariation + }, + StrengthIncreaseExponent = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) soilLayer.StrengthIncreaseExponentMean, + CoefficientOfVariation = (RoundedDouble) soilLayer.StrengthIncreaseExponentCoefficientOfVariation + }, + Pop = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) soilLayer.PopMean, + CoefficientOfVariation = (RoundedDouble) soilLayer.PopCoefficientOfVariation + } }; - data.BelowPhreaticLevel = new VariationCoefficientLogNormalDistribution - { - Mean = (RoundedDouble) soilLayer.BelowPhreaticLevelMean, - CoefficientOfVariation = (RoundedDouble) soilLayer.BelowPhreaticLevelCoefficientOfVariation, - Shift = (RoundedDouble) soilLayer.BelowPhreaticLevelShift - }; - data.Cohesion = new VariationCoefficientLogNormalDistribution - { - Mean = (RoundedDouble) soilLayer.CohesionMean, - CoefficientOfVariation = (RoundedDouble) soilLayer.CohesionCoefficientOfVariation - }; - data.FrictionAngle = new VariationCoefficientLogNormalDistribution - { - Mean = (RoundedDouble) soilLayer.FrictionAngleMean, - CoefficientOfVariation = (RoundedDouble) soilLayer.FrictionAngleCoefficientOfVariation - }; - data.ShearStrengthRatio = new VariationCoefficientLogNormalDistribution - { - Mean = (RoundedDouble) soilLayer.ShearStrengthRatioMean, - CoefficientOfVariation = (RoundedDouble) soilLayer.ShearStrengthRatioCoefficientOfVariation - }; - data.StrengthIncreaseExponent = new VariationCoefficientLogNormalDistribution - { - Mean = (RoundedDouble) soilLayer.StrengthIncreaseExponentMean, - CoefficientOfVariation = (RoundedDouble) soilLayer.StrengthIncreaseExponentCoefficientOfVariation - }; - data.Pop = new VariationCoefficientLogNormalDistribution - { - Mean = (RoundedDouble) soilLayer.PopMean, - CoefficientOfVariation = (RoundedDouble) soilLayer.PopCoefficientOfVariation - }; } /// Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilProfileTransformer.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilProfileTransformer.cs (.../MacroStabilityInwardsSoilProfileTransformer.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilProfileTransformer.cs (.../MacroStabilityInwardsSoilProfileTransformer.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -24,6 +24,7 @@ using Ringtoets.Common.IO.Exceptions; using Ringtoets.Common.IO.SoilProfile; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources; namespace Ringtoets.MacroStabilityInwards.IO.SoilProfiles Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsStochasticSoilModelTransformer.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsStochasticSoilModelTransformer.cs (.../MacroStabilityInwardsStochasticSoilModelTransformer.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsStochasticSoilModelTransformer.cs (.../MacroStabilityInwardsStochasticSoilModelTransformer.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -26,6 +26,7 @@ using Ringtoets.Common.IO.SoilProfile; using Ringtoets.Common.IO.SoilProfile.Schema; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources; namespace Ringtoets.MacroStabilityInwards.IO.SoilProfiles Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsStochasticSoilProfileTransformer.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsStochasticSoilProfileTransformer.cs (.../MacroStabilityInwardsStochasticSoilProfileTransformer.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsStochasticSoilProfileTransformer.cs (.../MacroStabilityInwardsStochasticSoilProfileTransformer.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -23,6 +23,7 @@ using Ringtoets.Common.IO.Exceptions; using Ringtoets.Common.IO.SoilProfile; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.IO.SoilProfiles { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/FileImporter/MacroStabilityInwardsStochasticSoilModelUpdateDataStrategy.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/FileImporter/MacroStabilityInwardsStochasticSoilModelUpdateDataStrategy.cs (.../MacroStabilityInwardsStochasticSoilModelUpdateDataStrategy.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/FileImporter/MacroStabilityInwardsStochasticSoilModelUpdateDataStrategy.cs (.../MacroStabilityInwardsStochasticSoilModelUpdateDataStrategy.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -28,6 +28,7 @@ using Ringtoets.Common.IO.SoilProfile; using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; using Ringtoets.MacroStabilityInwards.Service; namespace Ringtoets.MacroStabilityInwards.Plugin.FileImporter Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/IMacroStabilityInwardsSoilLayer.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/IMacroStabilityInwardsSoilLayer.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/IMacroStabilityInwardsSoilLayer.cs (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -0,0 +1,34 @@ +// 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. + +namespace Ringtoets.MacroStabilityInwards.Primitives +{ + /// + /// Interface for the soil layer that can be used in macro stability inwards. + /// + public interface IMacroStabilityInwardsSoilLayer + { + /// + /// Gets the data of the soil layer. + /// + IMacroStabilityInwardsSoilLayerData Data { get; } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/IMacroStabilityInwardsSoilLayer2D.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/IMacroStabilityInwardsSoilLayer2D.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/IMacroStabilityInwardsSoilLayer2D.cs (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -0,0 +1,46 @@ +// 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.Collections.Generic; + +namespace Ringtoets.MacroStabilityInwards.Primitives +{ + /// + /// Interface for the 2D soil layer that can be used in macro stability inwards. + /// + public interface IMacroStabilityInwardsSoilLayer2D : IMacroStabilityInwardsSoilLayer + { + /// + /// Gets the outer ring of the layer. + /// + Ring OuterRing { get; } + + /// + /// Gets the holes of the layer. + /// + Ring[] Holes { get; } + + /// + /// Gets the nested layers. + /// + IEnumerable NestedLayers { get; } + } +} \ No newline at end of file Fisheye: Tag 7585d2fd78627d94d55ffa16423af90a91e4efd4 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/IMacroStabilityInwardsSoilLayerUnderSurfaceLine.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/IMacroStabilityInwardsSoilProfileUnderSurfaceLine.cs =================================================================== diff -u -r90a9502badff5788374461a1b2179a5dd0e866a2 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/IMacroStabilityInwardsSoilProfileUnderSurfaceLine.cs (.../IMacroStabilityInwardsSoilProfileUnderSurfaceLine.cs) (revision 90a9502badff5788374461a1b2179a5dd0e866a2) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/IMacroStabilityInwardsSoilProfileUnderSurfaceLine.cs (.../IMacroStabilityInwardsSoilProfileUnderSurfaceLine.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -31,7 +31,7 @@ /// /// Gets the layers in the profile. /// - IEnumerable Layers { get; } + IEnumerable Layers { get; } /// /// Gets the preconsolidation stresses in the profile. Fisheye: Tag 9f936b0b29f490a024df02345df182133b1c041a refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Ring.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Ringtoets.MacroStabilityInwards.Primitives.csproj =================================================================== diff -u -rcfa7dc2bce5e37f5677d9c8772b68599f9e26a0c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Ringtoets.MacroStabilityInwards.Primitives.csproj (.../Ringtoets.MacroStabilityInwards.Primitives.csproj) (revision cfa7dc2bce5e37f5677d9c8772b68599f9e26a0c) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/Ringtoets.MacroStabilityInwards.Primitives.csproj (.../Ringtoets.MacroStabilityInwards.Primitives.csproj) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -45,10 +45,11 @@ + + - @@ -63,6 +64,7 @@ True + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/SoilProfileConverterTest.cs =================================================================== diff -u -r68f204f50eaf5f1e881c18fb2d878a17c722f75a -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/SoilProfileConverterTest.cs (.../SoilProfileConverterTest.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.Test/Converters/SoilProfileConverterTest.cs (.../SoilProfileConverterTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -20,7 +20,6 @@ // All rights reserved. using System; -using System.Collections.Generic; using System.ComponentModel; using System.Linq; using Core.Common.Base.Data; @@ -56,14 +55,15 @@ // Setup var random = new Random(22); - var profile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine(new[] + var soilLayer = new MacroStabilityInwardsSoilLayer2D(CreateRing(21), + new[] + { + CreateRing(11), + CreateRing(22) + }) { - new MacroStabilityInwardsSoilLayerUnderSurfaceLine(CreateRing(21), new List + Data = new MacroStabilityInwardsSoilLayerData { - CreateRing(11), - CreateRing(22) - }, new MacroStabilityInwardsSoilLayerData - { UsePop = random.NextBoolean(), IsAquifer = random.NextBoolean(), MaterialName = "Test", @@ -104,17 +104,26 @@ Mean = random.NextRoundedDouble(), CoefficientOfVariation = random.NextRoundedDouble() } - }) - }, new[] - { - new MacroStabilityInwardsPreconsolidationStress(new Point2D(random.NextDouble(), random.NextDouble()), - new VariationCoefficientLogNormalDistribution - { - Mean = (RoundedDouble) 0.05, - CoefficientOfVariation = random.NextRoundedDouble() - }) - }); + } + }; + var preconsolidationStress = new MacroStabilityInwardsPreconsolidationStress(new Point2D(random.NextDouble(), random.NextDouble()), + new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 0.05, + CoefficientOfVariation = random.NextRoundedDouble() + }); + + var profile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine( + new[] + { + soilLayer + }, + new[] + { + preconsolidationStress + }); + // Call SoilProfile soilProfile = SoilProfileConverter.Convert(profile); @@ -128,11 +137,13 @@ // Setup var profile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine(new[] { - new MacroStabilityInwardsSoilLayerUnderSurfaceLine(CreateRing(21), new Point2D[0][], - new MacroStabilityInwardsSoilLayerData - { - ShearStrengthModel = (MacroStabilityInwardsShearStrengthModel) 99 - }) + new MacroStabilityInwardsSoilLayer2D(CreateRing(21), new Ring[0]) + { + Data = new MacroStabilityInwardsSoilLayerData + { + ShearStrengthModel = (MacroStabilityInwardsShearStrengthModel) 99 + } + } }, new MacroStabilityInwardsPreconsolidationStress[0]); // Call @@ -153,11 +164,13 @@ // Setup var profile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine(new[] { - new MacroStabilityInwardsSoilLayerUnderSurfaceLine(CreateRing(21), new Point2D[0][], - new MacroStabilityInwardsSoilLayerData - { - ShearStrengthModel = originalShearStrengthModel - }) + new MacroStabilityInwardsSoilLayer2D(CreateRing(21), new Ring[0]) + { + Data = new MacroStabilityInwardsSoilLayerData + { + ShearStrengthModel = originalShearStrengthModel + } + } }, new MacroStabilityInwardsPreconsolidationStress[0]); // Call @@ -167,7 +180,7 @@ Assert.AreEqual(expectedShearStrengthModel, soilProfile.Layers.First().ShearStrengthModel); } - private static Point2D[] CreateRing(int seed) + private static Ring CreateRing(int seed) { var random = new Random(seed); int x1 = random.Next(); @@ -179,13 +192,13 @@ double x4 = x1 + (x3 - x1) * random.NextDouble(); int y4 = y1; - return new[] + return new Ring(new[] { new Point2D(x1, y1), new Point2D(x2, y2), new Point2D(x3, y3), new Point2D(x4, y4) - }; + }); } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/CalculatorInputAssert.cs =================================================================== diff -u -r68f204f50eaf5f1e881c18fb2d878a17c722f75a -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/CalculatorInputAssert.cs (.../CalculatorInputAssert.cs) (revision 68f204f50eaf5f1e881c18fb2d878a17c722f75a) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.CalculatedInput.TestUtil/CalculatorInputAssert.cs (.../CalculatorInputAssert.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -41,7 +41,7 @@ /// does not correspond to . public static void AssertSoilProfile(IMacroStabilityInwardsSoilProfileUnderSurfaceLine original, SoilProfile actual) { - IMacroStabilityInwardsSoilLayerUnderSurfaceLine[] expectedLayers = original.Layers.ToArray(); + IMacroStabilityInwardsSoilLayer2D[] expectedLayers = original.Layers.ToArray(); SoilLayer[] actualLayers = actual.Layers.ToArray(); IMacroStabilityInwardsPreconsolidationStress[] expectedPreconsolidationStresses = original.PreconsolidationStresses.ToArray(); @@ -102,18 +102,18 @@ /// /// Asserts whether corresponds to . /// - /// The original array. + /// The original array. /// The actual array. /// Thrown when /// does not correspond to . - private static void AssertLayers(IMacroStabilityInwardsSoilLayerUnderSurfaceLine[] original, SoilLayer[] actual) + private static void AssertLayers(IMacroStabilityInwardsSoilLayer2D[] original, SoilLayer[] actual) { Assert.AreEqual(original.Length, actual.Length); for (var i = 0; i < original.Length; i++) { - CollectionAssert.AreEqual(original[i].OuterRing, actual[i].OuterRing); - CollectionAssert.AreEqual(original[i].Holes, actual[i].Holes); + CollectionAssert.AreEqual(original[i].OuterRing.Points, actual[i].OuterRing); + CollectionAssert.AreEqual(original[i].Holes.Select(h => h.Points), actual[i].Holes); IMacroStabilityInwardsSoilLayerData expectedData = original[i].Data; Assert.AreEqual(expectedData.MaterialName, actual[i].MaterialName); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj =================================================================== diff -u -rccbc69e92eaa4c2418f046fa83b5b5ee9fdf2c48 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj (.../Ringtoets.MacroStabilityInwards.Data.Test.csproj) (revision ccbc69e92eaa4c2418f046fa83b5b5ee9fdf2c48) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj (.../Ringtoets.MacroStabilityInwards.Data.Test.csproj) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -86,7 +86,6 @@ - Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilLayer1DTest.cs =================================================================== diff -u -rc91246ef0f88eff9950857a6f2c404653a022dcc -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilLayer1DTest.cs (.../MacroStabilityInwardsSoilLayer1DTest.cs) (revision c91246ef0f88eff9950857a6f2c404653a022dcc) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilLayer1DTest.cs (.../MacroStabilityInwardsSoilLayer1DTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -24,6 +24,7 @@ using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Data.Test.SoilProfile { @@ -41,8 +42,7 @@ // Assert Assert.IsInstanceOf(layer); - Assert.NotNull(layer); - Assert.NotNull(layer.Data); + Assert.Null(layer.Data); Assert.AreEqual(top, layer.Top); } @@ -112,21 +112,21 @@ var layerE = new MacroStabilityInwardsSoilLayer1D(3) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { Color = Color.Blue } }; var layerF = new MacroStabilityInwardsSoilLayer1D(4) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { Color = Color.Blue } }; var layerG = new MacroStabilityInwardsSoilLayer1D(3) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { Color = Color.Gold } @@ -178,7 +178,7 @@ var random = new Random(randomSeed); return new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { Color = Color.FromKnownColor(random.NextEnumValue()) } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilLayer2DTest.cs =================================================================== diff -u -rc91246ef0f88eff9950857a6f2c404653a022dcc -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilLayer2DTest.cs (.../MacroStabilityInwardsSoilLayer2DTest.cs) (revision c91246ef0f88eff9950857a6f2c404653a022dcc) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilLayer2DTest.cs (.../MacroStabilityInwardsSoilLayer2DTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -21,11 +21,13 @@ using System; using System.Drawing; +using System.Linq; using Core.Common.Base.Geometry; using Core.Common.TestUtil; using Core.Common.Utils; using NUnit.Framework; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Data.Test.SoilProfile { @@ -86,12 +88,12 @@ var layer = new MacroStabilityInwardsSoilLayer2D(outerRing, holes); // Assert - Assert.IsInstanceOf(layer); + Assert.IsInstanceOf(layer); Assert.NotNull(layer); Assert.AreSame(outerRing, layer.OuterRing); Assert.AreNotSame(holes, layer.Holes); TestHelper.AssertCollectionsAreEqual(holes, layer.Holes, new ReferenceEqualityComparer()); - Assert.NotNull(layer.Data); + Assert.Null(layer.Data); } [Test] @@ -163,7 +165,7 @@ CreateRandomRing(new Random(22)) }) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { Color = Color.Blue } @@ -175,7 +177,7 @@ CreateRandomRing(new Random(22)) }) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { Color = Color.Blue } @@ -187,7 +189,7 @@ CreateRandomRing(new Random(32)) }) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { Color = Color.Blue } @@ -199,7 +201,7 @@ CreateRandomRing(new Random(22)) }) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { Color = Color.Gold } @@ -258,10 +260,11 @@ CreateRandomRing(random) }) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { Color = Color.FromKnownColor(random.NextEnumValue()) - } + }, + NestedLayers = Enumerable.Empty() }; } Fisheye: Tag 7585d2fd78627d94d55ffa16423af90a91e4efd4 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilLayerUnderSurfaceLineTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilProfile1DTest.cs =================================================================== diff -u -rc91246ef0f88eff9950857a6f2c404653a022dcc -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilProfile1DTest.cs (.../MacroStabilityInwardsSoilProfile1DTest.cs) (revision c91246ef0f88eff9950857a6f2c404653a022dcc) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilProfile1DTest.cs (.../MacroStabilityInwardsSoilProfile1DTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -101,7 +101,7 @@ { equivalentLayers.Add(new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = i == 0 } @@ -303,6 +303,9 @@ return new MacroStabilityInwardsSoilProfile1D(name, bottom, new[] { new MacroStabilityInwardsSoilLayer1D(bottom + 1.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + } }); } @@ -321,7 +324,7 @@ { return new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { MaterialName = GetRandomName(random), Color = Color.FromKnownColor(random.NextEnumValue()), Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilProfile2DTest.cs =================================================================== diff -u -rc91246ef0f88eff9950857a6f2c404653a022dcc -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilProfile2DTest.cs (.../MacroStabilityInwardsSoilProfile2DTest.cs) (revision c91246ef0f88eff9950857a6f2c404653a022dcc) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilProfile2DTest.cs (.../MacroStabilityInwardsSoilProfile2DTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -31,6 +31,7 @@ using NUnit.Framework; using Ringtoets.Common.Data.Probabilistics; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Data.Test.SoilProfile { @@ -316,10 +317,11 @@ CreateRandomRing(random.Next()) }) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { Color = Color.FromKnownColor(random.NextEnumValue()) - } + }, + NestedLayers = Enumerable.Empty() }; } @@ -330,7 +332,7 @@ soilLayer.Holes[0] }) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { Color = soilLayer.Data.Color } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineFactoryTest.cs =================================================================== diff -u -rc91246ef0f88eff9950857a6f2c404653a022dcc -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineFactoryTest.cs (.../MacroStabilityInwardsSoilProfileUnderSurfaceLineFactoryTest.cs) (revision c91246ef0f88eff9950857a6f2c404653a022dcc) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineFactoryTest.cs (.../MacroStabilityInwardsSoilProfileUnderSurfaceLineFactoryTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -20,7 +20,6 @@ // All rights reserved. using System; -using System.Collections.Generic; using System.Linq; using Core.Common.Base.Data; using Core.Common.Base.Geometry; @@ -118,7 +117,7 @@ new Point2D(2, 2), new Point2D(0, 2), new Point2D(0, 3.2) - }, areas.Layers.ElementAt(0).OuterRing); + }, areas.Layers.ElementAt(0).OuterRing.Points); } [Test] @@ -177,7 +176,7 @@ new Point2D(2, bottom), new Point2D(0, bottom), new Point2D(0, top) - }, areas.Layers.ElementAt(0).OuterRing); + }, areas.Layers.ElementAt(0).OuterRing.Points); } [Test] @@ -215,7 +214,7 @@ new Point2D(2, bottom), new Point2D(0, bottom), new Point2D(0, top) - }, areas.Layers.ElementAt(0).OuterRing); + }, areas.Layers.ElementAt(0).OuterRing.Points); } [Test] @@ -250,7 +249,7 @@ new Point2D(2, top), new Point2D(2, bottom), new Point2D(0, bottom) - }, areas.Layers.ElementAt(0).OuterRing); + }, areas.Layers.ElementAt(0).OuterRing.Points); } [Test] @@ -285,7 +284,7 @@ new Point2D(2, bottom), new Point2D(0, bottom), new Point2D(0, top) - }, areas.Layers.ElementAt(0).OuterRing); + }, areas.Layers.ElementAt(0).OuterRing.Points); } [Test] @@ -318,14 +317,14 @@ new Point2D(3, bottom), new Point2D(0, bottom), new Point2D(0, top) - }, areas.Layers.ElementAt(0).OuterRing); + }, areas.Layers.ElementAt(0).OuterRing.Points); CollectionAssert.AreEqual(new[] { new Point2D(5, bottom), new Point2D(7, top), new Point2D(8, top), new Point2D(8, bottom) - }, areas.Layers.ElementAt(1).OuterRing); + }, areas.Layers.ElementAt(1).OuterRing.Points); } [Test] @@ -364,7 +363,7 @@ var layer = new MacroStabilityInwardsSoilLayer1D(1) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { UsePop = usePop, IsAquifer = isAquifer, @@ -450,190 +449,22 @@ } [Test] - public void SoilProfile2DCreate_ProfileWithOuterRingAndHoles_ReturnsEqualGeometries() + public void SoilProfile2DCreate_ProfileWithData_ExpectedValues() { // Setup - Ring outerRingA = CreateRing(21); - Ring outerRingB = CreateRing(12); - var holesA = new[] - { - CreateRing(4), - CreateRing(7) - }; - var holesB = new[] - { - CreateRing(4), - CreateRing(7), - CreateRing(2) - }; + var profile = new MacroStabilityInwardsSoilProfile2D("name", + new[] + { + MacroStabilityInwardsSoilLayer2DTestFactory.CreateMacroStabilityInwardsSoilLayer2D() + }, + Enumerable.Empty()); - IEnumerable layers = new[] - { - new MacroStabilityInwardsSoilLayer2D(outerRingA, holesA), - new MacroStabilityInwardsSoilLayer2D(outerRingB, holesB) - }; - var profile = new MacroStabilityInwardsSoilProfile2D("name", layers, Enumerable.Empty()); - // Call MacroStabilityInwardsSoilProfileUnderSurfaceLine profileUnderSurfaceLine = MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.Create(profile, new MacroStabilityInwardsSurfaceLine(string.Empty)); // Assert - Assert.AreEqual(2, profileUnderSurfaceLine.Layers.Count()); - CollectionAssert.AreEqual(new[] - { - outerRingA.Points, - outerRingB.Points - }, profileUnderSurfaceLine.Layers.Select(layer => layer.OuterRing)); - CollectionAssert.AreEqual(new[] - { - holesA.Select(h => h.Points), - holesB.Select(h => h.Points) - }, profileUnderSurfaceLine.Layers.Select(layer => layer.Holes)); + Assert.AreSame(profile.Layers, profileUnderSurfaceLine.Layers); + Assert.AreSame(profile.PreconsolidationStresses, profileUnderSurfaceLine.PreconsolidationStresses); } - - [Test] - public void SoilProfile2DCreate_WithData_ReturnsData() - { - // Setup - const string material = "Clay"; - - var random = new Random(21); - bool usePop = random.NextBoolean(); - bool isAquifer = random.NextBoolean(); - var shearStrengthModel = random.NextEnumValue(); - - const double abovePhreaticLevelMean = 10; - const double abovePhreaticLevelCoefficientOfVariation = 0.5; - const double abovePhreaticLevelShift = 1; - const double belowPhreaticLevelMean = 9; - const double belowPhreaticLevelCoefficientOfVariation = 0.4; - const double belowPhreaticLevelShift = 0.2; - double cohesionMean = random.NextDouble(); - double cohesionCoefficientOfVariation = random.NextDouble(); - double frictionAngleMean = random.NextDouble(); - double frictionAngleCoefficientOfVariation = random.NextDouble(); - double shearStrengthRatioMean = random.NextDouble(); - double shearStrengthRatioCoefficientOfVariation = random.NextDouble(); - double strengthIncreaseExponentMean = random.NextDouble(); - double strengthIncreaseExponentCoefficientOfVariation = random.NextDouble(); - double popMean = random.NextDouble(); - double popCoefficientOfVariation = random.NextDouble(); - - MacroStabilityInwardsSoilLayer2D layer = GetSoilLayer(); - layer.Data.UsePop = usePop; - layer.Data.IsAquifer = isAquifer; - layer.Data.ShearStrengthModel = shearStrengthModel; - layer.Data.MaterialName = material; - - layer.Data.AbovePhreaticLevel = new VariationCoefficientLogNormalDistribution - { - Mean = (RoundedDouble) abovePhreaticLevelMean, - CoefficientOfVariation = (RoundedDouble) abovePhreaticLevelCoefficientOfVariation, - Shift = (RoundedDouble) abovePhreaticLevelShift - }; - layer.Data.BelowPhreaticLevel = new VariationCoefficientLogNormalDistribution - { - Mean = (RoundedDouble) belowPhreaticLevelMean, - CoefficientOfVariation = (RoundedDouble) belowPhreaticLevelCoefficientOfVariation, - Shift = (RoundedDouble) belowPhreaticLevelShift - }; - layer.Data.Cohesion = new VariationCoefficientLogNormalDistribution - { - Mean = (RoundedDouble) cohesionMean, - CoefficientOfVariation = (RoundedDouble) cohesionCoefficientOfVariation - }; - layer.Data.FrictionAngle = new VariationCoefficientLogNormalDistribution - { - Mean = (RoundedDouble) frictionAngleMean, - CoefficientOfVariation = (RoundedDouble) frictionAngleCoefficientOfVariation - }; - layer.Data.ShearStrengthRatio = new VariationCoefficientLogNormalDistribution - { - Mean = (RoundedDouble) shearStrengthRatioMean, - CoefficientOfVariation = (RoundedDouble) shearStrengthRatioCoefficientOfVariation - }; - layer.Data.StrengthIncreaseExponent = new VariationCoefficientLogNormalDistribution - { - Mean = (RoundedDouble) strengthIncreaseExponentMean, - CoefficientOfVariation = (RoundedDouble) strengthIncreaseExponentCoefficientOfVariation - }; - layer.Data.Pop = new VariationCoefficientLogNormalDistribution - { - Mean = (RoundedDouble) popMean, - CoefficientOfVariation = (RoundedDouble) popCoefficientOfVariation - }; - - var profile = new MacroStabilityInwardsSoilProfile2D("name", new[] - { - layer - }, Enumerable.Empty()); - - // Call - MacroStabilityInwardsSoilProfileUnderSurfaceLine profileUnderSurfaceLine = MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.Create( - profile, new MacroStabilityInwardsSurfaceLine(string.Empty)); - - // Assert - Assert.AreSame(layer.Data, profileUnderSurfaceLine.Layers.First().Data); - } - - [Test] - [TestCaseSource(nameof(GetPreconsolidationStresses))] - public void SoilProfile2DCreate_WithPreconsolidationStresses_ReturnsExpectedPreconsolidationStresses( - IEnumerable preconsolidationStresses) - { - // Setup - MacroStabilityInwardsPreconsolidationStress[] expectedStresses = preconsolidationStresses.ToArray(); - var profile = new MacroStabilityInwardsSoilProfile2D("name", new[] - { - GetSoilLayer() - }, expectedStresses); - - // Call - MacroStabilityInwardsSoilProfileUnderSurfaceLine profileUnderSurfaceLine = MacroStabilityInwardsSoilProfileUnderSurfaceLineFactory.Create( - profile, new MacroStabilityInwardsSurfaceLine(string.Empty)); - - // Assert - Assert.AreSame(profileUnderSurfaceLine.PreconsolidationStresses, profileUnderSurfaceLine.PreconsolidationStresses); - } - - private static MacroStabilityInwardsSoilLayer2D GetSoilLayer() - { - return new MacroStabilityInwardsSoilLayer2D(CreateRing(21), Enumerable.Empty()); - } - - private static Ring CreateRing(int seed) - { - var random = new Random(seed); - int x1 = random.Next(); - int y1 = random.Next(); - int x2 = x1; - int y2 = y1 + random.Next(); - int x3 = x2 + random.Next(); - int y3 = y2; - double x4 = x1 + (x3 - x1) * random.NextDouble(); - int y4 = y1; - - return new Ring(new[] - { - new Point2D(x1, y1), - new Point2D(x2, y2), - new Point2D(x3, y3), - new Point2D(x4, y4) - }); - } - - private static IEnumerable GetPreconsolidationStresses() - { - yield return new TestCaseData(Enumerable.Empty()) - .SetName("No preconsolidation stresses"); - - var preconsolidationStresses = new List - { - MacroStabilityInwardsPreconsolidationStressTestFactory.CreateMacroStabilityInwardsPreconsolidationStress(), - MacroStabilityInwardsPreconsolidationStressTestFactory.CreateMacroStabilityInwardsPreconsolidationStress() - }; - yield return new TestCaseData(preconsolidationStresses) - .SetName("Multiple preconsolidation stresses"); - } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineTest.cs =================================================================== diff -u -rf2838b78c54529e9b15208b44de854f7760e350f -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineTest.cs (.../MacroStabilityInwardsSoilProfileUnderSurfaceLineTest.cs) (revision f2838b78c54529e9b15208b44de854f7760e350f) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsSoilProfileUnderSurfaceLineTest.cs (.../MacroStabilityInwardsSoilProfileUnderSurfaceLineTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -46,7 +46,7 @@ public void Constructor_PreconsolidationStressesNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new MacroStabilityInwardsSoilProfileUnderSurfaceLine(Enumerable.Empty(), + TestDelegate call = () => new MacroStabilityInwardsSoilProfileUnderSurfaceLine(Enumerable.Empty(), null); // Assert @@ -58,9 +58,8 @@ public void Constructor_WithValidParameters_NewInstanceWithPropertiesSet() { // Call - IEnumerable layers = Enumerable.Empty(); - IEnumerable preconsolidationStresses = - Enumerable.Empty(); + IEnumerable layers = Enumerable.Empty(); + IEnumerable preconsolidationStresses = Enumerable.Empty(); // Setup var profile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine(layers, preconsolidationStresses); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsStochasticSoilModelTest.cs =================================================================== diff -u -r01e3465b06b53d4447b01d3a9b6befe59a42a292 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsStochasticSoilModelTest.cs (.../MacroStabilityInwardsStochasticSoilModelTest.cs) (revision 01e3465b06b53d4447b01d3a9b6befe59a42a292) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsStochasticSoilModelTest.cs (.../MacroStabilityInwardsStochasticSoilModelTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -28,6 +28,7 @@ using NUnit.Framework; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Data.Test.SoilProfile { @@ -527,6 +528,9 @@ return new[] { new MacroStabilityInwardsSoilLayer1D(2) + { + Data = new MacroStabilityInwardsSoilLayerData() + } }; } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsStochasticSoilProfileTest.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsStochasticSoilProfileTest.cs (.../MacroStabilityInwardsStochasticSoilProfileTest.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/MacroStabilityInwardsStochasticSoilProfileTest.cs (.../MacroStabilityInwardsStochasticSoilProfileTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -26,6 +26,7 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Data.Test.SoilProfile { Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/RingTest.cs =================================================================== diff -u -r66893bb1248edc38de9409e959984dad5a4a6af6 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/RingTest.cs (.../RingTest.cs) (revision 66893bb1248edc38de9409e959984dad5a4a6af6) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/SoilProfile/RingTest.cs (.../RingTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -26,6 +26,7 @@ using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Data.Test.SoilProfile { Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/MacroStabilityInwardsCalculationScenarioFactoryTest.cs =================================================================== diff -u -r10e060be0b77c159b3e99a7200e43c4326b17642 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/MacroStabilityInwardsCalculationScenarioFactoryTest.cs (.../MacroStabilityInwardsCalculationScenarioFactoryTest.cs) (revision 10e060be0b77c159b3e99a7200e43c4326b17642) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/MacroStabilityInwardsCalculationScenarioFactoryTest.cs (.../MacroStabilityInwardsCalculationScenarioFactoryTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -313,7 +313,7 @@ { new MacroStabilityInwardsSoilLayer1D(10.56) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = false, Cohesion = new VariationCoefficientLogNormalDistribution(), @@ -334,7 +334,7 @@ }, new MacroStabilityInwardsSoilLayer1D(6.0) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = true, Cohesion = new VariationCoefficientLogNormalDistribution(), @@ -355,7 +355,7 @@ }, new MacroStabilityInwardsSoilLayer1D(0.1) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = false, Cohesion = new VariationCoefficientLogNormalDistribution(), Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/SoilProfile/MacroStabilityInwardsSoilLayer2DTestFactoryTest.cs =================================================================== diff -u -r9f936b0b29f490a024df02345df182133b1c041a -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/SoilProfile/MacroStabilityInwardsSoilLayer2DTestFactoryTest.cs (.../MacroStabilityInwardsSoilLayer2DTestFactoryTest.cs) (revision 9f936b0b29f490a024df02345df182133b1c041a) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/SoilProfile/MacroStabilityInwardsSoilLayer2DTestFactoryTest.cs (.../MacroStabilityInwardsSoilLayer2DTestFactoryTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -23,6 +23,7 @@ using NUnit.Framework; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Data.TestUtil.Test.SoilProfile { Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/SoilProfile/MacroStabilityInwardsSoilProfile2DTestFactoryTest.cs =================================================================== diff -u -r9f936b0b29f490a024df02345df182133b1c041a -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/SoilProfile/MacroStabilityInwardsSoilProfile2DTestFactoryTest.cs (.../MacroStabilityInwardsSoilProfile2DTestFactoryTest.cs) (revision 9f936b0b29f490a024df02345df182133b1c041a) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil.Test/SoilProfile/MacroStabilityInwardsSoilProfile2DTestFactoryTest.cs (.../MacroStabilityInwardsSoilProfile2DTestFactoryTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -19,10 +19,12 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Linq; using Core.Common.Base.Geometry; using NUnit.Framework; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Data.TestUtil.Test.SoilProfile { @@ -45,12 +47,20 @@ { new Point2D(0, 0), new Point2D(1, 1) - }), new Ring[0]), + }), new Ring[0]) + { + Data = new MacroStabilityInwardsSoilLayerData(), + NestedLayers = Enumerable.Empty() + }, new MacroStabilityInwardsSoilLayer2D(new Ring(new[] { new Point2D(1, 1), new Point2D(2, 2) }), new Ring[0]) + { + Data = new MacroStabilityInwardsSoilLayerData(), + NestedLayers = Enumerable.Empty() + } }, soilProfile.Layers); CollectionAssert.IsEmpty(soilProfile.PreconsolidationStresses); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsCalculationScenarioFactory.cs =================================================================== diff -u -r10e060be0b77c159b3e99a7200e43c4326b17642 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsCalculationScenarioFactory.cs (.../MacroStabilityInwardsCalculationScenarioFactory.cs) (revision 10e060be0b77c159b3e99a7200e43c4326b17642) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsCalculationScenarioFactory.cs (.../MacroStabilityInwardsCalculationScenarioFactory.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -138,7 +138,7 @@ { new MacroStabilityInwardsSoilLayer1D(top) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = false, Cohesion = new VariationCoefficientLogNormalDistribution(), @@ -159,7 +159,7 @@ }, new MacroStabilityInwardsSoilLayer1D(6.0) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = true, Cohesion = new VariationCoefficientLogNormalDistribution(), @@ -180,7 +180,7 @@ }, new MacroStabilityInwardsSoilLayer1D(0.1) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = false, Cohesion = new VariationCoefficientLogNormalDistribution(), Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsInputFactory.cs =================================================================== diff -u -r3d30a9febb6492e54f2082bf0a21a1602717b098 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsInputFactory.cs (.../MacroStabilityInwardsInputFactory.cs) (revision 3d30a9febb6492e54f2082bf0a21a1602717b098) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/MacroStabilityInwardsInputFactory.cs (.../MacroStabilityInwardsInputFactory.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -52,14 +52,14 @@ { new MacroStabilityInwardsSoilLayer1D(thicknessCoverageLayer) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = false } }, new MacroStabilityInwardsSoilLayer1D(0.0) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = true } @@ -90,7 +90,7 @@ { new MacroStabilityInwardsSoilLayer1D(0.0) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = true } @@ -122,21 +122,21 @@ { new MacroStabilityInwardsSoilLayer1D(surfaceLineTopLevel + deltaAboveSurfaceLine + 2) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = false } }, new MacroStabilityInwardsSoilLayer1D(surfaceLineTopLevel + deltaAboveSurfaceLine + 1) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = true } }, new MacroStabilityInwardsSoilLayer1D(surfaceLineTopLevel + deltaAboveSurfaceLine) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = false } @@ -168,21 +168,21 @@ { new MacroStabilityInwardsSoilLayer1D(4.3) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = false } }, new MacroStabilityInwardsSoilLayer1D(3.3) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = true } }, new MacroStabilityInwardsSoilLayer1D(1.1) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = true } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsSoilLayer2DTestFactory.cs =================================================================== diff -u -r9f936b0b29f490a024df02345df182133b1c041a -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsSoilLayer2DTestFactory.cs (.../MacroStabilityInwardsSoilLayer2DTestFactory.cs) (revision 9f936b0b29f490a024df02345df182133b1c041a) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsSoilLayer2DTestFactory.cs (.../MacroStabilityInwardsSoilLayer2DTestFactory.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -21,6 +21,7 @@ using Core.Common.Base.Geometry; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile { @@ -40,7 +41,10 @@ { new Point2D(0, 0), new Point2D(1, 1) - }), new Ring[0]); + }), new Ring[0]) + { + Data = new MacroStabilityInwardsSoilLayerData() + }; } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsSoilProfile1DTestFactory.cs =================================================================== diff -u -r9f936b0b29f490a024df02345df182133b1c041a -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsSoilProfile1DTestFactory.cs (.../MacroStabilityInwardsSoilProfile1DTestFactory.cs) (revision 9f936b0b29f490a024df02345df182133b1c041a) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsSoilProfile1DTestFactory.cs (.../MacroStabilityInwardsSoilProfile1DTestFactory.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -60,6 +60,9 @@ return new MacroStabilityInwardsSoilProfile1D(name, 0.0, new[] { new MacroStabilityInwardsSoilLayer1D(0.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + } }); } } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsSoilProfile2DTestFactory.cs =================================================================== diff -u -r9f936b0b29f490a024df02345df182133b1c041a -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsSoilProfile2DTestFactory.cs (.../MacroStabilityInwardsSoilProfile2DTestFactory.cs) (revision 9f936b0b29f490a024df02345df182133b1c041a) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.TestUtil/SoilProfile/MacroStabilityInwardsSoilProfile2DTestFactory.cs (.../MacroStabilityInwardsSoilProfile2DTestFactory.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -19,8 +19,10 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Linq; using Core.Common.Base.Geometry; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile { @@ -42,12 +44,20 @@ { new Point2D(0, 0), new Point2D(1, 1) - }), new Ring[0]), + }), new Ring[0]) + { + Data = new MacroStabilityInwardsSoilLayerData(), + NestedLayers = Enumerable.Empty() + }, new MacroStabilityInwardsSoilLayer2D(new Ring(new[] { new Point2D(1, 1), new Point2D(2, 2) }), new Ring[0]) + { + Data = new MacroStabilityInwardsSoilLayerData(), + NestedLayers = Enumerable.Empty() + } }, new MacroStabilityInwardsPreconsolidationStress[0]); } } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataFactoryTest.cs =================================================================== diff -u -re5c91cd69bfa9341f55b6fe46da5aaf23c4d64e4 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataFactoryTest.cs (.../MacroStabilityInwardsChartDataFactoryTest.cs) (revision e5c91cd69bfa9341f55b6fe46da5aaf23c4d64e4) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataFactoryTest.cs (.../MacroStabilityInwardsChartDataFactoryTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -207,62 +207,22 @@ } [Test] - public void CreateSoilLayerChartData_SoilProfileNull_ThrowsArgumentNullException() + public void CreateSoilLayerChartData_NameAndFillColor_ReturnsEmptyChartDataCollectionWithExpectedStyling() { - // Call - TestDelegate test = () => MacroStabilityInwardsChartDataFactory.CreateSoilLayerChartData(0, null); + // Setup + const string name = "Soil layer test name"; + Color fillColor = Color.Firebrick; - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("soilProfile", paramName); - } - - [Test] - [TestCase("A", 0)] - [TestCase("B", 3)] - [TestCase("Random", 5)] - public void CreateSoilLayerChartData_ValidSoilProfileAndSoilLayerIndex_ReturnsEmptyChartDataCollectionWithExpectedStyling(string name, int soilLayerIndex) - { - // Setup - var mocks = new MockRepository(); - var soilLayer = mocks.Stub(); - soilLayer.Stub(sl => sl.Data).Return(new MacroStabilityInwardsSoilLayerData - { - MaterialName = name, - Color = Color.Aquamarine - }); - - List layers = Enumerable.Repeat(mocks.Stub(), soilLayerIndex) - .ToList(); - layers.Add(soilLayer); - - var profile = mocks.Stub>(); - profile.Stub(p => p.Layers).Return(layers); - - mocks.ReplayAll(); - // Call - ChartMultipleAreaData data = MacroStabilityInwardsChartDataFactory.CreateSoilLayerChartData(soilLayerIndex, profile); + ChartMultipleAreaData data = MacroStabilityInwardsChartDataFactory.CreateSoilLayerChartData(name, fillColor); // Assert CollectionAssert.IsEmpty(data.Areas); - Assert.AreEqual($"{soilLayerIndex + 1} {name}", data.Name); - AssertEqualStyle(data.Style, soilLayer.Data.Color, Color.Black, 1); - mocks.VerifyAll(); + Assert.AreEqual(name, data.Name); + AssertEqualStyle(data.Style, fillColor, Color.Black, 1); } [Test] - public void CreateHolesChartData_ValidSoilProfileWithHoles_ReturnsChartDataWithExpectedStylingAndAreas() - { - // Call - ChartMultipleAreaData holesChartData = MacroStabilityInwardsChartDataFactory.CreateHolesChartData(); - - // Assert - Assert.AreEqual("Binnenringen", holesChartData.Name); - AssertEqualStyle(holesChartData.Style, Color.White, Color.Black, 1); - } - - [Test] public void UpdateSurfaceLineChartDataName_SurfaceLineNull_NameSetToDefaultSurfaceLineName() { // Setup @@ -320,27 +280,6 @@ Assert.AreEqual("soil profile name", chartData.Name); } - [TestCase(-1)] - [TestCase(2)] - [TestCase(3)] - public void CreateSoilLayerChartData_InvalidSoilLayerIndex_ThrowsArgumentOutOfRangeException(int soilLayerIndex) - { - // Setup - var layers = new[] - { - new MacroStabilityInwardsSoilLayer1D(0), - new MacroStabilityInwardsSoilLayer1D(1) - }; - var profile = new MacroStabilityInwardsSoilProfile1D("name", -1.0, layers); - - // Call - TestDelegate test = () => MacroStabilityInwardsChartDataFactory.CreateSoilLayerChartData(soilLayerIndex, profile); - - // Assert - string paramName = Assert.Throws(test).ParamName; - Assert.AreEqual("soilLayerIndex", paramName); - } - private static void AssertEqualStyle(ChartPointStyle pointStyle, Color fillColor, int size, Color strokeColor, int strokeThickness, ChartPointSymbol symbol) { Assert.AreEqual(fillColor, pointStyle.Color); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataPointsFactoryTest.cs =================================================================== diff -u -r278773bcf61741f8112bd7bd69239698cfa1c655 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataPointsFactoryTest.cs (.../MacroStabilityInwardsChartDataPointsFactoryTest.cs) (revision 278773bcf61741f8112bd7bd69239698cfa1c655) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Factories/MacroStabilityInwardsChartDataPointsFactoryTest.cs (.../MacroStabilityInwardsChartDataPointsFactoryTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -28,7 +28,6 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.MacroStabilityInwards.Data; -using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Forms.Factories; using Ringtoets.MacroStabilityInwards.Primitives; using Ringtoets.MacroStabilityInwards.Primitives.TestUtil; @@ -623,78 +622,6 @@ } [Test] - public void CreateHolesAreas_SoilProfileNull_ReturnsEmptyAreaCollection() - { - // Call - IEnumerable holes = MacroStabilityInwardsChartDataPointsFactory.CreateHolesAreas(null); - - // Assert - CollectionAssert.IsEmpty(holes); - } - - [Test] - public void CreateHolesAreas_SoilProfileWithoutHoles_ReturnsEmptyAreaCollection() - { - // Setup - var soilProfile = new MacroStabilityInwardsSoilProfileUnderSurfaceLine(new IMacroStabilityInwardsSoilLayerUnderSurfaceLine[0], - new IMacroStabilityInwardsPreconsolidationStress[0]); - - // Call - IEnumerable holes = MacroStabilityInwardsChartDataPointsFactory.CreateHolesAreas(soilProfile); - - // Assert - CollectionAssert.IsEmpty(holes); - } - - [Test] - public void CreateHolesAreas_SoilProfileWithHoles_ReturnsHolesAreaCollection() - { - // Setup - var mocks = new MockRepository(); - var holesLayer1 = new[] - { - new[] - { - new Point2D(2.0, 2.0), - new Point2D(6.0, 2.0), - new Point2D(4.0, 4.0) - } - }; - var holesLayer2 = new[] - { - new[] - { - new Point2D(3.0, 3.0), - new Point2D(7.0, 3.0), - new Point2D(5.0, 5.0) - } - }; - - var soilProfile = mocks.Stub(); - var soilLayer1 = mocks.Stub(); - soilLayer1.Stub(l => l.Holes).Return(holesLayer1); - - var soilLayer2 = mocks.Stub(); - soilLayer2.Stub(l => l.Holes).Return(holesLayer2); - - soilProfile.Stub(p => p.Layers).Return(new[] - { - soilLayer1, - soilLayer2 - }); - mocks.ReplayAll(); - - // Call - IEnumerable holesChartData = MacroStabilityInwardsChartDataPointsFactory.CreateHolesAreas(soilProfile); - - // Assert - IEnumerable expectedHoles = holesLayer1.Concat(holesLayer2); - CollectionAssert.AreEqual(expectedHoles, holesChartData); - - mocks.VerifyAll(); - } - - [Test] public void CreateOuterRingArea_SoilLayerNull_ReturnsEmptyAreaCollection() { // Call @@ -709,15 +636,15 @@ { // Setup var mocks = new MockRepository(); - var outerRing = new[] + var outerRing = new Ring(new[] { new Point2D(0.0, 10.0), new Point2D(10.0, 10.0), new Point2D(10.0, 0.0), new Point2D(0.0, 0.0) - }; + }); - var layer = mocks.Stub(); + var layer = mocks.Stub(); layer.Stub(l => l.OuterRing).Return(outerRing); mocks.ReplayAll(); @@ -728,7 +655,7 @@ // Assert CollectionAssert.AreEqual(new[] { - outerRing + outerRing.Points }, outerRingChartData); mocks.VerifyAll(); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs =================================================================== diff -u -r3d30a9febb6492e54f2082bf0a21a1602717b098 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs (.../MacroStabilityInwardsInputContextPropertiesTest.cs) (revision 3d30a9febb6492e54f2082bf0a21a1602717b098) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs (.../MacroStabilityInwardsInputContextPropertiesTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -360,7 +360,7 @@ { new MacroStabilityInwardsSoilLayer1D(random.NextDouble()) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { IsAquifer = true } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsSoilLayer1DPropertiesTest.cs =================================================================== diff -u -r69d647795daacbf48e17d0cf3a02a21865ab4ae6 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsSoilLayer1DPropertiesTest.cs (.../MacroStabilityInwardsSoilLayer1DPropertiesTest.cs) (revision 69d647795daacbf48e17d0cf3a02a21865ab4ae6) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsSoilLayer1DPropertiesTest.cs (.../MacroStabilityInwardsSoilLayer1DPropertiesTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -63,7 +63,7 @@ // Setup var layer = new MacroStabilityInwardsSoilLayer1D(-2.9) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { MaterialName = "Test Name", IsAquifer = true @@ -85,7 +85,7 @@ // Setup var layer = new MacroStabilityInwardsSoilLayer1D(-2.9) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { MaterialName = "Layer A" } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsSoilLayer2DPropertiesTest.cs =================================================================== diff -u -r69d647795daacbf48e17d0cf3a02a21865ab4ae6 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsSoilLayer2DPropertiesTest.cs (.../MacroStabilityInwardsSoilLayer2DPropertiesTest.cs) (revision 69d647795daacbf48e17d0cf3a02a21865ab4ae6) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsSoilLayer2DPropertiesTest.cs (.../MacroStabilityInwardsSoilLayer2DPropertiesTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -28,6 +28,7 @@ using NUnit.Framework; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Forms.Test.PropertyClasses { @@ -80,7 +81,7 @@ }) }) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { MaterialName = "Test Name", IsAquifer = true @@ -166,7 +167,10 @@ new Point2D(20.210230, 26.00001), new Point2D(3.830, 1.040506) }), - new Ring[0]); + new Ring[0]) + { + Data = new MacroStabilityInwardsSoilLayerData() + }; } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsStochasticSoilProfilePropertiesTest.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsStochasticSoilProfilePropertiesTest.cs (.../MacroStabilityInwardsStochasticSoilProfilePropertiesTest.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsStochasticSoilProfilePropertiesTest.cs (.../MacroStabilityInwardsStochasticSoilProfilePropertiesTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -32,6 +32,7 @@ using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile; using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Forms.Test.PropertyClasses { Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/RingPropertiesTest.cs =================================================================== diff -u -r9f936b0b29f490a024df02345df182133b1c041a -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/RingPropertiesTest.cs (.../RingPropertiesTest.cs) (revision 9f936b0b29f490a024df02345df182133b1c041a) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/RingPropertiesTest.cs (.../RingPropertiesTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -28,6 +28,7 @@ using NUnit.Framework; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Forms.Test.PropertyClasses { Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsCalculationsViewTest.cs =================================================================== diff -u -rb2f4b307c254c747a5cf01d2fb94970e5e954c36 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsCalculationsViewTest.cs (.../MacroStabilityInwardsCalculationsViewTest.cs) (revision b2f4b307c254c747a5cf01d2fb94970e5e954c36) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsCalculationsViewTest.cs (.../MacroStabilityInwardsCalculationsViewTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -1401,9 +1401,18 @@ var stochasticSoilProfile1 = new MacroStabilityInwardsStochasticSoilProfile(0.3, new MacroStabilityInwardsSoilProfile1D("Profile 1", -10.0, new[] { - new MacroStabilityInwardsSoilLayer1D(-5.0), - new MacroStabilityInwardsSoilLayer1D(-2.0), + new MacroStabilityInwardsSoilLayer1D(-5.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, + new MacroStabilityInwardsSoilLayer1D(-2.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, new MacroStabilityInwardsSoilLayer1D(1.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + } })); var stochasticSoilModelA = new MacroStabilityInwardsStochasticSoilModel("Model A", new[] @@ -1415,17 +1424,35 @@ stochasticSoilProfile1, new MacroStabilityInwardsStochasticSoilProfile(0.7, new MacroStabilityInwardsSoilProfile1D("Profile 2", -8.0, new[] { - new MacroStabilityInwardsSoilLayer1D(-4.0), - new MacroStabilityInwardsSoilLayer1D(0.0), + new MacroStabilityInwardsSoilLayer1D(-4.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, + new MacroStabilityInwardsSoilLayer1D(0.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, new MacroStabilityInwardsSoilLayer1D(4.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + } })) }); var stochasticSoilProfile5 = new MacroStabilityInwardsStochasticSoilProfile(0.3, new MacroStabilityInwardsSoilProfile1D("Profile 5", -10.0, new[] { - new MacroStabilityInwardsSoilLayer1D(-5.0), - new MacroStabilityInwardsSoilLayer1D(-2.0), + new MacroStabilityInwardsSoilLayer1D(-5.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, + new MacroStabilityInwardsSoilLayer1D(-2.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, new MacroStabilityInwardsSoilLayer1D(1.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + } })); var stochasticSoilModelE = new MacroStabilityInwardsStochasticSoilModel("Model E", new[] @@ -1448,15 +1475,33 @@ { new MacroStabilityInwardsStochasticSoilProfile(0.3, new MacroStabilityInwardsSoilProfile1D("Profile 3", -10.0, new[] { - new MacroStabilityInwardsSoilLayer1D(-5.0), - new MacroStabilityInwardsSoilLayer1D(-2.0), + new MacroStabilityInwardsSoilLayer1D(-5.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, + new MacroStabilityInwardsSoilLayer1D(-2.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, new MacroStabilityInwardsSoilLayer1D(1.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + } })), new MacroStabilityInwardsStochasticSoilProfile(0.7, new MacroStabilityInwardsSoilProfile1D("Profile 4", -8.0, new[] { - new MacroStabilityInwardsSoilLayer1D(-4.0), - new MacroStabilityInwardsSoilLayer1D(0.0), + new MacroStabilityInwardsSoilLayer1D(-4.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, + new MacroStabilityInwardsSoilLayer1D(0.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, new MacroStabilityInwardsSoilLayer1D(4.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + } })) }), stochasticSoilModelE Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsInputViewTest.cs =================================================================== diff -u -r01e3465b06b53d4447b01d3a9b6befe59a42a292 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsInputViewTest.cs (.../MacroStabilityInwardsInputViewTest.cs) (revision 01e3465b06b53d4447b01d3a9b6befe59a42a292) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsInputViewTest.cs (.../MacroStabilityInwardsInputViewTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -176,10 +176,20 @@ -1, new[] { - new MacroStabilityInwardsSoilLayer1D(3.0), - new MacroStabilityInwardsSoilLayer1D(2.0), + new MacroStabilityInwardsSoilLayer1D(3.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, + new MacroStabilityInwardsSoilLayer1D(2.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, new MacroStabilityInwardsSoilLayer1D(0) - })) + { + Data = new MacroStabilityInwardsSoilLayerData() + } + })), + SurfaceLine = GetSurfaceLineWithGeometry() } }; @@ -229,9 +239,7 @@ Assert.AreSame(calculation, view.Data); ChartDataCollection chartData = view.Chart.Data; Assert.IsInstanceOf(chartData); - MacroStabilityInwardsInputViewChartDataAssert.AssertChartData(surfaceLine, - stochasticSoilProfile, - chartData); + MacroStabilityInwardsInputViewChartDataAssert.AssertChartData(calculation, chartData); } } @@ -260,9 +268,7 @@ Assert.AreSame(calculation, view.Data); ChartDataCollection chartData = view.Chart.Data; Assert.IsInstanceOf(chartData); - MacroStabilityInwardsInputViewChartDataAssert.AssertChartData(surfaceLine, - stochasticSoilProfile, - chartData); + MacroStabilityInwardsInputViewChartDataAssert.AssertChartData(calculation, chartData); } } @@ -453,7 +459,11 @@ Assert.AreSame(surfaceLineChartData, (ChartDataCollection) chartDataList[soilProfileIndex]); - MacroStabilityInwardsViewChartDataAssert.AssertSoilProfileChartData(newSoilProfile, surfaceLineChartData, true); + MacroStabilityInwardsViewChartDataAssert.AssertSoilProfileChartData(calculation.InputParameters.SoilProfileUnderSurfaceLine, + newSoilProfile.SoilProfile.Name, + true, + surfaceLineChartData); + mocks.VerifyAll(); } } @@ -663,6 +673,9 @@ new[] { new MacroStabilityInwardsSoilLayer1D(1) + { + Data = new MacroStabilityInwardsSoilLayerData() + } })), SurfaceLine = GetSurfaceLineWithGeometry() } @@ -681,8 +694,14 @@ -1, new[] { - new MacroStabilityInwardsSoilLayer1D(3), + new MacroStabilityInwardsSoilLayer1D(3) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, new MacroStabilityInwardsSoilLayer1D(4) + { + Data = new MacroStabilityInwardsSoilLayerData() + } })); calculation.InputParameters.NotifyObservers(); @@ -753,18 +772,20 @@ // Precondition Assert.IsNotNull(chartData); Assert.AreEqual(nrOfChartData, chartData.Collection.Count()); - MacroStabilityInwardsViewChartDataAssert.AssertSoilProfileChartData(stochasticSoilProfile, - chartData.Collection.ElementAt(soilProfileIndex), - true); + MacroStabilityInwardsViewChartDataAssert.AssertSoilProfileChartData(calculation.InputParameters.SoilProfileUnderSurfaceLine, + stochasticSoilProfile.SoilProfile.Name, + true, + chartData.Collection.ElementAt(soilProfileIndex)); // When calculation.InputParameters.SurfaceLine = null; calculation.InputParameters.NotifyObservers(); // Then - MacroStabilityInwardsViewChartDataAssert.AssertSoilProfileChartData(stochasticSoilProfile, - chartData.Collection.ElementAt(soilProfileIndex), - false); + MacroStabilityInwardsViewChartDataAssert.AssertSoilProfileChartData(calculation.InputParameters.SoilProfileUnderSurfaceLine, + stochasticSoilProfile.SoilProfile.Name, + true, + chartData.Collection.ElementAt(soilProfileIndex)); } } @@ -805,9 +826,18 @@ { return new MacroStabilityInwardsStochasticSoilProfile(0.5, new MacroStabilityInwardsSoilProfile1D("profile 1D", -1, new[] { - new MacroStabilityInwardsSoilLayer1D(1), - new MacroStabilityInwardsSoilLayer1D(3), + new MacroStabilityInwardsSoilLayer1D(1) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, + new MacroStabilityInwardsSoilLayer1D(3) + { + Data = new MacroStabilityInwardsSoilLayerData() + }, new MacroStabilityInwardsSoilLayer1D(5) + { + Data = new MacroStabilityInwardsSoilLayerData() + } })); } @@ -819,17 +849,29 @@ { new Point2D(0.0, 1.0), new Point2D(2.0, 4.0) - }), new List()), + }), new List()) + { + Data = new MacroStabilityInwardsSoilLayerData(), + NestedLayers = Enumerable.Empty() + }, new MacroStabilityInwardsSoilLayer2D(new Ring(new List { new Point2D(3.0, 1.0), new Point2D(8.0, 3.0) - }), new List()), + }), new List()) + { + Data = new MacroStabilityInwardsSoilLayerData(), + NestedLayers = Enumerable.Empty() + }, new MacroStabilityInwardsSoilLayer2D(new Ring(new List { new Point2D(2.0, 4.0), new Point2D(2.0, 8.0) }), new List()) + { + Data = new MacroStabilityInwardsSoilLayerData(), + NestedLayers = Enumerable.Empty() + } }, new List())); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsOutputChartControlTest.cs =================================================================== diff -u -r89a30d666e2e684db9d72ed16c3be18a6afad391 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsOutputChartControlTest.cs (.../MacroStabilityInwardsOutputChartControlTest.cs) (revision 89a30d666e2e684db9d72ed16c3be18a6afad391) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsOutputChartControlTest.cs (.../MacroStabilityInwardsOutputChartControlTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -122,9 +122,7 @@ control.Data = calculation; // Assert - MacroStabilityInwardsOutputViewChartDataAssert.AssertChartData(surfaceLine, - stochasticSoilProfile, - GetChartControl(control).Data); + MacroStabilityInwardsOutputViewChartDataAssert.AssertChartData(calculation, GetChartControl(control).Data); } } @@ -150,9 +148,7 @@ }) { // Precondition - MacroStabilityInwardsOutputViewChartDataAssert.AssertChartData(surfaceLine, - stochasticSoilProfile, - GetChartControl(control).Data); + MacroStabilityInwardsOutputViewChartDataAssert.AssertChartData(calculation, GetChartControl(control).Data); // Call control.Data = MacroStabilityInwardsCalculationScenarioFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(); @@ -163,7 +159,7 @@ } [Test] - public void Data_SetToNull_ChartDataEmpty() + public void Data_SetToNull_ChartDataCleared() { // Setup MacroStabilityInwardsSurfaceLine surfaceLine = GetSurfaceLineWithGeometry(); @@ -184,15 +180,13 @@ }) { // Precondition - MacroStabilityInwardsOutputViewChartDataAssert.AssertChartData(surfaceLine, - stochasticSoilProfile, - GetChartControl(control).Data); + MacroStabilityInwardsOutputViewChartDataAssert.AssertChartData(calculation, GetChartControl(control).Data); // Call control.Data = null; // Assert - MacroStabilityInwardsOutputViewChartDataAssert.AssertEmptyChartDataWithEmptySoilLayerChartData(control.Chart.Data); + Assert.IsNull(control.Chart.Data); } } @@ -225,9 +219,7 @@ control.UpdateChartData(); // Assert - MacroStabilityInwardsOutputViewChartDataAssert.AssertChartData(surfaceLine, - stochasticSoilProfile, - GetChartControl(control).Data); + MacroStabilityInwardsOutputViewChartDataAssert.AssertChartData(calculation, GetChartControl(control).Data); } } @@ -253,9 +245,7 @@ }) { // Precondition - MacroStabilityInwardsOutputViewChartDataAssert.AssertChartData(surfaceLine, - stochasticSoilProfile, - GetChartControl(control).Data); + MacroStabilityInwardsOutputViewChartDataAssert.AssertChartData(calculation, GetChartControl(control).Data); calculation.ClearOutput(); @@ -275,17 +265,29 @@ { new Point2D(0.0, 1.0), new Point2D(2.0, 4.0) - }), new List()), + }), new List()) + { + Data = new MacroStabilityInwardsSoilLayerData(), + NestedLayers = Enumerable.Empty() + }, new MacroStabilityInwardsSoilLayer2D(new Ring(new List { new Point2D(3.0, 1.0), new Point2D(8.0, 3.0) - }), new List()), + }), new List()) + { + Data = new MacroStabilityInwardsSoilLayerData(), + NestedLayers = Enumerable.Empty() + }, new MacroStabilityInwardsSoilLayer2D(new Ring(new List { new Point2D(2.0, 4.0), new Point2D(2.0, 8.0) }), new List()) + { + Data = new MacroStabilityInwardsSoilLayerData(), + NestedLayers = Enumerable.Empty() + } }, new List())); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsOutputViewTest.cs =================================================================== diff -u -r89a30d666e2e684db9d72ed16c3be18a6afad391 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsOutputViewTest.cs (.../MacroStabilityInwardsOutputViewTest.cs) (revision 89a30d666e2e684db9d72ed16c3be18a6afad391) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsOutputViewTest.cs (.../MacroStabilityInwardsOutputViewTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -172,9 +172,7 @@ // Precondition ChartDataCollection chartData = GetChartControl(chartControl).Data; - MacroStabilityInwardsOutputViewChartDataAssert.AssertChartData(calculation.InputParameters.SurfaceLine, - calculation.InputParameters.StochasticSoilProfile, - chartData); + MacroStabilityInwardsOutputViewChartDataAssert.AssertChartData(calculation, chartData); // When calculation.ClearOutput(); @@ -219,9 +217,7 @@ calculation.NotifyObservers(); // Then - MacroStabilityInwardsOutputViewChartDataAssert.AssertChartData(calculation.InputParameters.SurfaceLine, - calculation.InputParameters.StochasticSoilProfile, - chartData); + MacroStabilityInwardsOutputViewChartDataAssert.AssertChartData(calculation, chartData); } } @@ -243,17 +239,29 @@ { new Point2D(0.0, 1.0), new Point2D(2.0, 4.0) - }), new List()), + }), new List()) + { + Data = new MacroStabilityInwardsSoilLayerData(), + NestedLayers = Enumerable.Empty() + }, new MacroStabilityInwardsSoilLayer2D(new Ring(new List { new Point2D(3.0, 1.0), new Point2D(8.0, 3.0) - }), new List()), + }), new List()) + { + Data = new MacroStabilityInwardsSoilLayerData(), + NestedLayers = Enumerable.Empty() + }, new MacroStabilityInwardsSoilLayer2D(new Ring(new List { new Point2D(2.0, 4.0), new Point2D(2.0, 8.0) }), new List()) + { + Data = new MacroStabilityInwardsSoilLayerData(), + NestedLayers = Enumerable.Empty() + } }, new List())); } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsInputViewChartDataAssert.cs =================================================================== diff -u -r45144248b1c5d3ee3577e21bfb5d25ebb66c4a35 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsInputViewChartDataAssert.cs (.../MacroStabilityInwardsInputViewChartDataAssert.cs) (revision 45144248b1c5d3ee3577e21bfb5d25ebb66c4a35) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsInputViewChartDataAssert.cs (.../MacroStabilityInwardsInputViewChartDataAssert.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -22,6 +22,7 @@ using System.Linq; using Core.Components.Chart.Data; using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Primitives; @@ -54,21 +55,20 @@ private const int nrOfChartData = 18; /// - /// Asserts whether corresponds to - /// and . + /// Asserts whether corresponds to . /// - /// The original . - /// The original . + /// The original . /// The actual . /// Thrown when - /// does not correspond to or. - public static void AssertChartData(MacroStabilityInwardsSurfaceLine surfaceLine, - MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile, - ChartDataCollection actual) + /// does not correspond to . + public static void AssertChartData(MacroStabilityInwardsCalculationScenario calculationScenario, ChartDataCollection actual) { Assert.AreEqual(nrOfChartData, actual.Collection.Count()); - MacroStabilityInwardsViewChartDataAssert.AssertSurfaceLineChartData(surfaceLine, actual.Collection.ElementAt(surfaceLineIndex)); - MacroStabilityInwardsViewChartDataAssert.AssertSoilProfileChartData(stochasticSoilProfile, actual.Collection.ElementAt(soilProfileIndex), true); + MacroStabilityInwardsViewChartDataAssert.AssertSurfaceLineChartData(calculationScenario.InputParameters.SurfaceLine, actual.Collection.ElementAt(surfaceLineIndex)); + MacroStabilityInwardsViewChartDataAssert.AssertSoilProfileChartData(calculationScenario.InputParameters.SoilProfileUnderSurfaceLine, + calculationScenario.InputParameters.StochasticSoilProfile.SoilProfile.Name, + true, + actual.Collection.ElementAt(soilProfileIndex)); } /// Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsOutputViewChartDataAssert.cs =================================================================== diff -u -r45144248b1c5d3ee3577e21bfb5d25ebb66c4a35 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsOutputViewChartDataAssert.cs (.../MacroStabilityInwardsOutputViewChartDataAssert.cs) (revision 45144248b1c5d3ee3577e21bfb5d25ebb66c4a35) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsOutputViewChartDataAssert.cs (.../MacroStabilityInwardsOutputViewChartDataAssert.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -22,8 +22,7 @@ using System.Linq; using Core.Components.Chart.Data; using NUnit.Framework; -using Ringtoets.MacroStabilityInwards.Data.SoilProfile; -using Ringtoets.MacroStabilityInwards.Primitives; +using Ringtoets.MacroStabilityInwards.Data; namespace Ringtoets.MacroStabilityInwards.Forms.TestUtil { @@ -50,21 +49,20 @@ private const int nrOfChartData = 14; /// - /// Asserts whether corresponds to - /// and . + /// Asserts whether corresponds to . /// - /// The original . - /// The original . + /// The original . /// The actual . /// Thrown when - /// does not correspond to or. - public static void AssertChartData(MacroStabilityInwardsSurfaceLine surfaceLine, - MacroStabilityInwardsStochasticSoilProfile stochasticSoilProfile, - ChartDataCollection actual) + /// does not correspond to . + public static void AssertChartData(MacroStabilityInwardsCalculationScenario calculationScenario, ChartDataCollection actual) { Assert.AreEqual(nrOfChartData, actual.Collection.Count()); - MacroStabilityInwardsViewChartDataAssert.AssertSurfaceLineChartData(surfaceLine, actual.Collection.ElementAt(surfaceLineIndex)); - MacroStabilityInwardsViewChartDataAssert.AssertSoilProfileChartData(stochasticSoilProfile, actual.Collection.ElementAt(soilProfileIndex), true); + MacroStabilityInwardsViewChartDataAssert.AssertSurfaceLineChartData(calculationScenario.InputParameters.SurfaceLine, actual.Collection.ElementAt(surfaceLineIndex)); + MacroStabilityInwardsViewChartDataAssert.AssertSoilProfileChartData(calculationScenario.InputParameters.SoilProfileUnderSurfaceLine, + calculationScenario.InputParameters.StochasticSoilProfile.SoilProfile.Name, + true, + actual.Collection.ElementAt(soilProfileIndex)); } /// Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsViewChartDataAssert.cs =================================================================== diff -u -r89a30d666e2e684db9d72ed16c3be18a6afad391 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsViewChartDataAssert.cs (.../MacroStabilityInwardsViewChartDataAssert.cs) (revision 89a30d666e2e684db9d72ed16c3be18a6afad391) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.TestUtil/MacroStabilityInwardsViewChartDataAssert.cs (.../MacroStabilityInwardsViewChartDataAssert.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -51,24 +51,30 @@ } /// - /// Asserts whether corresponds to . + /// Asserts whether corresponds to , + /// and . /// - /// The original . + /// The + /// that should be represented as series in . + /// The expected name of . + /// Indicator whether areas should be present. /// The actual . - /// Indicator whether areas are present. - /// Thrown when - /// does not correspond to . - public static void AssertSoilProfileChartData(MacroStabilityInwardsStochasticSoilProfile original, ChartData actual, bool mapDataShouldContainAreas) + /// Thrown when does not correspond + /// to , or + /// . + public static void AssertSoilProfileChartData(IMacroStabilityInwardsSoilProfileUnderSurfaceLine soilProfileUnderSurface, string expectedName, bool mapDataShouldContainAreas, ChartData actual) { Assert.IsInstanceOf(actual); var soilProfileChartData = (ChartDataCollection) actual; - int expectedLayerCount = original.SoilProfile.Layers.Count(); - Assert.AreEqual(expectedLayerCount + 1, soilProfileChartData.Collection.Count()); - Assert.AreEqual(original.SoilProfile.Name, soilProfileChartData.Name); + IMacroStabilityInwardsSoilLayer2D[] layers = soilProfileUnderSurface?.GetLayersRecursively().ToArray() ?? new IMacroStabilityInwardsSoilLayer2D[0]; + int expectedLayerCount = layers.Length; - string[] expectedSoilLayerNames = original.SoilProfile.Layers.Select((l, i) => $"{i + 1} {l.Data.MaterialName}").Reverse().ToArray(); + Assert.AreEqual(expectedLayerCount, soilProfileChartData.Collection.Count()); + Assert.AreEqual(expectedName, soilProfileChartData.Name); + string[] expectedSoilLayerNames = layers.Select((l, i) => $"{i + 1} {l.Data.MaterialName}").Reverse().ToArray(); + for (var i = 0; i < expectedLayerCount; i++) { var chartMultipleAreaData = soilProfileChartData.Collection.ElementAt(i) as ChartMultipleAreaData; @@ -77,11 +83,6 @@ Assert.AreEqual(expectedSoilLayerNames[i], chartMultipleAreaData.Name); Assert.AreEqual(mapDataShouldContainAreas, chartMultipleAreaData.Areas.Any()); } - - var holesMultipleAreaData = soilProfileChartData.Collection.Last() as ChartMultipleAreaData; - Assert.IsNotNull(holesMultipleAreaData); - Assert.AreEqual("Binnenringen", holesMultipleAreaData.Name); - Assert.IsFalse(holesMultipleAreaData.Areas.Any()); } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsSoilLayerTransformerTest.cs =================================================================== diff -u -r90a9502badff5788374461a1b2179a5dd0e866a2 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsSoilLayerTransformerTest.cs (.../MacroStabilityInwardsSoilLayerTransformerTest.cs) (revision 90a9502badff5788374461a1b2179a5dd0e866a2) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsSoilLayerTransformerTest.cs (.../MacroStabilityInwardsSoilLayerTransformerTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -31,7 +31,6 @@ using Ringtoets.Common.IO.Exceptions; using Ringtoets.Common.IO.SoilProfile; using Ringtoets.Common.IO.TestUtil; -using Ringtoets.MacroStabilityInwards.Data; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.IO.SoilProfiles; using Ringtoets.MacroStabilityInwards.Primitives; @@ -109,7 +108,7 @@ // Assert Assert.AreEqual(top, soilLayer1D.Top); - MacroStabilityInwardsSoilLayerData data = soilLayer1D.Data; + IMacroStabilityInwardsSoilLayerData data = soilLayer1D.Data; Assert.AreEqual(materialName, data.MaterialName); bool expectedIsAquifer = isAquifer.Equals(1.0); @@ -377,7 +376,7 @@ MacroStabilityInwardsSoilLayer2D soilLayer2D = MacroStabilityInwardsSoilLayerTransformer.Transform(layer); // Assert - MacroStabilityInwardsSoilLayerData data = soilLayer2D.Data; + IMacroStabilityInwardsSoilLayerData data = soilLayer2D.Data; Assert.AreEqual(materialName, data.MaterialName); bool expectedIsAquifer = isAquifer.Equals(1.0); @@ -587,16 +586,6 @@ } [Test] - public void SoilLayer2DTransform_OuterRingNull_ThrowImportedDataTransformException() - { - // Call - TestDelegate test = () => MacroStabilityInwardsSoilLayerTransformer.Transform(new SoilLayer2D()); - - // Assert - Assert.Throws(test); - } - - [Test] [TestCaseSource(nameof(GetSoilLayerWithInvalidGeometry))] public void SoilLayer2DTransform_SoilLayer2DWithInvalidLoops_ThrowsImportedDataException(SoilLayer2D soilLayer) { @@ -611,11 +600,11 @@ private static void AssertRings(SoilLayer2D soilLayer, MacroStabilityInwardsSoilLayer2D macroStabilityInwardsSoilLayer) { - Assert.AreEqual(GetRingFromSegment(soilLayer.OuterLoop), macroStabilityInwardsSoilLayer.OuterRing); - CollectionAssert.AreEqual(soilLayer.InnerLoops.Select(GetRingFromSegment), macroStabilityInwardsSoilLayer.Holes); + Assert.AreEqual(GetRingFromSegments(soilLayer.OuterLoop.Segments), macroStabilityInwardsSoilLayer.OuterRing); + CollectionAssert.AreEqual(soilLayer.InnerLoops.Select(il => GetRingFromSegments(il.Segments)), macroStabilityInwardsSoilLayer.Holes); } - private static Ring GetRingFromSegment(IEnumerable loop) + private static Ring GetRingFromSegments(IEnumerable loop) { var points = new List(); foreach (Segment2D segment in loop) @@ -681,7 +670,7 @@ private static IEnumerable IncorrectShiftedLogNormalDistributionsSoilLayer2D() { - return IncorrectShiftedLogNormalDistributions(() => new SoilLayer2D(), nameof(SoilLayer2D)); + return IncorrectShiftedLogNormalDistributions(SoilLayer2DTestFactory.CreateSoilLayer2D, nameof(SoilLayer2D)); } private static IEnumerable IncorrectShiftedLogNormalDistributions(Func soilLayer, string typeName) @@ -710,7 +699,7 @@ private static IEnumerable IncorrectNonShiftedLogNormalDistributionsSoilLayer2D() { - return IncorrectNonShiftedLogNormalDistributions(() => new SoilLayer2D(), nameof(SoilLayer2D)); + return IncorrectNonShiftedLogNormalDistributions(SoilLayer2DTestFactory.CreateSoilLayer2D, nameof(SoilLayer2D)); } private static IEnumerable IncorrectNonShiftedLogNormalDistributions(Func soilLayer, string typeName) Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsStochasticSoilModelTransformerTest.cs =================================================================== diff -u -r90a9502badff5788374461a1b2179a5dd0e866a2 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsStochasticSoilModelTransformerTest.cs (.../MacroStabilityInwardsStochasticSoilModelTransformerTest.cs) (revision 90a9502badff5788374461a1b2179a5dd0e866a2) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsStochasticSoilModelTransformerTest.cs (.../MacroStabilityInwardsStochasticSoilModelTransformerTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -131,7 +131,7 @@ { new MacroStabilityInwardsSoilLayer1D(top) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { UsePop = true, ShearStrengthModel = MacroStabilityInwardsShearStrengthModel.CPhi, @@ -182,11 +182,12 @@ }) }) { - Data = + Data = new MacroStabilityInwardsSoilLayerData { UsePop = true, ShearStrengthModel = MacroStabilityInwardsShearStrengthModel.CPhi - } + }, + NestedLayers = Enumerable.Empty() } }, Enumerable.Empty())); AssertStochasticSoilProfile(expectedStochasticSoilProfile, transformedModel.StochasticSoilProfiles.First()); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsStochasticSoilProfileTransformerTest.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsStochasticSoilProfileTransformerTest.cs (.../MacroStabilityInwardsStochasticSoilProfileTransformerTest.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsStochasticSoilProfileTransformerTest.cs (.../MacroStabilityInwardsStochasticSoilProfileTransformerTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -27,6 +27,7 @@ using Ringtoets.Common.IO.TestUtil; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.IO.SoilProfiles; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.IO.Test.SoilProfiles { Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/FileImporter/MacroStabilityInwardsStochasticSoilModelUpdateDataStrategyTest.cs =================================================================== diff -u -rb2f4b307c254c747a5cf01d2fb94970e5e954c36 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/FileImporter/MacroStabilityInwardsStochasticSoilModelUpdateDataStrategyTest.cs (.../MacroStabilityInwardsStochasticSoilModelUpdateDataStrategyTest.cs) (revision b2f4b307c254c747a5cf01d2fb94970e5e954c36) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/FileImporter/MacroStabilityInwardsStochasticSoilModelUpdateDataStrategyTest.cs (.../MacroStabilityInwardsStochasticSoilModelUpdateDataStrategyTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -33,6 +33,7 @@ using Ringtoets.MacroStabilityInwards.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile; using Ringtoets.MacroStabilityInwards.Plugin.FileImporter; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Plugin.Test.FileImporter { @@ -560,6 +561,9 @@ new[] { new MacroStabilityInwardsSoilLayer1D(0.0) + { + Data = new MacroStabilityInwardsSoilLayerData() + } })), new MacroStabilityInwardsStochasticSoilProfile(0.5, new MacroStabilityInwardsSoilProfile2D( "B", @@ -570,6 +574,10 @@ new Point2D(3, 2), new Point2D(4, 5) }), Enumerable.Empty()) + { + Data = new MacroStabilityInwardsSoilLayerData(), + NestedLayers = Enumerable.Empty() + } }, Enumerable.Empty())) }; } Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/PropertyInfos/MacroStabilityInwardsStochasticSoilProfilePropertyInfoTest.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/PropertyInfos/MacroStabilityInwardsStochasticSoilProfilePropertyInfoTest.cs (.../MacroStabilityInwardsStochasticSoilProfilePropertyInfoTest.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/PropertyInfos/MacroStabilityInwardsStochasticSoilProfilePropertyInfoTest.cs (.../MacroStabilityInwardsStochasticSoilProfilePropertyInfoTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -26,6 +26,7 @@ using Rhino.Mocks; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Plugin.Test.PropertyInfos { Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsStochasticSoilProfileTreeNodeInfoTest.cs =================================================================== diff -u -r85b10b88eb31823c50ca052d34baacc6e006ad4c -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsStochasticSoilProfileTreeNodeInfoTest.cs (.../MacroStabilityInwardsStochasticSoilProfileTreeNodeInfoTest.cs) (revision 85b10b88eb31823c50ca052d34baacc6e006ad4c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsStochasticSoilProfileTreeNodeInfoTest.cs (.../MacroStabilityInwardsStochasticSoilProfileTreeNodeInfoTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -29,6 +29,7 @@ using Rhino.Mocks; using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Forms.Properties; +using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Plugin.Test.TreeNodeInfos { Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs =================================================================== diff -u -r72b12726b73e7e011bed836163635b64220c23f1 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision 72b12726b73e7e011bed836163635b64220c23f1) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -313,6 +313,9 @@ var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(1, new MacroStabilityInwardsSoilProfile1D("profile", 0.0, new[] { new MacroStabilityInwardsSoilLayer1D(surfaceLineTop - differenceFromTop) + { + Data = new MacroStabilityInwardsSoilLayerData() + } })); var surfaceLine = new MacroStabilityInwardsSurfaceLine("Test"); Fisheye: Tag 7585d2fd78627d94d55ffa16423af90a91e4efd4 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.IO/Exceptions/SoilLayerConversionException.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj =================================================================== diff -u -rdaa6b36fc2506683c50ba4117790452ae4f45d7f -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision daa6b36fc2506683c50ba4117790452ae4f45d7f) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -36,7 +36,6 @@ Properties\GlobalAssembly.cs - Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilLayerTransformer.cs =================================================================== diff -u -rbe51145e1b013ea9e1353a6b8618bdc6fd855ff8 -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilLayerTransformer.cs (.../PipingSoilLayerTransformer.cs) (revision be51145e1b013ea9e1353a6b8618bdc6fd855ff8) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilLayerTransformer.cs (.../PipingSoilLayerTransformer.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -92,15 +92,15 @@ return Enumerable.Empty(); } - double[] outerLoopIntersectionHeights = GetLoopIntersectionHeights(soilLayer.OuterLoop, atX).ToArray(); + double[] outerLoopIntersectionHeights = GetLoopIntersectionHeights(soilLayer.OuterLoop.Segments, atX).ToArray(); if (!outerLoopIntersectionHeights.Any()) { return Enumerable.Empty(); } var soilLayers = new Collection(); - IEnumerable> innerLoopsIntersectionHeights = soilLayer.InnerLoops.Select(loop => GetLoopIntersectionHeights(loop, atX)); + IEnumerable> innerLoopsIntersectionHeights = soilLayer.InnerLoops.Select(loop => GetLoopIntersectionHeights(loop.Segments, atX)); IEnumerable> innerLoopIntersectionHeightPairs = GetOrderedStartAndEndPairsIn1D(innerLoopsIntersectionHeights).ToList(); IEnumerable> outerLoopIntersectionHeightPairs = GetOrderedStartAndEndPairsIn1D(outerLoopIntersectionHeights).ToList(); Fisheye: Tag 7585d2fd78627d94d55ffa16423af90a91e4efd4 refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exceptions/SoilLayerConversionExceptionTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj =================================================================== diff -u -re343b677ebba0cff9ce37025214aa3109af39a1a -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision e343b677ebba0cff9ce37025214aa3109af39a1a) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -62,7 +62,6 @@ Properties\GlobalAssembly.cs - Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingSoilLayerTransformerTest.cs =================================================================== diff -u -re90d543fd7aa2c50473f343b3ab50938d252b65d -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingSoilLayerTransformerTest.cs (.../PipingSoilLayerTransformerTest.cs) (revision e90d543fd7aa2c50473f343b3ab50938d252b65d) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingSoilLayerTransformerTest.cs (.../PipingSoilLayerTransformerTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -236,7 +236,7 @@ public void SoilLayer2DTransform_EmptySoilLayer2D_ReturnsEmptyCollectionWithMaxValueBottom() { // Setup - var layer = new SoilLayer2D(); + var layer = new SoilLayer2D(new SoilLayer2DLoop(new Segment2D[0]), Enumerable.Empty()); double bottom; // Call @@ -860,11 +860,10 @@ public void SoilLayer2DTransform_IncorrectShiftedLogNormalDistribution_ThrowsImportedDataTransformException() { // Setup - var layer = new SoilLayer2D - { - BelowPhreaticLevelDistributionType = -1 - }; + SoilLayer2D layer = SoilLayer2DTestFactory.CreateSoilLayer2D(); + layer.BelowPhreaticLevelDistributionType = -1; + double bottom; // Call @@ -917,7 +916,7 @@ private static IEnumerable IncorrectLogNormalDistributionsSoilLayer2D() { - return IncorrectLogNormalDistributions(() => new SoilLayer2D(), nameof(SoilLayer2D)); + return IncorrectLogNormalDistributions(SoilLayer2DTestFactory.CreateSoilLayer2D, nameof(SoilLayer2D)); } private static IEnumerable IncorrectLogNormalDistributions(Func soilLayer, string typeName) Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingSoilProfileTransformerTest.cs =================================================================== diff -u -re343b677ebba0cff9ce37025214aa3109af39a1a -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingSoilProfileTransformerTest.cs (.../PipingSoilProfileTransformerTest.cs) (revision e343b677ebba0cff9ce37025214aa3109af39a1a) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingSoilProfileTransformerTest.cs (.../PipingSoilProfileTransformerTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -70,7 +70,7 @@ const string name = "name"; var profile = new SoilProfile2D(0, name, new[] { - new SoilLayer2D() + new SoilLayer2D(new SoilLayer2DLoop(new Segment2D[0]), Enumerable.Empty()) }, Enumerable.Empty()); // Call @@ -165,7 +165,7 @@ const string profileName = "SomeProfile"; var profile = new SoilProfile2D(0, profileName, new[] { - new SoilLayer2D() + new SoilLayer2D(new SoilLayer2DLoop(new Segment2D[0]), Enumerable.Empty()) }, Enumerable.Empty()); // Call Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingStochasticSoilModelTransformerTest.cs =================================================================== diff -u -re343b677ebba0cff9ce37025214aa3109af39a1a -r7585d2fd78627d94d55ffa16423af90a91e4efd4 --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingStochasticSoilModelTransformerTest.cs (.../PipingStochasticSoilModelTransformerTest.cs) (revision e343b677ebba0cff9ce37025214aa3109af39a1a) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingStochasticSoilModelTransformerTest.cs (.../PipingStochasticSoilModelTransformerTest.cs) (revision 7585d2fd78627d94d55ffa16423af90a91e4efd4) @@ -109,7 +109,7 @@ { StochasticSoilProfileTestFactory.CreateStochasticSoilProfileWithValidProbability(new SoilProfile2D(0, name, new[] { - new SoilLayer2D() + new SoilLayer2D(new SoilLayer2DLoop(new Segment2D[0]), Enumerable.Empty()) }, Enumerable.Empty())) });