Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GeneralGrassCoverErosionInwardsInput.cs =================================================================== diff -u -re3912b8e6d94f1d0e9c765ba8ec18ed29e8484db -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GeneralGrassCoverErosionInwardsInput.cs (.../GeneralGrassCoverErosionInwardsInput.cs) (revision e3912b8e6d94f1d0e9c765ba8ec18ed29e8484db) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GeneralGrassCoverErosionInwardsInput.cs (.../GeneralGrassCoverErosionInwardsInput.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -34,55 +34,63 @@ /// public GeneralGrassCoverErosionInwardsInput() { - Mqc = 1.0; - Fb = new NormalDistribution(2) + CriticalOvertoppingModelFactor = 1.0; + FbFactor = new NormalDistribution(2) { Mean = new RoundedDouble(2, 4.75), StandardDeviation = new RoundedDouble(2, 0.5) }; - Fn = new NormalDistribution(2) + FnFactor = new NormalDistribution(2) { Mean = new RoundedDouble(2, 2.6), StandardDeviation = new RoundedDouble(2, 0.35) }; - Mqo = 1.0; - Mz2 = new NormalDistribution(2) + OvertoppingModelFactor = 1.0; + FrunupModelFactor = new NormalDistribution(2) { Mean = new RoundedDouble(2, 1), StandardDeviation = new RoundedDouble(2, 0.07) }; - Fshallow = new NormalDistribution(2) + FshallowModelFactor = new NormalDistribution(2) { Mean = new RoundedDouble(2, 0.92), StandardDeviation = new RoundedDouble(2, 0.24) }; } - /// - /// Gets the model factor critical overtopping. - /// - public double Mqc { get; private set; } + #region Factors /// /// Gets the factor fb variable. /// - public NormalDistribution Fb { get; private set; } + public NormalDistribution FbFactor { get; private set; } /// /// Gets the factor fn variable. /// - public NormalDistribution Fn { get; private set; } + public NormalDistribution FnFactor { get; private set; } + #endregion + + #region Model Factors + /// + /// Gets the model factor critical overtopping. + /// + public double CriticalOvertoppingModelFactor { get; private set; } + + /// /// Gets the model factor overtopping. /// - public double Mqo { get; private set; } + public double OvertoppingModelFactor { get; private set; } /// - /// Gets the factor mz2 (or frunup) variable. + /// Gets the Model factor frunup variable. /// - public NormalDistribution Mz2 { get; private set; } + public NormalDistribution FrunupModelFactor { get; private set; } /// - /// Gets the factor fshallow variable. + /// Gets the Model factor fshallow variable. /// - public NormalDistribution Fshallow { get; private set; } + public NormalDistribution FshallowModelFactor { get; private set; } + + #endregion } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs =================================================================== diff -u -re3912b8e6d94f1d0e9c765ba8ec18ed29e8484db -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs (.../GrassCoverErosionInwardsInput.cs) (revision e3912b8e6d94f1d0e9c765ba8ec18ed29e8484db) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsInput.cs (.../GrassCoverErosionInwardsInput.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -157,66 +157,66 @@ /// /// Gets the model factor critical overtopping. /// - public double Mqc + public double CriticalOvertoppingModelFactor { get { - return generalInputParameters.Mqc; + return generalInputParameters.CriticalOvertoppingModelFactor; } } /// /// Gets the factor fb variable. /// - public NormalDistribution Fb + public NormalDistribution FbFactor { get { - return generalInputParameters.Fb; + return generalInputParameters.FbFactor; } } /// /// Gets the factor fn variable. /// - public NormalDistribution Fn + public NormalDistribution FnFactor { get { - return generalInputParameters.Fn; + return generalInputParameters.FnFactor; } } /// /// Gets the model factor overtopping. /// - public double Mqo + public double OvertoppingModelFactor { get { - return generalInputParameters.Mqo; + return generalInputParameters.OvertoppingModelFactor; } } /// /// Gets the factor mz2 (or frunup) variable. /// - public NormalDistribution Mz2 + public NormalDistribution FrunupModelFactor { get { - return generalInputParameters.Mz2; + return generalInputParameters.FrunupModelFactor; } } /// /// Gets the factor fshallow variable. /// - public NormalDistribution Fshallow + public NormalDistribution FshallowModelFactor { get { - return generalInputParameters.Fshallow; + return generalInputParameters.FshallowModelFactor; } } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r6dbb29ed12c28b66db763ff603f3ab8e28a0adf4 -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6dbb29ed12c28b66db763ff603f3ab8e28a0adf4) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -188,6 +188,24 @@ } /// + /// Looks up a localized string similar to Het kritische overslagdebiet.. + /// + public static string CriticalFlowRate_Description { + get { + return ResourceManager.GetString("CriticalFlowRate_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Kritisch overslagdebiet [m3/m/s]. + /// + public static string CriticalFlowRate_DisplayName { + get { + return ResourceManager.GetString("CriticalFlowRate_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Lijst met geometrie punten.. /// public static string DikeGeometry_Coordinates_Description { @@ -361,74 +379,74 @@ } /// - /// Looks up a localized string similar to De parameter 'fb' die gebruikt wordt in de berekening.. + /// Looks up a localized string similar to De parameter 'Fb factor' die gebruikt wordt in de berekening.. /// - public static string GrassCoverErosionInwardsInput_Fb_Description { + public static string GrassCoverErosionInwardsInput_FbFactor_Description { get { - return ResourceManager.GetString("GrassCoverErosionInwardsInput_Fb_Description", resourceCulture); + return ResourceManager.GetString("GrassCoverErosionInwardsInput_FbFactor_Description", resourceCulture); } } /// - /// Looks up a localized string similar to fb [-]. + /// Looks up a localized string similar to Fb factor [-]. /// - public static string GrassCoverErosionInwardsInput_Fb_DisplayName { + public static string GrassCoverErosionInwardsInput_FbFactor_DisplayName { get { - return ResourceManager.GetString("GrassCoverErosionInwardsInput_Fb_DisplayName", resourceCulture); + return ResourceManager.GetString("GrassCoverErosionInwardsInput_FbFactor_DisplayName", resourceCulture); } } /// - /// Looks up a localized string similar to De parameter 'fn' die gebruikt wordt in de berekening.. + /// Looks up a localized string similar to De parameter 'Fn factor' die gebruikt wordt in de berekening.. /// - public static string GrassCoverErosionInwardsInput_Fn_Description { + public static string GrassCoverErosionInwardsInput_FnFactor_Description { get { - return ResourceManager.GetString("GrassCoverErosionInwardsInput_Fn_Description", resourceCulture); + return ResourceManager.GetString("GrassCoverErosionInwardsInput_FnFactor_Description", resourceCulture); } } /// - /// Looks up a localized string similar to fn [-]. + /// Looks up a localized string similar to Fn factor [-]. /// - public static string GrassCoverErosionInwardsInput_Fn_DisplayName { + public static string GrassCoverErosionInwardsInput_FnFactor_DisplayName { get { - return ResourceManager.GetString("GrassCoverErosionInwardsInput_Fn_DisplayName", resourceCulture); + return ResourceManager.GetString("GrassCoverErosionInwardsInput_FnFactor_DisplayName", resourceCulture); } } /// - /// Looks up a localized string similar to De parameter 'f ondiep' die gebruikt wordt in de berekening.. + /// Looks up a localized string similar to De parameter 'Frunup model factor' die gebruikt wordt in de berekening.. /// - public static string GrassCoverErosionInwardsInput_Fshallow_Description { + public static string GrassCoverErosionInwardsInput_FrunupModelFactor_Description { get { - return ResourceManager.GetString("GrassCoverErosionInwardsInput_Fshallow_Description", resourceCulture); + return ResourceManager.GetString("GrassCoverErosionInwardsInput_FrunupModelFactor_Description", resourceCulture); } } /// - /// Looks up a localized string similar to f ondiep [-]. + /// Looks up a localized string similar to Frunup model factor [-]. /// - public static string GrassCoverErosionInwardsInput_Fshallow_DisplayName { + public static string GrassCoverErosionInwardsInput_FrunupModelFactor_DisplayName { get { - return ResourceManager.GetString("GrassCoverErosionInwardsInput_Fshallow_DisplayName", resourceCulture); + return ResourceManager.GetString("GrassCoverErosionInwardsInput_FrunupModelFactor_DisplayName", resourceCulture); } } /// - /// Looks up a localized string similar to De parameter 'mz2' die gebruikt wordt in de berekening.. + /// Looks up a localized string similar to De parameter 'F ondiep model factor' die gebruikt wordt in de berekening.. /// - public static string GrassCoverErosionInwardsInput_Mz2_Description { + public static string GrassCoverErosionInwardsInput_FshallowModelFactor_Description { get { - return ResourceManager.GetString("GrassCoverErosionInwardsInput_Mz2_Description", resourceCulture); + return ResourceManager.GetString("GrassCoverErosionInwardsInput_FshallowModelFactor_Description", resourceCulture); } } /// - /// Looks up a localized string similar to mz2 [-]. + /// Looks up a localized string similar to F ondiep model factor [-]. /// - public static string GrassCoverErosionInwardsInput_Mz2_DisplayName { + public static string GrassCoverErosionInwardsInput_FshallowModelFactor_DisplayName { get { - return ResourceManager.GetString("GrassCoverErosionInwardsInput_Mz2_DisplayName", resourceCulture); + return ResourceManager.GetString("GrassCoverErosionInwardsInput_FshallowModelFactor_DisplayName", resourceCulture); } } @@ -515,6 +533,60 @@ } /// + /// Looks up a localized string similar to Het soort kansverdeling waarin deze parameter gedefinieerd wordt.. + /// + public static string NormalDistribution_DestributionType_Description { + get { + return ResourceManager.GetString("NormalDistribution_DestributionType_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Type verdeling. + /// + public static string NormalDistribution_DestributionType_DisplayName { + get { + return ResourceManager.GetString("NormalDistribution_DestributionType_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De gemiddelde waarde van de normale verdeling.. + /// + public static string NormalDistribution_Mean_Description { + get { + return ResourceManager.GetString("NormalDistribution_Mean_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Verwachtingswaarde. + /// + public static string NormalDistribution_Mean_DisplayName { + get { + return ResourceManager.GetString("NormalDistribution_Mean_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De standaardafwijking van de normale verdeling.. + /// + public static string NormalDistribution_StandardDeviation_Description { + get { + return ResourceManager.GetString("NormalDistribution_StandardDeviation_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Standaardafwijking. + /// + public static string NormalDistribution_StandardDeviation_DisplayName { + get { + return ResourceManager.GetString("NormalDistribution_StandardDeviation_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Oriëntatie van de dijk.. /// public static string Orientation_Description { Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx =================================================================== diff -u -r6dbb29ed12c28b66db763ff603f3ab8e28a0adf4 -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 6dbb29ed12c28b66db763ff603f3ab8e28a0adf4) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -244,34 +244,58 @@ Oriëntatie [º] - - De parameter 'fb' die gebruikt wordt in de berekening. + + De parameter 'Fb factor' die gebruikt wordt in de berekening. - - fb [-] + + Fb factor [-] - - De parameter 'fn' die gebruikt wordt in de berekening. + + De parameter 'Fn factor' die gebruikt wordt in de berekening. - - fn [-] + + Fn factor [-] - - De parameter 'f ondiep' die gebruikt wordt in de berekening. + + De parameter 'F ondiep model factor' die gebruikt wordt in de berekening. - - f ondiep [-] + + F ondiep model factor [-] - - De parameter 'mz2' die gebruikt wordt in de berekening. + + De parameter 'Frunup model factor' die gebruikt wordt in de berekening. - - mz2 [-] + + Frunup model factor [-] Naam van de grasbekleding erosie kruin en binnentalud berekening Naam + + Het soort kansverdeling waarin deze parameter gedefinieerd wordt. + + + Type verdeling + + + De gemiddelde waarde van de normale verdeling. + + + Verwachtingswaarde + + + De standaardafwijking van de normale verdeling. + + + Standaardafwijking + + + Het kritische overslagdebiet. + + + Kritisch overslagdebiet [m3/m/s] + \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DistributionProperties.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DistributionProperties.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DistributionProperties.cs (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -0,0 +1,90 @@ +// Copyright (C) Stichting Deltares 2016. 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.Globalization; +using Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.GrassCoverErosionInwards.Forms.Properties; + +namespace Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses +{ + /// + /// Property for probabilistic distribution. + /// + [TypeConverter(typeof(ExpandableObjectConverter))] + public abstract class DistributionProperties : ObjectProperties + { + protected IObservable Observerable; + + [ResourcesDisplayName(typeof(Resources), "NormalDistribution_DestributionType_DisplayName")] + [ResourcesDescription(typeof(Resources), "NormalDistribution_DestributionType_Description")] + public abstract string DistributionType { get; } + + [ResourcesDisplayName(typeof(Resources), "NormalDistribution_Mean_DisplayName")] + [ResourcesDescription(typeof(Resources), "NormalDistribution_Mean_Description")] + public virtual string Mean + { + get + { + return new RoundedDouble(2, data.Mean).Value.ToString(CultureInfo.InvariantCulture); + } + set + { + if (Observerable == null) + { + throw new ArgumentException(); + } + data.Mean = new RoundedDouble(data.StandardDeviation.NumberOfDecimalPlaces, double.Parse(value, CultureInfo.InvariantCulture)); + Observerable.NotifyObservers(); + } + } + + [ResourcesDisplayName(typeof(Resources), "NormalDistribution_StandardDeviation_DisplayName")] + [ResourcesDescription(typeof(Resources), "NormalDistribution_StandardDeviation_Description")] + public virtual string StandardDeviation + { + get + { + return new RoundedDouble(2, data.StandardDeviation).Value.ToString(CultureInfo.InvariantCulture); + } + set + { + if (Observerable == null) + { + throw new ArgumentException(); + } + data.StandardDeviation = new RoundedDouble(data.StandardDeviation.NumberOfDecimalPlaces, double.Parse(value, CultureInfo.InvariantCulture)); + Observerable.NotifyObservers(); + } + } + + public override string ToString() + { + return data == null ? Resources.NormalDistribution_StandardDeviation_DisplayName : + string.Format("{0} ({1} = {2})", Mean, Resources.NormalDistribution_StandardDeviation_DisplayName, StandardDeviation); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextProperties.cs =================================================================== diff -u -r5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextProperties.cs (.../GrassCoverErosionInwardsFailureMechanismContextProperties.cs) (revision 5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextProperties.cs (.../GrassCoverErosionInwardsFailureMechanismContextProperties.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -22,7 +22,6 @@ using Core.Common.Gui.Attributes; using Core.Common.Gui.PropertyBag; using Core.Common.Utils.Attributes; -using Ringtoets.Common.Data.Probabilistics; using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects; using Ringtoets.GrassCoverErosionInwards.Forms.Properties; @@ -36,10 +35,10 @@ private const int namePropertyIndex = 1; private const int codePropertyIndex = 2; private const int lengthEffectPropertyIndex = 3; - private const int mz2PropertyIndex = 4; - private const int fbPropertyIndex = 5; - private const int fnPropertyIndex = 6; - private const int fshallowPropertyIndex = 7; + private const int frunupModelFactorPropertyIndex = 4; + private const int fbFactorPropertyIndex = 5; + private const int fnFactorPropertyIndex = 6; + private const int fshallowModelFactorPropertyIndex = 7; #region Lengte effect parameters @@ -92,51 +91,63 @@ #region Model settings - [PropertyOrder(mz2PropertyIndex)] + [PropertyOrder(frunupModelFactorPropertyIndex)] [ResourcesCategory(typeof(Resources), "Categories_ModelSettings")] - [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_Mz2_DisplayName")] - [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_Mz2_Description")] - public NormalDistribution Mz2 + [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_FrunupModelFactor_DisplayName")] + [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_FrunupModelFactor_Description")] + public ReadOnlyNormalDistributionProperties FrunupModelFactor { get { - return data.WrappedData.GeneralInput.Mz2; + return new ReadOnlyNormalDistributionProperties + { + Data = data.WrappedData.GeneralInput.FrunupModelFactor + }; } } - [PropertyOrder(fbPropertyIndex)] + [PropertyOrder(fbFactorPropertyIndex)] [ResourcesCategory(typeof(Resources), "Categories_ModelSettings")] - [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_Fb_DisplayName")] - [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_Fb_Description")] - public NormalDistribution Fb + [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_FbFactor_DisplayName")] + [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_FbFactor_Description")] + public ReadOnlyNormalDistributionProperties FbFactor { get { - return data.WrappedData.GeneralInput.Fb; + return new ReadOnlyNormalDistributionProperties + { + Data = data.WrappedData.GeneralInput.FbFactor + }; } } - [PropertyOrder(fnPropertyIndex)] + [PropertyOrder(fnFactorPropertyIndex)] [ResourcesCategory(typeof(Resources), "Categories_ModelSettings")] - [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_Fn_DisplayName")] - [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_Fn_Description")] - public NormalDistribution Fn + [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_FnFactor_DisplayName")] + [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_FnFactor_Description")] + public ReadOnlyNormalDistributionProperties FnFactor { get { - return data.WrappedData.GeneralInput.Fn; + return new ReadOnlyNormalDistributionProperties + { + Data = data.WrappedData.GeneralInput.FnFactor + }; } } - [PropertyOrder(fshallowPropertyIndex)] + [PropertyOrder(fshallowModelFactorPropertyIndex)] [ResourcesCategory(typeof(Resources), "Categories_ModelSettings")] - [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_Fshallow_DisplayName")] - [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_Fshallow_Description")] - public NormalDistribution Fshallow + [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_FshallowModelFactor_DisplayName")] + [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_FshallowModelFactor_Description")] + public ReadOnlyNormalDistributionProperties FshallowModelFactor { get { - return data.WrappedData.GeneralInput.Fshallow; + return new ReadOnlyNormalDistributionProperties + { + Data = data.WrappedData.GeneralInput.FshallowModelFactor + }; } } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs =================================================================== diff -u -r88e4b60f9055cf9153fc5c7b618537accfc3f3fa -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs (.../GrassCoverErosionInwardsInputContextProperties.cs) (revision 88e4b60f9055cf9153fc5c7b618537accfc3f3fa) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs (.../GrassCoverErosionInwardsInputContextProperties.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -1,4 +1,25 @@ -using System.Globalization; +// Copyright (C) Stichting Deltares 2016. 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.Globalization; using Core.Common.Base.Data; using Core.Common.Gui.Attributes; using Core.Common.Gui.PropertyBag; @@ -18,6 +39,7 @@ private const int foreshorePropertyIndex = 3; private const int orientationPropertyIndex = 4; private const int breakWaterPropertyIndex = 5; + private const int criticalFlowRatePropertyIndex = 6; [PropertyOrder(dikeGeometryPropertyIndex)] [ResourcesCategory(typeof(Resources), "Categories_Schematisation")] @@ -97,5 +119,20 @@ }; } } + + [PropertyOrder(criticalFlowRatePropertyIndex)] + [ResourcesCategory(typeof(Resources), "Categories_CriticalValues")] + [ResourcesDisplayName(typeof(Resources), "CriticalFlowRate_DisplayName")] + [ResourcesDescription(typeof(Resources), "CriticalFlowRate_Description")] + public LogNormalDistributionProperties CriticalFlowRate + { + get + { + return new LogNormalDistributionProperties(data.WrappedData) + { + Data = data.WrappedData.CriticalFlowRate + }; + } + } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/LogNormalDistributionProperties.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/LogNormalDistributionProperties.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/LogNormalDistributionProperties.cs (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -0,0 +1,49 @@ +// Copyright (C) Stichting Deltares 2016. 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.ComponentModel; +using Core.Common.Base; +using Core.Common.Gui.PropertyBag; +using Ringtoets.Common.Data.Probabilistics; + +namespace Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses +{ + /// + /// An implementation for + /// properties. + /// + [TypeConverter(typeof(ExpandableObjectConverter))] + public class LogNormalDistributionProperties : DistributionProperties + { + public LogNormalDistributionProperties(IObservable observerable) + { + Observerable = observerable; + } + + public override string DistributionType + { + get + { + return "Lognormaal"; + } + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/ReadOnlyNormalDistributionProperties.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/ReadOnlyNormalDistributionProperties.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/ReadOnlyNormalDistributionProperties.cs (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -0,0 +1,61 @@ +// Copyright (C) Stichting Deltares 2016. 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.ComponentModel; +using Core.Common.Gui.PropertyBag; +using Ringtoets.Common.Data.Probabilistics; + +namespace Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses +{ + /// + /// A read-only implementation for + /// properties. + /// + [TypeConverter(typeof(ExpandableObjectConverter))] + public class ReadOnlyNormalDistributionProperties : DistributionProperties + { + public override string DistributionType + { + get + { + return "Normale verdeling"; + } + } + + [ReadOnly(true)] + public override string Mean + { + get + { + return base.Mean; + } + } + + [ReadOnly(true)] + public override string StandardDeviation + { + get + { + return base.StandardDeviation; + } + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj =================================================================== diff -u -r88e4b60f9055cf9153fc5c7b618537accfc3f3fa -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision 88e4b60f9055cf9153fc5c7b618537accfc3f3fa) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -59,6 +59,9 @@ + + + Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs =================================================================== diff -u -rfd98bcf5d1811dbcad2cc0e292a4349f8402b83a -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision fd98bcf5d1811dbcad2cc0e292a4349f8402b83a) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -143,13 +143,13 @@ HydraRingUncertaintiesType.All, new OvertoppingCalculationInput(hydraulicBoundaryLocationId, new HydraRingSection(hydraulicBoundaryLocationId, hydraulicBoundaryLocationId.ToString(), double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN), inwardsInput.DikeHeight, - inwardsInput.Mqc, - inwardsInput.Fb.Mean, inwardsInput.Fb.StandardDeviation, - inwardsInput.Fn.Mean, inwardsInput.Fn.StandardDeviation, - inwardsInput.Mqo, + inwardsInput.CriticalOvertoppingModelFactor, + inwardsInput.FbFactor.Mean, inwardsInput.FbFactor.StandardDeviation, + inwardsInput.FnFactor.Mean, inwardsInput.FnFactor.StandardDeviation, + inwardsInput.OvertoppingModelFactor, inwardsInput.CriticalFlowRate.StandardDeviation, inwardsInput.CriticalFlowRate.Mean, - inwardsInput.Mz2.Mean, inwardsInput.Mz2.StandardDeviation, - inwardsInput.Fshallow.Mean, inwardsInput.Fshallow.StandardDeviation, + inwardsInput.FrunupModelFactor.Mean, inwardsInput.FrunupModelFactor.StandardDeviation, + inwardsInput.FshallowModelFactor.Mean, inwardsInput.FshallowModelFactor.StandardDeviation, ParseProfilePoints(inwardsInput.DikeGeometry), ParseForeshore(inwardsInput), ParseBreakWater(inwardsInput) Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GeneralGrassCoverErosionInwardsInputTest.cs =================================================================== diff -u -r392c4a63ebfaee062d8dc611ecf41881ac1fe3a5 -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GeneralGrassCoverErosionInwardsInputTest.cs (.../GeneralGrassCoverErosionInwardsInputTest.cs) (revision 392c4a63ebfaee062d8dc611ecf41881ac1fe3a5) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GeneralGrassCoverErosionInwardsInputTest.cs (.../GeneralGrassCoverErosionInwardsInputTest.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -35,36 +35,36 @@ var inputParameters = new GeneralGrassCoverErosionInwardsInput(); // Assert - var fb = new NormalDistribution(2) + var fbFactor = new NormalDistribution(2) { Mean = new RoundedDouble(2, 4.75), StandardDeviation = new RoundedDouble(2, 0.5) }; - Assert.AreEqual(fb.Mean, inputParameters.Fb.Mean); - Assert.AreEqual(fb.StandardDeviation, inputParameters.Fb.StandardDeviation); + Assert.AreEqual(fbFactor.Mean, inputParameters.FbFactor.Mean); + Assert.AreEqual(fbFactor.StandardDeviation, inputParameters.FbFactor.StandardDeviation); - var fn = new NormalDistribution(2) + var fnFactor = new NormalDistribution(2) { Mean = new RoundedDouble(2, 2.6), StandardDeviation = new RoundedDouble(2, 0.35) }; - Assert.AreEqual(fn.Mean, inputParameters.Fn.Mean); - Assert.AreEqual(fn.StandardDeviation, inputParameters.Fn.StandardDeviation); + Assert.AreEqual(fnFactor.Mean, inputParameters.FnFactor.Mean); + Assert.AreEqual(fnFactor.StandardDeviation, inputParameters.FnFactor.StandardDeviation); var fshallow = new NormalDistribution(2) { Mean = new RoundedDouble(2, 0.92), StandardDeviation = new RoundedDouble(2, 0.24) }; - Assert.AreEqual(fshallow.Mean, inputParameters.Fshallow.Mean); - Assert.AreEqual(fshallow.StandardDeviation, inputParameters.Fshallow.StandardDeviation); + Assert.AreEqual(fshallow.Mean, inputParameters.FshallowModelFactor.Mean); + Assert.AreEqual(fshallow.StandardDeviation, inputParameters.FshallowModelFactor.StandardDeviation); - var mz2 = new NormalDistribution(2) + var frunupModelFactor = new NormalDistribution(2) { Mean = new RoundedDouble(2, 1), StandardDeviation = new RoundedDouble(2, 0.07) }; - Assert.AreEqual(mz2.Mean, inputParameters.Mz2.Mean); - Assert.AreEqual(mz2.StandardDeviation, inputParameters.Mz2.StandardDeviation); + Assert.AreEqual(frunupModelFactor.Mean, inputParameters.FrunupModelFactor.Mean); + Assert.AreEqual(frunupModelFactor.StandardDeviation, inputParameters.FrunupModelFactor.StandardDeviation); - Assert.AreEqual(1, inputParameters.Mqc); - Assert.AreEqual(1, inputParameters.Mqo); + Assert.AreEqual(1, inputParameters.CriticalOvertoppingModelFactor); + Assert.AreEqual(1, inputParameters.OvertoppingModelFactor); } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs =================================================================== diff -u -r392c4a63ebfaee062d8dc611ecf41881ac1fe3a5 -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs (.../GrassCoverErosionInwardsInputTest.cs) (revision 392c4a63ebfaee062d8dc611ecf41881ac1fe3a5) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsInputTest.cs (.../GrassCoverErosionInwardsInputTest.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -57,12 +57,12 @@ CollectionAssert.IsEmpty(input.DikeGeometry); Assert.IsNull(input.HydraulicBoundaryLocation); - Assert.AreEqual(generalInput.Fb, input.Fb); - Assert.AreEqual(generalInput.Fn, input.Fn); - Assert.AreEqual(generalInput.Fshallow, input.Fshallow); - Assert.AreEqual(generalInput.Mz2, input.Mz2); - Assert.AreEqual(generalInput.Mqc, input.Mqc); - Assert.AreEqual(generalInput.Mqo, input.Mqo); + Assert.AreEqual(generalInput.FbFactor, input.FbFactor); + Assert.AreEqual(generalInput.FnFactor, input.FnFactor); + Assert.AreEqual(generalInput.FshallowModelFactor, input.FshallowModelFactor); + Assert.AreEqual(generalInput.FrunupModelFactor, input.FrunupModelFactor); + Assert.AreEqual(generalInput.CriticalOvertoppingModelFactor, input.CriticalOvertoppingModelFactor); + Assert.AreEqual(generalInput.OvertoppingModelFactor, input.OvertoppingModelFactor); } [Test] Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DistributionPropertiesTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DistributionPropertiesTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DistributionPropertiesTest.cs (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -0,0 +1,222 @@ +// Copyright (C) Stichting Deltares 2016. 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.Globalization; +using Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses; + +namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.PropertyClasses +{ + [TestFixture] + public class DistributionPropertiesTest + { + private MockRepository mockRepository; + + [SetUp] + public void SetUp() + { + mockRepository = new MockRepository(); + } + + [Test] + public void Constructor_ExpectedValues() + { + // Setup & Call + var properties = new SimpleDistributionProperties(); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.IsNull(properties.Data); + Assert.AreEqual("Standaardafwijking", properties.ToString()); + Assert.AreEqual("SimpleDestributionType", properties.DistributionType); + } + + [Test] + public void Data_SetNewDistributionContextInstance_ReturnCorrectPropertyValues() + { + // Setup + var distribution = new SimpleDistribution + { + Mean = new RoundedDouble(1, 1.1), + StandardDeviation = new RoundedDouble(2, 2.2) + }; + + var properties = new SimpleDistributionProperties(); + + // Call + properties.Data = distribution; + + // Assert + var expectedMean = new RoundedDouble(2, distribution.Mean).Value.ToString(CultureInfo.InvariantCulture); + Assert.AreEqual(expectedMean, properties.Mean); + var expectedStandardDeviation = new RoundedDouble(2, distribution.StandardDeviation).Value.ToString(CultureInfo.InvariantCulture); + Assert.AreEqual(expectedStandardDeviation, properties.StandardDeviation); + } + + [Test] + public void SetProperties_MeanWithoutObserverable_ThrowsArgumentException() + { + // Setup + var properties = new SimpleDistributionProperties + { + Data = new SimpleDistribution(), + }; + + // Call + TestDelegate test = () => properties.Mean = "20"; + + // Assert + Assert.Throws(test); + } + + [Test] + public void SetProperties_StandardDeviationWithoutObserverable_ThrowsArgumentException() + { + // Setup + var properties = new SimpleDistributionProperties + { + Data = new SimpleDistribution() + }; + + // Call + TestDelegate test = () => properties.StandardDeviation = "20"; + + // Assert + Assert.Throws(test); + } + + [Test] + public void SetProperties_MeanWithObserverable_ValueSetNotifyObservers() + { + // Setup + var observerableMock = mockRepository.StrictMock(); + observerableMock.Expect(o => o.NotifyObservers()).Repeat.Once(); + var properties = new SimpleObserverableDistributionProperties(observerableMock) + { + Data = new SimpleDistribution(), + }; + mockRepository.ReplayAll(); + const string newMeanValue = "20"; + + // Call + properties.Mean = newMeanValue; + + // Assert + Assert.AreEqual(newMeanValue, properties.Mean); + mockRepository.VerifyAll(); + } + + [Test] + public void SetProperties_StandardDeviationWithObserverable_ValueSetNotifyObservers() + { + // Setup + var observerableMock = mockRepository.StrictMock(); + observerableMock.Expect(o => o.NotifyObservers()).Repeat.Once(); + var properties = new SimpleObserverableDistributionProperties(observerableMock) + { + Data = new SimpleDistribution(), + }; + mockRepository.ReplayAll(); + const string newStandardDeviationValue = "20"; + + // Call + properties.StandardDeviation = newStandardDeviationValue; + + // Assert + Assert.AreEqual(newStandardDeviationValue, properties.StandardDeviation); + mockRepository.VerifyAll(); + } + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Call + var properties = new SimpleDistributionProperties + { + Data = new SimpleDistribution() + }; + + // Assert + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + Assert.IsInstanceOf(classTypeConverter); + + var dynamicPropertyBag = new DynamicPropertyBag(properties); + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + Assert.AreEqual(4, dynamicProperties.Count); + + PropertyDescriptor distributionTypeProperty = dynamicProperties[0]; + Assert.IsNotNull(distributionTypeProperty); + Assert.IsTrue(distributionTypeProperty.IsReadOnly); + + PropertyDescriptor meanProperty = dynamicProperties[1]; + Assert.IsNotNull(meanProperty); + Assert.IsFalse(meanProperty.IsReadOnly); + Assert.AreEqual("Verwachtingswaarde", meanProperty.DisplayName); + Assert.AreEqual("De gemiddelde waarde van de normale verdeling.", meanProperty.Description); + + PropertyDescriptor standardDeviationProperty = dynamicProperties[2]; + Assert.IsNotNull(standardDeviationProperty); + Assert.IsFalse(standardDeviationProperty.IsReadOnly); + Assert.AreEqual("Standaardafwijking", standardDeviationProperty.DisplayName); + Assert.AreEqual("De standaardafwijking van de normale verdeling.", standardDeviationProperty.Description); + } + + private class SimpleDistributionProperties : DistributionProperties + { + public override string DistributionType + { + get + { + return "SimpleDestributionType"; + } + } + } + + private class SimpleObserverableDistributionProperties : DistributionProperties + { + public SimpleObserverableDistributionProperties(IObservable observerable) + { + Observerable = observerable; + } + + public override string DistributionType + { + get + { + return "SimpleDestributionType"; + } + } + } + + private class SimpleDistribution : IDistribution + { + public RoundedDouble Mean { get; set; } + public RoundedDouble StandardDeviation { get; set; } + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs =================================================================== diff -u -r5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs) (revision 5acd1f33b430b3efb7b77f1b3a8ea6ee3669269f) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -20,7 +20,9 @@ // All rights reserved. using System.ComponentModel; +using System.Globalization; using Core.Common.Base; +using Core.Common.Base.Data; using Core.Common.Gui.PropertyBag; using NUnit.Framework; using Rhino.Mocks; @@ -71,6 +73,19 @@ Assert.AreEqual(Resources.GrassCoverErosionInwardsFailureMechanism_DisplayName, properties.Name); Assert.AreEqual(Resources.GrassCoverErosionInwardsFailureMechanism_DisplayCode, properties.Code); Assert.AreEqual(2, properties.LengthEffect); + var generalInput = new GeneralGrassCoverErosionInwardsInput(); + + VerifyRoundedDoubleString(generalInput.FbFactor.Mean, properties.FbFactor.Mean); + VerifyRoundedDoubleString(generalInput.FbFactor.StandardDeviation, properties.FbFactor.StandardDeviation); + + VerifyRoundedDoubleString(generalInput.FnFactor.Mean, properties.FnFactor.Mean); + VerifyRoundedDoubleString(generalInput.FnFactor.StandardDeviation, properties.FnFactor.StandardDeviation); + + VerifyRoundedDoubleString(generalInput.FrunupModelFactor.Mean, properties.FrunupModelFactor.Mean); + VerifyRoundedDoubleString(generalInput.FrunupModelFactor.StandardDeviation, properties.FrunupModelFactor.StandardDeviation); + + VerifyRoundedDoubleString(generalInput.FshallowModelFactor.Mean, properties.FshallowModelFactor.Mean); + VerifyRoundedDoubleString(generalInput.FshallowModelFactor.StandardDeviation, properties.FshallowModelFactor.StandardDeviation); mockRepository.VerifyAll(); } @@ -138,37 +153,43 @@ Assert.AreEqual("N", lengthEffectProperty.DisplayName); Assert.AreEqual("De parameter 'N' die gebruikt wordt voor het lengte effect in de berekening.", lengthEffectProperty.Description); - PropertyDescriptor mz2Property = dynamicProperties[mz2PropertyIndex]; - Assert.IsNotNull(mz2Property); - Assert.IsTrue(mz2Property.IsReadOnly); - Assert.AreEqual("mz2 [-]", mz2Property.DisplayName); - Assert.AreEqual("De parameter 'mz2' die gebruikt wordt in de berekening.", mz2Property.Description); + PropertyDescriptor frunupModelFactorProperty = dynamicProperties[frunupModelFactorPropertyIndex]; + Assert.IsNotNull(frunupModelFactorProperty); + Assert.IsTrue(frunupModelFactorProperty.IsReadOnly); + Assert.AreEqual("Frunup model factor [-]", frunupModelFactorProperty.DisplayName); + Assert.AreEqual("De parameter 'Frunup model factor' die gebruikt wordt in de berekening.", frunupModelFactorProperty.Description); - PropertyDescriptor fbProperty = dynamicProperties[fbPropertyIndex]; - Assert.IsNotNull(fbProperty); - Assert.IsTrue(fbProperty.IsReadOnly); - Assert.AreEqual("fb [-]", fbProperty.DisplayName); - Assert.AreEqual("De parameter 'fb' die gebruikt wordt in de berekening.", fbProperty.Description); + PropertyDescriptor fbModelProperty = dynamicProperties[fbFactorPropertyIndex]; + Assert.IsNotNull(fbModelProperty); + Assert.IsTrue(fbModelProperty.IsReadOnly); + Assert.AreEqual("Fb factor [-]", fbModelProperty.DisplayName); + Assert.AreEqual("De parameter 'Fb factor' die gebruikt wordt in de berekening.", fbModelProperty.Description); - PropertyDescriptor fnProperty = dynamicProperties[fnPropertyIndex]; - Assert.IsNotNull(fnProperty); - Assert.IsTrue(fnProperty.IsReadOnly); - Assert.AreEqual("fn [-]", fnProperty.DisplayName); - Assert.AreEqual("De parameter 'fn' die gebruikt wordt in de berekening.", fnProperty.Description); + PropertyDescriptor fnFactorProperty = dynamicProperties[fnFactorPropertyIndex]; + Assert.IsNotNull(fnFactorProperty); + Assert.IsTrue(fnFactorProperty.IsReadOnly); + Assert.AreEqual("Fn factor [-]", fnFactorProperty.DisplayName); + Assert.AreEqual("De parameter 'Fn factor' die gebruikt wordt in de berekening.", fnFactorProperty.Description); - PropertyDescriptor fshallowProperty = dynamicProperties[fshallowPropertyIndex]; + PropertyDescriptor fshallowProperty = dynamicProperties[fshallowModelFactorPropertyIndex]; Assert.IsNotNull(fshallowProperty); Assert.IsTrue(fshallowProperty.IsReadOnly); - Assert.AreEqual("f ondiep [-]", fshallowProperty.DisplayName); - Assert.AreEqual("De parameter 'f ondiep' die gebruikt wordt in de berekening.", fshallowProperty.Description); + Assert.AreEqual("F ondiep model factor [-]", fshallowProperty.DisplayName); + Assert.AreEqual("De parameter 'F ondiep model factor' die gebruikt wordt in de berekening.", fshallowProperty.Description); } + private static void VerifyRoundedDoubleString(RoundedDouble roundedDouble, string expectedString) + { + var stringValue = new RoundedDouble(2, roundedDouble).Value.ToString(CultureInfo.InvariantCulture); + Assert.AreEqual(expectedString, stringValue); + } + private const int namePropertyIndex = 0; private const int codePropertyIndex = 1; private const int lengthEffectPropertyIndex = 2; - private const int mz2PropertyIndex = 3; - private const int fbPropertyIndex = 4; - private const int fnPropertyIndex = 5; - private const int fshallowPropertyIndex = 6; + private const int frunupModelFactorPropertyIndex = 3; + private const int fbFactorPropertyIndex = 4; + private const int fnFactorPropertyIndex = 5; + private const int fshallowModelFactorPropertyIndex = 6; } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsInputContextPropertiesTest.cs =================================================================== diff -u -r88e4b60f9055cf9153fc5c7b618537accfc3f3fa -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsInputContextPropertiesTest.cs (.../GrassCoverErosionInwardsInputContextPropertiesTest.cs) (revision 88e4b60f9055cf9153fc5c7b618537accfc3f3fa) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsInputContextPropertiesTest.cs (.../GrassCoverErosionInwardsInputContextPropertiesTest.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -101,6 +101,8 @@ Assert.AreEqual(breakWaterProperties.BreakWaterPresent, properties.BreakWater.BreakWaterPresent); Assert.AreEqual(breakWaterProperties.BreakWaterHeight, properties.BreakWater.BreakWaterHeight); Assert.AreEqual(breakWaterProperties.BreakWaterType, properties.BreakWater.BreakWaterType); + VerifyRoundedDoubleString(input.CriticalFlowRate.Mean, properties.CriticalFlowRate.Mean); + VerifyRoundedDoubleString(input.CriticalFlowRate.StandardDeviation, properties.CriticalFlowRate.StandardDeviation); mockRepository.VerifyAll(); } @@ -157,7 +159,7 @@ // Assert var dynamicPropertyBag = new DynamicPropertyBag(properties); PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); - Assert.AreEqual(6, dynamicProperties.Count); + Assert.AreEqual(7, dynamicProperties.Count); PropertyDescriptor dikeGeometryProperty = dynamicProperties[dikeGeometryPropertyIndex]; Assert.IsNotNull(dikeGeometryProperty); @@ -188,13 +190,26 @@ Assert.IsTrue(breakWaterProperty.IsReadOnly); Assert.AreEqual("Havendam", breakWaterProperty.DisplayName); Assert.AreEqual("Eigenschappen van de havendam.", breakWaterProperty.Description); + + PropertyDescriptor criticalFlowRateProperty = dynamicProperties[criticalFlowRatePropertyIndex]; + Assert.IsNotNull(criticalFlowRateProperty); + Assert.IsTrue(criticalFlowRateProperty.IsReadOnly); + Assert.AreEqual("Kritisch overslagdebiet [m3/m/s]", criticalFlowRateProperty.DisplayName); + Assert.AreEqual("Het kritische overslagdebiet.", criticalFlowRateProperty.Description); mockRepository.VerifyAll(); } + private static void VerifyRoundedDoubleString(RoundedDouble roundedDouble, string expectedString) + { + var stringValue = new RoundedDouble(2, roundedDouble).Value.ToString(CultureInfo.InvariantCulture); + Assert.AreEqual(expectedString, stringValue); + } + private const int dikeGeometryPropertyIndex = 0; private const int dikeHeightPropertyIndex = 1; private const int foreshorePropertyIndex = 2; private const int orientationPropertyIndex = 3; private const int breakWaterPropertyIndex = 4; + private const int criticalFlowRatePropertyIndex = 5; } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/LogNormalDistributionPropertiesTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/LogNormalDistributionPropertiesTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/LogNormalDistributionPropertiesTest.cs (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -0,0 +1,75 @@ +// Copyright (C) Stichting Deltares 2016. 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.ComponentModel; +using Core.Common.Base; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses; + +namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.PropertyClasses +{ + [TestFixture] + public class LogNormalDistributionPropertiesTest + { + private MockRepository mockRepository; + + [SetUp] + public void SetUp() + { + mockRepository = new MockRepository(); + } + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var observerable = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + // Call + var properties = new LogNormalDistributionProperties(observerable); + + // Assert + Assert.IsInstanceOf(properties); + Assert.IsNull(properties.Data); + Assert.AreEqual("Lognormaal", properties.DistributionType); + mockRepository.VerifyAll(); + } + + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Setup + var observerable = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + // Call + var properties = new LogNormalDistributionProperties(observerable); + + // Assert + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + Assert.IsInstanceOf(classTypeConverter); + mockRepository.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/ReadOnlyNormalDistributionPropertiesTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/ReadOnlyNormalDistributionPropertiesTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/ReadOnlyNormalDistributionPropertiesTest.cs (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -0,0 +1,78 @@ +// Copyright (C) Stichting Deltares 2016. 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.ComponentModel; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses; + +namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.PropertyClasses +{ + [TestFixture] + public class ReadOnlyNormalDistributionPropertiesTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup & Call + var properties = new ReadOnlyNormalDistributionProperties(); + + // Assert + Assert.IsInstanceOf(properties); + Assert.IsNull(properties.Data); + Assert.AreEqual("Normale verdeling", properties.DistributionType); + } + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Setup + var mockRepository = new MockRepository(); + var distributionMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + // Call + var properties = new ReadOnlyNormalDistributionProperties + { + Data = distributionMock + }; + + // Assert + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + Assert.IsInstanceOf(classTypeConverter); + + var dynamicPropertyBag = new DynamicPropertyBag(properties); + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + Assert.AreEqual(4, dynamicProperties.Count); + + PropertyDescriptor meanProperty = dynamicProperties[1]; + Assert.IsNotNull(meanProperty); + Assert.IsTrue(meanProperty.IsReadOnly); + + PropertyDescriptor standardDeviation = dynamicProperties[2]; + Assert.IsNotNull(standardDeviation); + Assert.IsTrue(meanProperty.IsReadOnly); + mockRepository.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj =================================================================== diff -u -r88e4b60f9055cf9153fc5c7b618537accfc3f3fa -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision 88e4b60f9055cf9153fc5c7b618537accfc3f3fa) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -65,6 +65,7 @@ True Resources.resx + @@ -77,6 +78,8 @@ + + Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/TypeConverters/NormalDistributionDesignVariableTypeConverter.cs =================================================================== diff -u -r1e4d77c17c6eac78bfd705efdff9e52b4fca2c7e -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/TypeConverters/NormalDistributionDesignVariableTypeConverter.cs (.../NormalDistributionDesignVariableTypeConverter.cs) (revision 1e4d77c17c6eac78bfd705efdff9e52b4fca2c7e) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/TypeConverters/NormalDistributionDesignVariableTypeConverter.cs (.../NormalDistributionDesignVariableTypeConverter.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) @@ -31,7 +31,7 @@ /// A implementation for /// properties. /// - /// This class has been designed to be used in . + /// This class has been designed to be used in . /// If its reused somewhere else, change notification might not work properly. public sealed class NormalDistributionDesignVariableTypeConverter : DesignVariableTypeConverter { @@ -47,7 +47,7 @@ { new ParameterDefinition(d => d.Mean) { - Symbol = Resources.Probabilistics_Mean_Symbol, + Symbol = Resources.Probabilistics_Mean_Symbol, Description = String.Format(Resources.Probabilistics_Mean_description_for_Distribution_0_, lowerCaseDistributionName) },