Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r0950c1a469810e87b914ad0bc0cebbca32850a4e -ra55213880414ace4d70b5755ee12783dec33f9b3 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 0950c1a469810e87b914ad0bc0cebbca32850a4e) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a55213880414ace4d70b5755ee12783dec33f9b3) @@ -804,7 +804,7 @@ } /// - /// Looks up a localized string similar to POP [kN/m³]. + /// Looks up a localized string similar to POP [kN/m²]. /// public static string MacroStabilityInwardsSoilLayerDataTable_ColumnHeader_Pop { get { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx =================================================================== diff -u -r0950c1a469810e87b914ad0bc0cebbca32850a4e -ra55213880414ace4d70b5755ee12783dec33f9b3 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 0950c1a469810e87b914ad0bc0cebbca32850a4e) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision a55213880414ace4d70b5755ee12783dec33f9b3) @@ -260,7 +260,7 @@ Gebruik POP - POP [kN/m³] + POP [kN/m²] De locatie van het bestand waaruit de profielschematisaties zijn geïmporteerd. Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFormattedSoilLayerDataRow.cs =================================================================== diff -u -rc16bf14238e7817258f0fa8d5304e0d0e1ae22be -ra55213880414ace4d70b5755ee12783dec33f9b3 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFormattedSoilLayerDataRow.cs (.../MacroStabilityInwardsFormattedSoilLayerDataRow.cs) (revision c16bf14238e7817258f0fa8d5304e0d0e1ae22be) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsFormattedSoilLayerDataRow.cs (.../MacroStabilityInwardsFormattedSoilLayerDataRow.cs) (revision a55213880414ace4d70b5755ee12783dec33f9b3) @@ -22,6 +22,8 @@ using System; using System.ComponentModel; using System.Drawing; +using System.Globalization; +using Core.Common.Base.Data; using Core.Common.Utils; using Ringtoets.Common.Data.Probabilistics; using Ringtoets.MacroStabilityInwards.Primitives; @@ -38,16 +40,17 @@ /// Creates a new instance of . /// /// The to format. + /// The index of the soil layer within the soil profile. /// Thrown when /// is null. - public MacroStabilityInwardsFormattedSoilLayerDataRow(IMacroStabilityInwardsSoilLayerData layerData) + public MacroStabilityInwardsFormattedSoilLayerDataRow(IMacroStabilityInwardsSoilLayerData layerData, int layerIndex) { if (layerData == null) { throw new ArgumentNullException(nameof(layerData)); } - MaterialName = layerData.MaterialName; + MaterialName = $"{layerIndex} {layerData.MaterialName}"; Color = layerData.Color; IsAquifer = layerData.IsAquifer; AbovePhreaticLevel = FormatVariationCoefficientDesignVariableWithShift(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(layerData)); @@ -124,16 +127,28 @@ private static string FormatVariationCoefficientDesignVariable(VariationCoefficientDesignVariable designVariable) { + RoundedDouble designValue = designVariable.GetDesignValue(); + if (double.IsNaN(designValue)) + { + return double.NaN.ToString(CultureInfo.CurrentCulture); + } + return string.Format(RingtoetsCommonFormsResources.VariationCoefficientDesignVariable_0_Mean_1_CoefficientOfVariation_2, - designVariable.GetDesignValue(), + designValue, designVariable.Distribution.Mean, designVariable.Distribution.CoefficientOfVariation); } private static string FormatVariationCoefficientDesignVariableWithShift(VariationCoefficientDesignVariable designVariable) { + RoundedDouble designValue = designVariable.GetDesignValue(); + if (double.IsNaN(designValue)) + { + return double.NaN.ToString(CultureInfo.CurrentCulture); + } + return string.Format(RingtoetsCommonFormsResources.VariationCoefficientDesignVariable_0_Mean_1_CoefficientOfVariation_2_Shift_3, - designVariable.GetDesignValue(), + designValue, designVariable.Distribution.Mean, designVariable.Distribution.CoefficientOfVariation, designVariable.Distribution.Shift); Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsSoilLayerDataTable.cs =================================================================== diff -u -r3a85bb13c6b7c5c6c90cd0b837e1e09607f29298 -ra55213880414ace4d70b5755ee12783dec33f9b3 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsSoilLayerDataTable.cs (.../MacroStabilityInwardsSoilLayerDataTable.cs) (revision 3a85bb13c6b7c5c6c90cd0b837e1e09607f29298) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsSoilLayerDataTable.cs (.../MacroStabilityInwardsSoilLayerDataTable.cs) (revision a55213880414ace4d70b5755ee12783dec33f9b3) @@ -22,14 +22,13 @@ using System.Collections.Generic; using System.Linq; using Core.Common.Controls.DataGrid; -using Ringtoets.MacroStabilityInwards.Data.SoilProfile; using Ringtoets.MacroStabilityInwards.Forms.Properties; using Ringtoets.MacroStabilityInwards.Primitives; namespace Ringtoets.MacroStabilityInwards.Forms.Views { /// - /// This class defines a table in which properties of instances + /// This class defines a table in which properties of instances /// are shown as rows. /// public class MacroStabilityInwardsSoilLayerDataTable : DataGridViewControl @@ -43,13 +42,22 @@ } /// - /// Sets the given for which the properties + /// Sets the given for which the properties /// are shown in the table. /// - /// The collection of layers to show. - public void SetData(IEnumerable layers) + /// The collection of layer data to show. + public void SetData(IEnumerable layerData) { - SetDataSource(layers?.Select(l => new MacroStabilityInwardsFormattedSoilLayerDataRow(l)).ToArray()); + if (layerData != null) + { + IEnumerable macroStabilityInwardsSoilLayerData = layerData.ToArray(); + int layerIndex = macroStabilityInwardsSoilLayerData.Count(); + SetDataSource(macroStabilityInwardsSoilLayerData.Select(soilLayerData => new MacroStabilityInwardsFormattedSoilLayerDataRow(soilLayerData, layerIndex--)).ToArray()); + } + else + { + SetDataSource(null); + } } private void AddColumns() @@ -83,9 +91,9 @@ AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSoilLayerDataRow.StrengthIncreaseExponent), Resources.MacroStabilityInwardsSoilLayerDataTable_ColumnHeader_StrengthIncreaseExponent, true); - AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSoilLayerDataRow.UsePop), - Resources.MacroStabilityInwardsSoilLayerDataTable_ColumnHeader_UsePop, - true); + AddCheckBoxColumn(nameof(MacroStabilityInwardsFormattedSoilLayerDataRow.UsePop), + Resources.MacroStabilityInwardsSoilLayerDataTable_ColumnHeader_UsePop, + true); AddTextBoxColumn(nameof(MacroStabilityInwardsFormattedSoilLayerDataRow.Pop), Resources.MacroStabilityInwardsSoilLayerDataTable_ColumnHeader_Pop, true); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFormattedSoilLayerDataRowTest.cs =================================================================== diff -u -rc16bf14238e7817258f0fa8d5304e0d0e1ae22be -ra55213880414ace4d70b5755ee12783dec33f9b3 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFormattedSoilLayerDataRowTest.cs (.../MacroStabilityInwardsFormattedSoilLayerDataRowTest.cs) (revision c16bf14238e7817258f0fa8d5304e0d0e1ae22be) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsFormattedSoilLayerDataRowTest.cs (.../MacroStabilityInwardsFormattedSoilLayerDataRowTest.cs) (revision a55213880414ace4d70b5755ee12783dec33f9b3) @@ -39,7 +39,7 @@ public void Constructor_SoilLayerDataNull_ThrowsArgumentNullException() { // Call - TestDelegate test = () => new MacroStabilityInwardsFormattedSoilLayerDataRow(null); + TestDelegate test = () => new MacroStabilityInwardsFormattedSoilLayerDataRow(null, 0); // Assert Assert.Throws(test); @@ -97,13 +97,13 @@ }; // Call - var formattedSoilLayerDataRow = new MacroStabilityInwardsFormattedSoilLayerDataRow(soilLayerData); + var formattedSoilLayerDataRow = new MacroStabilityInwardsFormattedSoilLayerDataRow(soilLayerData, 4); // Assert TestHelper.AssertTypeConverter( nameof(MacroStabilityInwardsFormattedSoilLayerDataRow.ShearStrengthModel)); - Assert.AreEqual(soilLayerData.MaterialName, formattedSoilLayerDataRow.MaterialName); + Assert.AreEqual("4 " + soilLayerData.MaterialName, formattedSoilLayerDataRow.MaterialName); Assert.AreEqual(soilLayerData.Color, formattedSoilLayerDataRow.Color); Assert.AreEqual(soilLayerData.IsAquifer, formattedSoilLayerDataRow.IsAquifer); Assert.AreEqual("0,85 (Verwachtingswaarde = 1,00, Variatiecoëfficiënt = 1,00, Verschuiving = 0,50)", formattedSoilLayerDataRow.AbovePhreaticLevel); @@ -116,5 +116,75 @@ Assert.AreEqual(soilLayerData.UsePop, formattedSoilLayerDataRow.UsePop); Assert.AreEqual("0,04 (Verwachtingswaarde = 7,00, Variatiecoëfficiënt = 7,00)", formattedSoilLayerDataRow.Pop); } + + [Test] + [SetCulture("nl-NL")] + public void Constructor_WithSoilLayerDataNaN_ExpectedValues() + { + // Setup + var soilLayerData = new MacroStabilityInwardsSoilLayerData + { + MaterialName = "Sand", + Color = Color.Black, + IsAquifer = true, + AbovePhreaticLevel = new VariationCoefficientLogNormalDistribution + { + CoefficientOfVariation = (RoundedDouble) double.NaN, + Mean = (RoundedDouble) double.NaN + }, + BelowPhreaticLevel = new VariationCoefficientLogNormalDistribution + { + CoefficientOfVariation = (RoundedDouble) double.NaN, + Mean = (RoundedDouble) double.NaN + }, + ShearStrengthModel = MacroStabilityInwardsShearStrengthModel.CPhi, + ShearStrengthRatio = new VariationCoefficientLogNormalDistribution + { + CoefficientOfVariation = (RoundedDouble) double.NaN, + Mean = (RoundedDouble) double.NaN + }, + Cohesion = new VariationCoefficientLogNormalDistribution + { + CoefficientOfVariation = (RoundedDouble) double.NaN, + Mean = (RoundedDouble) double.NaN + }, + FrictionAngle = new VariationCoefficientLogNormalDistribution + { + CoefficientOfVariation = (RoundedDouble) double.NaN, + Mean = (RoundedDouble) double.NaN + }, + StrengthIncreaseExponent = new VariationCoefficientLogNormalDistribution + { + CoefficientOfVariation = (RoundedDouble) double.NaN, + Mean = (RoundedDouble) double.NaN + }, + UsePop = true, + Pop = new VariationCoefficientLogNormalDistribution + { + CoefficientOfVariation = (RoundedDouble) double.NaN, + Mean = (RoundedDouble) double.NaN + } + }; + + // Call + var formattedSoilLayerDataRow = new MacroStabilityInwardsFormattedSoilLayerDataRow(soilLayerData, 2); + + // Assert + TestHelper.AssertTypeConverter( + nameof(MacroStabilityInwardsFormattedSoilLayerDataRow.ShearStrengthModel)); + + Assert.AreEqual("2 " + soilLayerData.MaterialName, formattedSoilLayerDataRow.MaterialName); + Assert.AreEqual(soilLayerData.Color, formattedSoilLayerDataRow.Color); + Assert.AreEqual(soilLayerData.IsAquifer, formattedSoilLayerDataRow.IsAquifer); + Assert.AreEqual("NaN", formattedSoilLayerDataRow.AbovePhreaticLevel); + Assert.AreEqual("NaN", formattedSoilLayerDataRow.BelowPhreaticLevel); + Assert.AreEqual(soilLayerData.ShearStrengthModel, formattedSoilLayerDataRow.ShearStrengthModel); + Assert.AreEqual("NaN", formattedSoilLayerDataRow.ShearStrengthRatio); + Assert.AreEqual("NaN", formattedSoilLayerDataRow.Cohesion); + Assert.AreEqual("NaN", formattedSoilLayerDataRow.FrictionAngle); + Assert.AreEqual("NaN", formattedSoilLayerDataRow.StrengthIncreaseExponent); + Assert.AreEqual(soilLayerData.UsePop, formattedSoilLayerDataRow.UsePop); + Assert.AreEqual("NaN", formattedSoilLayerDataRow.Pop); + } } } \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsSoilLayerDataTableTest.cs =================================================================== diff -u -r08b4eed44e677562b0c23ee4485e67e046d52ca4 -ra55213880414ace4d70b5755ee12783dec33f9b3 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsSoilLayerDataTableTest.cs (.../MacroStabilityInwardsSoilLayerDataTableTest.cs) (revision 08b4eed44e677562b0c23ee4485e67e046d52ca4) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsSoilLayerDataTableTest.cs (.../MacroStabilityInwardsSoilLayerDataTableTest.cs) (revision a55213880414ace4d70b5755ee12783dec33f9b3) @@ -58,6 +58,8 @@ Assert.AreEqual("Naam", nameColumn.HeaderText); DataGridViewColumn colorColumn = table.GetColumnFromIndex(colorColumnIndex); Assert.AreEqual("Kleur", colorColumn.HeaderText); + DataGridViewColumn isAquiferColumn = table.GetColumnFromIndex(isAquiferColumnIndex); + Assert.AreEqual("Is aquifer", isAquiferColumn.HeaderText); DataGridViewColumn abovePhreaticLevelColumn = table.GetColumnFromIndex(abovePhreaticLevelColumnIndex); Assert.AreEqual("Onverzadigd gewicht [kN/m³]", abovePhreaticLevelColumn.HeaderText); DataGridViewColumn belowPhreaticLevelColumn = table.GetColumnFromIndex(belowPhreaticLevelColumnIndex); @@ -75,7 +77,7 @@ DataGridViewColumn usePopColumn = table.GetColumnFromIndex(usePopColumnIndex); Assert.AreEqual("Gebruik POP", usePopColumn.HeaderText); DataGridViewColumn popColumn = table.GetColumnFromIndex(popColumnIndex); - Assert.AreEqual("POP [kN/m³]", popColumn.HeaderText); + Assert.AreEqual("POP [kN/m²]", popColumn.HeaderText); Assert.Throws(() => table.GetColumnFromIndex(popColumnIndex + 1)); @@ -177,7 +179,7 @@ { MacroStabilityInwardsSoilLayerData soilLayerData = layers[i]; DataGridViewCellCollection rowCells = table.Rows[i].Cells; - Assert.AreEqual(soilLayerData.MaterialName, + Assert.AreEqual((table.Rows.Count - i) + " " + soilLayerData.MaterialName, rowCells[nameColumnIndex].Value); Assert.AreEqual(soilLayerData.Color, rowCells[colorColumnIndex].Value);