Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r4e00271fd762917c0ce059fe0697e607ed0065fb -rba72ea65adf35ee865e55cd8e173e988f234eea9 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 4e00271fd762917c0ce059fe0697e607ed0065fb) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision ba72ea65adf35ee865e55cd8e173e988f234eea9) @@ -629,6 +629,62 @@ } /// + /// Looks up a localized string similar to Grensspanning op de aangegeven locatie.. + /// + public static string MacroStabilityInwardsPreconsolidationStressProperties_PreconsolidationStress_Description { + get { + return ResourceManager.GetString("MacroStabilityInwardsPreconsolidationStressProperties_PreconsolidationStress_Desc" + + "ription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Grensspanning [kN/m³]. + /// + public static string MacroStabilityInwardsPreconsolidationStressProperties_PreconsolidationStress_DisplayName { + get { + return ResourceManager.GetString("MacroStabilityInwardsPreconsolidationStressProperties_PreconsolidationStress_Disp" + + "layName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Lokale x-coördinaat van het punt waarvoor de grensspanning is opgegeven.. + /// + public static string MacroStabilityInwardsPreconsolidationStressProperties_XCoordinate_Description { + get { + return ResourceManager.GetString("MacroStabilityInwardsPreconsolidationStressProperties_XCoordinate_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to X [m]. + /// + public static string MacroStabilityInwardsPreconsolidationStressProperties_XCoordinate_DisplayName { + get { + return ResourceManager.GetString("MacroStabilityInwardsPreconsolidationStressProperties_XCoordinate_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Lokale z-coördinaat van het punt waarvoor de grensspanning is opgegeven.. + /// + public static string MacroStabilityInwardsPreconsolidationStressProperties_ZCoordinate_Description { + get { + return ResourceManager.GetString("MacroStabilityInwardsPreconsolidationStressProperties_ZCoordinate_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Z [m+NAP]. + /// + public static string MacroStabilityInwardsPreconsolidationStressProperties_ZCoordinate_DisplayName { + get { + return ResourceManager.GetString("MacroStabilityInwardsPreconsolidationStressProperties_ZCoordinate_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Faalkans [1/jaar]. /// public static string MacroStabilityInwardsScenarioView_MacroStabilityInwardsScenarioRow_MacroStabilityInwardsProbability { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx =================================================================== diff -u -r4e00271fd762917c0ce059fe0697e607ed0065fb -rba72ea65adf35ee865e55cd8e173e988f234eea9 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 4e00271fd762917c0ce059fe0697e607ed0065fb) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision ba72ea65adf35ee865e55cd8e173e988f234eea9) @@ -526,4 +526,22 @@ Bepaling + + Grensspanning op de aangegeven locatie. + + + Grensspanning [kN/m³] + + + Lokale x-coördinaat van het punt waarvoor de grensspanning is opgegeven. + + + X [m] + + + Lokale z-coördinaat van het punt waarvoor de grensspanning is opgegeven. + + + Z [m+NAP] + \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsPreconsolidationStressProperties.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsPreconsolidationStressProperties.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsPreconsolidationStressProperties.cs (revision ba72ea65adf35ee865e55cd8e173e988f234eea9) @@ -0,0 +1,94 @@ +// 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.Data; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.Common.Forms.PropertyClasses; +using Ringtoets.MacroStabilityInwards.Forms.Properties; +using Ringtoets.MacroStabilityInwards.Primitives; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.MacroStabilityInwards.Forms.PropertyClasses +{ + /// + /// ViewModel of for properties panel. + /// + public class MacroStabilityInwardsPreconsolidationStressProperties : ObjectProperties + { + /// + /// Creates a new instance of . + /// + /// The preconsolidation stress to create the properties for. + /// Thrown when + /// is null. + public MacroStabilityInwardsPreconsolidationStressProperties( + MacroStabilityInwardsPreconsolidationStress preconsolidationStress) + { + if (preconsolidationStress == null) + { + throw new ArgumentNullException(nameof(preconsolidationStress)); + } + + Data = preconsolidationStress; + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.MacroStabilityInwardsPreconsolidationStressProperties_XCoordinate_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.MacroStabilityInwardsPreconsolidationStressProperties_XCoordinate_Description))] + public RoundedDouble XCoordinate + { + get + { + return new RoundedDouble(2, data.XCoordinate); + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.MacroStabilityInwardsPreconsolidationStressProperties_ZCoordinate_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.MacroStabilityInwardsPreconsolidationStressProperties_ZCoordinate_Description))] + public RoundedDouble ZCoordinate + { + get + { + return new RoundedDouble(2, data.ZCoordinate); + } + } + + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.MacroStabilityInwardsPreconsolidationStressProperties_PreconsolidationStress_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.MacroStabilityInwardsPreconsolidationStressProperties_PreconsolidationStress_Description))] + public VariationCoefficientLogNormalDistributionProperties PreconsolidationStress + { + get + { + var variationCoefficientLogNormalDistribution = new VariationCoefficientLogNormalDistribution(2) + { + Mean = (RoundedDouble) data.PreconsolidationStressMean, + CoefficientOfVariation = (RoundedDouble) data.PreconsolidationStressCoefficientOfVariation + }; + return new VariationCoefficientLogNormalDistributionProperties(variationCoefficientLogNormalDistribution); + } + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj =================================================================== diff -u -r4e00271fd762917c0ce059fe0697e607ed0065fb -rba72ea65adf35ee865e55cd8e173e988f234eea9 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj (.../Ringtoets.MacroStabilityInwards.Forms.csproj) (revision 4e00271fd762917c0ce059fe0697e607ed0065fb) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Ringtoets.MacroStabilityInwards.Forms.csproj (.../Ringtoets.MacroStabilityInwards.Forms.csproj) (revision ba72ea65adf35ee865e55cd8e173e988f234eea9) @@ -46,6 +46,7 @@ Properties\GlobalAssembly.cs + Form Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilProfileTransformer.cs =================================================================== diff -u -r0b5e18b2ddd0f4af4e6483464a48c92d70531aa9 -rba72ea65adf35ee865e55cd8e173e988f234eea9 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilProfileTransformer.cs (.../MacroStabilityInwardsSoilProfileTransformer.cs) (revision 0b5e18b2ddd0f4af4e6483464a48c92d70531aa9) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/SoilProfiles/MacroStabilityInwardsSoilProfileTransformer.cs (.../MacroStabilityInwardsSoilProfileTransformer.cs) (revision ba72ea65adf35ee865e55cd8e173e988f234eea9) @@ -81,7 +81,8 @@ return new MacroStabilityInwardsSoilProfile1D(soilProfile.Name, soilProfile.Bottom, soilProfile.Layers - .Select(MacroStabilityInwardsSoilLayerTransformer.Transform)); + .Select(MacroStabilityInwardsSoilLayerTransformer.Transform) + .ToArray()); } /// @@ -96,8 +97,11 @@ { return new MacroStabilityInwardsSoilProfile2D(soilProfile.Name, soilProfile.Layers - .Select(MacroStabilityInwardsSoilLayerTransformer.Transform), - Enumerable.Empty()); //TODO WTI-1341 Placeholder + .Select(MacroStabilityInwardsSoilLayerTransformer.Transform) + .ToArray(), + soilProfile.PreconsolidationStresses + .Select(MacroStabilityInwardsPreconsolidationStressTransformer.Transform) + .ToArray()); } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsPreconsolidationStressPropertiesTest.cs =================================================================== diff -u --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsPreconsolidationStressPropertiesTest.cs (revision 0) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsPreconsolidationStressPropertiesTest.cs (revision ba72ea65adf35ee865e55cd8e173e988f234eea9) @@ -0,0 +1,108 @@ +// 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.ComponentModel; +using Core.Common.Base.Data; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Forms.PropertyClasses; +using Ringtoets.MacroStabilityInwards.Forms.PropertyClasses; +using Ringtoets.MacroStabilityInwards.Primitives; +using Ringtoets.MacroStabilityInwards.Primitives.TestUtil; + +namespace Ringtoets.MacroStabilityInwards.Forms.Test.PropertyClasses +{ + [TestFixture] + public class MacroStabilityInwardsPreconsolidationStressPropertiesTest + { + [Test] + public void Constructor_PreconsolidationStressNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new MacroStabilityInwardsPreconsolidationStressProperties(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("preconsolidationStress", exception.ParamName); + } + + [Test] + public void Constructor_WithPreconsolidationStress_ReturnsExpectedValues() + { + // Setup + var random = new Random(21); + var stress = new MacroStabilityInwardsPreconsolidationStress(random.NextDouble(), + random.NextDouble(), + random.NextDouble(), + random.NextDouble()); + + // Call + var properties = new MacroStabilityInwardsPreconsolidationStressProperties(stress); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.AreSame(stress, properties.Data); + + Assert.AreEqual(new RoundedDouble(2, stress.XCoordinate), properties.XCoordinate); + Assert.AreEqual(new RoundedDouble(2, stress.ZCoordinate), properties.ZCoordinate); + + Assert.IsInstanceOf(properties.PreconsolidationStress); + Assert.AreEqual(new RoundedDouble(2, stress.PreconsolidationStressMean), + properties.PreconsolidationStress.Mean); + Assert.AreEqual(new RoundedDouble(2, stress.PreconsolidationStressCoefficientOfVariation), + properties.PreconsolidationStress.CoefficientOfVariation); + } + + [Test] + public void Constructor_WithPreconsolidationStress_PropertiesHaveExpectedAttributeValues() + { + // Call + var properties = new MacroStabilityInwardsPreconsolidationStressProperties( + MacroStabilityInwardsPreconsolidationStressTestFactory.CreateMacroStabilityInwardsPreconsolidationStress()); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(3, dynamicProperties.Count); + + const string generalCategory = "Algemeen"; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + dynamicProperties[0], + generalCategory, + "X [m]", + "Lokale x-coördinaat van het punt waarvoor de grensspanning is opgegeven.", + true); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + dynamicProperties[1], + generalCategory, + "Z [m+NAP]", + "Lokale z-coördinaat van het punt waarvoor de grensspanning is opgegeven.", + true); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties( + dynamicProperties[2], + generalCategory, + "Grensspanning [kN/m³]", + "Grensspanning op de aangegeven locatie.", + true); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj =================================================================== diff -u -r4e00271fd762917c0ce059fe0697e607ed0065fb -rba72ea65adf35ee865e55cd8e173e988f234eea9 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj (.../Ringtoets.MacroStabilityInwards.Forms.Test.csproj) (revision 4e00271fd762917c0ce059fe0697e607ed0065fb) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Ringtoets.MacroStabilityInwards.Forms.Test.csproj (.../Ringtoets.MacroStabilityInwards.Forms.Test.csproj) (revision ba72ea65adf35ee865e55cd8e173e988f234eea9) @@ -74,6 +74,7 @@ + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj =================================================================== diff -u -r604dfe021f6161f8e5d107dd5821ba06390c5ecf -rba72ea65adf35ee865e55cd8e173e988f234eea9 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.Test.csproj) (revision 604dfe021f6161f8e5d107dd5821ba06390c5ecf) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/Ringtoets.MacroStabilityInwards.IO.Test.csproj (.../Ringtoets.MacroStabilityInwards.IO.Test.csproj) (revision ba72ea65adf35ee865e55cd8e173e988f234eea9) @@ -115,6 +115,10 @@ {2b78cf04-4785-4f27-a6e5-45bddbb7bf04} Ringtoets.MacroStabilityInwards.Data.TestUtil + + {1DF4EE8D-0EF5-4FCC-A40E-CB8B82080FDF} + Ringtoets.MacroStabilityInwards.Primitives.TestUtil + Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsSoilProfileTransformerTest.cs =================================================================== diff -u -r294e845538e8efe25b73287baa7f32861b813246 -rba72ea65adf35ee865e55cd8e173e988f234eea9 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsSoilProfileTransformerTest.cs (.../MacroStabilityInwardsSoilProfileTransformerTest.cs) (revision 294e845538e8efe25b73287baa7f32861b813246) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.IO.Test/SoilProfiles/MacroStabilityInwardsSoilProfileTransformerTest.cs (.../MacroStabilityInwardsSoilProfileTransformerTest.cs) (revision ba72ea65adf35ee865e55cd8e173e988f234eea9) @@ -90,7 +90,7 @@ var profile = new SoilProfile2D(1, "test", new[] { SoilLayer2DTestFactory.CreateSoilLayer2DWithValidAquifer() - }, Enumerable.Empty()); // TODO: WTI1341: write a transformer for the preconsolidation stresses + }, Enumerable.Empty()); // Call var transformedProfile = (MacroStabilityInwardsSoilProfile2D) MacroStabilityInwardsSoilProfileTransformer.Transform(profile); @@ -99,6 +99,50 @@ Assert.AreEqual(profile.Name, transformedProfile.Name); Assert.AreEqual(profile.Layers.Count(), transformedProfile.Layers.Count()); CollectionAssert.AllItemsAreInstancesOfType(transformedProfile.Layers, typeof(MacroStabilityInwardsSoilLayer2D)); + CollectionAssert.IsEmpty(transformedProfile.PreconsolidationStresses); } + + [Test] + public void Transform_SoilProfile2DWithPreconsolidationStresses_ReturnMacroStabilityInwardsSoilProfile2DWithStresses() + { + // Setup + var random = new Random(21); + var preconsolidationStress = new PreconsolidationStress + { + XCoordinate = random.NextDouble(), + ZCoordinate = random.NextDouble(), + PreconsolidationStressDistributionType = 3, + PreconsolidationStressMean = random.NextDouble(), + PreconsolidationStressCoefficientOfVariation = random.NextDouble(), + PreconsolidationStressShift = 0 + }; + + var profile = new SoilProfile2D(1, "test", new[] + { + SoilLayer2DTestFactory.CreateSoilLayer2DWithValidAquifer() + }, new[] + { + preconsolidationStress + }); + + // Call + var transformedProfile = (MacroStabilityInwardsSoilProfile2D) MacroStabilityInwardsSoilProfileTransformer.Transform(profile); + + // Assert + AssertPreconsolidationStress(preconsolidationStress, transformedProfile.PreconsolidationStresses.Single()); + } + + private static void AssertPreconsolidationStress(PreconsolidationStress preconsolidationStress, + MacroStabilityInwardsPreconsolidationStress transformedPreconsolidationStress) + { + Assert.AreEqual(preconsolidationStress.XCoordinate, + transformedPreconsolidationStress.XCoordinate); + Assert.AreEqual(preconsolidationStress.ZCoordinate, + transformedPreconsolidationStress.ZCoordinate); + Assert.AreEqual(preconsolidationStress.PreconsolidationStressMean, + transformedPreconsolidationStress.PreconsolidationStressMean); + Assert.AreEqual(preconsolidationStress.PreconsolidationStressCoefficientOfVariation, + transformedPreconsolidationStress.PreconsolidationStressCoefficientOfVariation); + } } } \ No newline at end of file