// 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 System.Drawing; using System.Globalization; using Core.Common.Base.Data; using Core.Common.Utils; using Ringtoets.Common.Data.Helpers; using Ringtoets.Common.Data.Probabilistics; using Ringtoets.MacroStabilityInwards.Primitives; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; namespace Ringtoets.MacroStabilityInwards.Forms.Views { /// /// This class represents a row of . /// public class MacroStabilityInwardsFormattedSoilLayerDataRow { /// /// Creates a new instance of . /// /// The to format. /// Thrown when /// is null. public MacroStabilityInwardsFormattedSoilLayerDataRow(MacroStabilityInwardsSoilLayerData layerData) { if (layerData == null) { throw new ArgumentNullException(nameof(layerData)); } MaterialName = SoilLayerDataHelper.GetValidName(layerData.MaterialName); Color = SoilLayerDataHelper.GetValidColor(layerData.Color); IsAquifer = layerData.IsAquifer; AbovePhreaticLevel = FormatVariationCoefficientDesignVariableWithShift(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetAbovePhreaticLevel(layerData)); BelowPhreaticLevel = FormatVariationCoefficientDesignVariableWithShift(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetBelowPhreaticLevel(layerData)); ShearStrengthModel = layerData.ShearStrengthModel; Cohesion = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetCohesion(layerData)); FrictionAngle = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetFrictionAngle(layerData)); ShearStrengthRatio = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetShearStrengthRatio(layerData)); StrengthIncreaseExponent = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetStrengthIncreaseExponent(layerData)); UsePop = layerData.UsePop; Pop = FormatVariationCoefficientDesignVariable(MacroStabilityInwardsSemiProbabilisticDesignVariableFactory.GetPop(layerData)); } /// /// Gets a value indicating whether the layer is an aquifer. /// public bool IsAquifer { get; } /// /// Gets the material name of the layer. /// public string MaterialName { get; } /// /// Gets the color of the layer. /// public Color Color { get; } /// /// Gets the above phreatic level of the layer. /// [kN/m³] /// public string AbovePhreaticLevel { get; } /// /// Gets the below phreatic level of the layer. /// [kN/m³] /// public string BelowPhreaticLevel { get; } /// /// Gets the shear strength model of the layer. /// [TypeConverter(typeof(EnumTypeConverter))] public MacroStabilityInwardsShearStrengthModel ShearStrengthModel { get; } /// /// Gets the cohesion of the layer. /// [kN/m²] /// public string Cohesion { get; } /// /// Gets the friction angle of the layer. /// [°] /// public string FrictionAngle { get; } /// /// Gets the shear strength ratio of the layer. /// [-] /// public string ShearStrengthRatio { get; } /// /// Gets the strength increase exponent of the layer. /// [-] /// public string StrengthIncreaseExponent { get; } /// /// Gets a value indicating whether the layer is using POP. /// public bool UsePop { get; } /// /// Gets the POP of the layer. /// [kN/m²] /// public string Pop { get; } private static string FormatVariationCoefficientDesignVariable(VariationCoefficientDesignVariable designVariable) { RoundedDouble designValue = designVariable.GetDesignValue(); return double.IsNaN(designValue) ? double.NaN.ToString(CultureInfo.CurrentCulture) : string.Format(RingtoetsCommonFormsResources.VariationCoefficientDesignVariable_0_Mean_1_CoefficientOfVariation_2, designValue, designVariable.Distribution.Mean, designVariable.Distribution.CoefficientOfVariation); } private static string FormatVariationCoefficientDesignVariableWithShift(VariationCoefficientDesignVariable designVariable) { RoundedDouble designValue = designVariable.GetDesignValue(); return double.IsNaN(designValue) ? double.NaN.ToString(CultureInfo.CurrentCulture) : string.Format(RingtoetsCommonFormsResources.VariationCoefficientDesignVariable_0_Mean_1_CoefficientOfVariation_2_Shift_3, designValue, designVariable.Distribution.Mean, designVariable.Distribution.CoefficientOfVariation, designVariable.Distribution.Shift); } } }