Index: Ringtoets/Common/src/Ringtoets.Common.IO/Readers/CalculationConfigurationReaderHelper.cs
===================================================================
diff -u -r7594d7f46113b5c5f4f41bfbd0183a3789f648b9 -r7a466d4ccb9d859b47f565b400808eb6933b18f0
--- Ringtoets/Common/src/Ringtoets.Common.IO/Readers/CalculationConfigurationReaderHelper.cs (.../CalculationConfigurationReaderHelper.cs) (revision 7594d7f46113b5c5f4f41bfbd0183a3789f648b9)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Readers/CalculationConfigurationReaderHelper.cs (.../CalculationConfigurationReaderHelper.cs) (revision 7a466d4ccb9d859b47f565b400808eb6933b18f0)
@@ -20,9 +20,11 @@
// All rights reserved.
using System;
+using System.ComponentModel;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
+using Ringtoets.Common.IO.Schema;
namespace Ringtoets.Common.IO.Readers
{
@@ -32,7 +34,7 @@
public static class CalculationConfigurationReaderHelper
{
///
- /// Gets the double value from a descendant element.
+ /// Gets the value from a descendant element.
///
/// The that contains the descendant element.
/// The name of the descendant element.
@@ -58,7 +60,7 @@
}
///
- /// Gets the string value from a descendant element.
+ /// Gets the value from a descendant element.
///
/// The that contains the descendant element.
/// The name of the descendant element.
@@ -82,6 +84,67 @@
}
///
+ /// Gets the value from a descendant element.
+ ///
+ /// The that contains the descendant element.
+ /// The name of the descendant element.
+ /// The value, or null when the
+ /// does not have descendant elements of .
+ /// Thrown when any parameter is null.
+ public static bool? GetBoolValueFromDescendantElement(XElement parentElement, string descendantElementName)
+ {
+ XElement descendantElement = GetDescendantElement(parentElement, descendantElementName);
+
+ return descendantElement != null
+ ? (bool?) XmlConvert.ToBoolean(descendantElement.Value)
+ : null;
+ }
+
+ ///
+ /// Gets the converted value from a descendant element.
+ ///
+ /// The to use
+ /// The that contains the descendant element.
+ /// The name of the descendant element.
+ /// The converted value, or null when the
+ /// does not have descendant elements of .
+ /// Thrown when any parameter is null.
+ public static object GetConvertedValueFromDescendantElement(XElement parentElement, string descendantElementName) where TConverter : TypeConverter, new()
+ {
+ string stringValue = GetStringValueFromDescendantElement(parentElement, descendantElementName);
+ if (stringValue == null)
+ {
+ return null;
+ }
+ return new TConverter().ConvertFromInvariantString(stringValue);
+ }
+
+ ///
+ /// Gets the 'stochast' element from the descendant 'stochasts' element.
+ ///
+ /// The that contains the descendant element.
+ /// The name of the stochast element.
+ /// The stochast element, or null when the
+ /// does not have stochast elements with the name .
+ /// Thrown when any parameter is null.
+ public static XElement GetStochastElement(XElement parentElement, string stochastName)
+ {
+ if (parentElement == null)
+ {
+ throw new ArgumentNullException(nameof(parentElement));
+ }
+ if (stochastName == null)
+ {
+ throw new ArgumentNullException(nameof(stochastName));
+ }
+
+ return parentElement.Elements(ConfigurationSchemaIdentifiers.StochastsElement)
+ .FirstOrDefault()?
+ .Elements(ConfigurationSchemaIdentifiers.StochastElement)
+ .FirstOrDefault(e => e.Attribute(ConfigurationSchemaIdentifiers.NameAttribute)?.Value == stochastName);
+ }
+
+ ///
/// Gets a descendant element with the given .
///
/// The that contains the descendant element.
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Readers/CalculationConfigurationReaderHelperTest.cs
===================================================================
diff -u -r7594d7f46113b5c5f4f41bfbd0183a3789f648b9 -r7a466d4ccb9d859b47f565b400808eb6933b18f0
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Readers/CalculationConfigurationReaderHelperTest.cs (.../CalculationConfigurationReaderHelperTest.cs) (revision 7594d7f46113b5c5f4f41bfbd0183a3789f648b9)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Readers/CalculationConfigurationReaderHelperTest.cs (.../CalculationConfigurationReaderHelperTest.cs) (revision 7a466d4ccb9d859b47f565b400808eb6933b18f0)
@@ -21,15 +21,26 @@
using System;
using System.Collections.Generic;
+using System.Xml;
using System.Xml.Linq;
using NUnit.Framework;
using Ringtoets.Common.IO.Readers;
+using Ringtoets.Common.IO.Schema;
namespace Ringtoets.Common.IO.Test.Readers
{
[TestFixture]
public class CalculationConfigurationReaderHelperTest
{
+ private static IEnumerable XElements
+ {
+ get
+ {
+ yield return new TestCaseData(new XElement("Root", new XElement("descendant")));
+ yield return new TestCaseData(new XElement("Root", new XElement("Child", new XElement("descendant"))));
+ }
+ }
+
[Test]
public void GetDoubleValueFromDescendantElement_ParentElementNull_ThrowArgumentNullException()
{
@@ -133,6 +144,167 @@
}
[Test]
+ public void GetBoolValueFromDescendantElement_ParentElementNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => CalculationConfigurationReaderHelper.GetBoolValueFromDescendantElement(null, "");
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("parentElement", exception.ParamName);
+ }
+
+ [Test]
+ public void GetBoolValueFromDescendantElement_DescendantElementNameNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var element = new XElement("Root");
+
+ // Call
+ TestDelegate test = () => CalculationConfigurationReaderHelper.GetBoolValueFromDescendantElement(element, null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("descendantElementName", exception.ParamName);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void GetBoolValueFromDescendantElement_ValidDescendantElement_ReturnValue(bool booleanValue)
+ {
+ // Setup
+ const string descendantElementName = "booleanValue";
+ string elementValue = XmlConvert.ToString(booleanValue);
+
+ var element = new XElement("Root", new XElement(descendantElementName, elementValue));
+
+ // Call
+ bool? readValue = CalculationConfigurationReaderHelper.GetBoolValueFromDescendantElement(element, descendantElementName);
+
+ // Assert
+ Assert.AreEqual(booleanValue, readValue);
+ }
+
+ [Test]
+ public void GetBoolValueFromDescendantElement_UnmatchedDescendantElement_ReturnNull()
+ {
+ // Setup
+ string elementValue = XmlConvert.ToString(true);
+
+ var element = new XElement("Root", new XElement("booleanValue", elementValue));
+
+ // Call
+ bool? readValue = CalculationConfigurationReaderHelper.GetBoolValueFromDescendantElement(element, "unmatchingChildElementName");
+
+ // Assert
+ Assert.IsNull(readValue);
+ }
+
+ [Test]
+ public void GetStochastElement_ParentElementNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => CalculationConfigurationReaderHelper.GetStochastElement(null, "");
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("parentElement", exception.ParamName);
+ }
+
+ [Test]
+ public void GetStochastElement_StochastNameNull_ThrownArgumentNullException()
+ {
+ // Setup
+ var element = new XElement("Root");
+
+ // Call
+ TestDelegate test = () => CalculationConfigurationReaderHelper.GetStochastElement(element, null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("stochastName", exception.ParamName);
+ }
+
+ [Test]
+ public void GetStochastElement_RootElementWithoutStochastsElement_ReturnNull()
+ {
+ // Setup
+ var element = new XElement("Root");
+
+ // Call
+ XElement stochastElement = CalculationConfigurationReaderHelper.GetStochastElement(element, "stochast_name");
+
+ // Assert
+ Assert.IsNull(stochastElement);
+ }
+
+ [Test]
+ public void GetStochastElement_RootElementWithEmptyStochastsElement_ReturnNull()
+ {
+ // Setup
+ var stochastsElements = new XElement(ConfigurationSchemaIdentifiers.StochastsElement);
+ var element = new XElement("Root", stochastsElements);
+
+ // Call
+ XElement stochastElement = CalculationConfigurationReaderHelper.GetStochastElement(element, "stochast_name");
+
+ // Assert
+ Assert.IsNull(stochastElement);
+ }
+
+ [Test]
+ public void GetStochastElement_RootElementWithStochastsAndUnmatchedStochastElement_ReturnNull()
+ {
+ // Setup
+ var stochastA = new XElement(ConfigurationSchemaIdentifiers.StochastElement);
+ stochastA.SetAttributeValue(ConfigurationSchemaIdentifiers.NameAttribute, "A");
+
+ var stochastB = new XElement(ConfigurationSchemaIdentifiers.StochastElement);
+ stochastB.SetAttributeValue(ConfigurationSchemaIdentifiers.NameAttribute, "B");
+
+ var stochastsElements = new XElement(ConfigurationSchemaIdentifiers.StochastsElement);
+ stochastsElements.Add(stochastA);
+ stochastsElements.Add(stochastB);
+
+ var element = new XElement("Root", stochastsElements);
+
+ // Call
+ XElement stochastElement = CalculationConfigurationReaderHelper.GetStochastElement(element, "stochast_name");
+
+ // Assert
+ Assert.IsNull(stochastElement);
+ }
+
+ [Test]
+ public void GetStochastElement_RootElementWithStochastsAndMatchedStochastElement_ReturnMatchedElement()
+ {
+ // Setup
+ const string stochastName = "stochast_name";
+ var stochastA = new XElement(ConfigurationSchemaIdentifiers.StochastElement);
+ stochastA.SetAttributeValue(ConfigurationSchemaIdentifiers.NameAttribute, "A");
+
+ var stochastElementToMatch = new XElement(ConfigurationSchemaIdentifiers.StochastElement);
+ stochastElementToMatch.SetAttributeValue(ConfigurationSchemaIdentifiers.NameAttribute, stochastName);
+
+ var stochastB = new XElement(ConfigurationSchemaIdentifiers.StochastElement);
+ stochastB.SetAttributeValue(ConfigurationSchemaIdentifiers.NameAttribute, "B");
+
+ var stochastsElements = new XElement(ConfigurationSchemaIdentifiers.StochastsElement);
+ stochastsElements.Add(stochastA);
+ stochastsElements.Add(stochastElementToMatch);
+ stochastsElements.Add(stochastB);
+
+ var element = new XElement("Root", stochastsElements);
+
+ // Call
+ XElement stochastElement = CalculationConfigurationReaderHelper.GetStochastElement(element, stochastName);
+
+ // Assert
+ Assert.AreSame(stochastElementToMatch, stochastElement);
+ }
+
+ [Test]
public void GetDescendantElement_ParentElementNull_ThrowArgumentNullException()
{
// Call
@@ -171,21 +343,12 @@
{
// Setup
var parentElement = new XElement("Root", new XElement("Child", new XElement("descendant")));
-
+
// Call
XElement element = CalculationConfigurationReaderHelper.GetDescendantElement(parentElement, "something_else");
// Assert
Assert.IsNull(element);
}
-
- private static IEnumerable XElements
- {
- get
- {
- yield return new TestCaseData(new XElement("Root", new XElement("descendant")));
- yield return new TestCaseData(new XElement("Root", new XElement("Child", new XElement("descendant"))));
- }
- }
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/DikeHeightCalculationTypeTypeConverter.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/DikeHeightCalculationTypeTypeConverter.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/DikeHeightCalculationTypeTypeConverter.cs (revision 7a466d4ccb9d859b47f565b400808eb6933b18f0)
@@ -0,0 +1,83 @@
+// 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 Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.GrassCoverErosionInwards.IO.Properties;
+
+namespace Ringtoets.GrassCoverErosionInwards.IO
+{
+ ///
+ /// Converts to and back.
+ ///
+ public class DikeHeightCalculationTypeTypeConverter : TypeConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
+ {
+ if (destinationType == typeof(string))
+ {
+ var dikeHeightCalculationType = (DikeHeightCalculationType)value;
+ switch (dikeHeightCalculationType)
+ {
+ case DikeHeightCalculationType.NoCalculation:
+ return Resources.DikeHeightCalculationTypeTypeConverter_NoCalculation;
+ case DikeHeightCalculationType.CalculateByAssessmentSectionNorm:
+ return Resources.DikeHeightCalculationTypeTypeConverter_CalculateByAssessmentSectionNorm;
+ case DikeHeightCalculationType.CalculateByProfileSpecificRequiredProbability:
+ return Resources.DikeHeightCalculationTypeTypeConverter_CalculateByProfileSpecificRequiredProbability;
+ }
+ }
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+
+ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
+ {
+ if (sourceType == typeof(string))
+ {
+ return true;
+ }
+ return base.CanConvertFrom(context, sourceType);
+ }
+
+ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
+ {
+ var text = value as string;
+ if (text != null)
+ {
+ if (text == Resources.DikeHeightCalculationTypeTypeConverter_NoCalculation)
+ {
+ return DikeHeightCalculationType.NoCalculation;
+ }
+ if(text == Resources.DikeHeightCalculationTypeTypeConverter_CalculateByAssessmentSectionNorm)
+ {
+ return DikeHeightCalculationType.CalculateByAssessmentSectionNorm;
+ }
+ if (text == Resources.DikeHeightCalculationTypeTypeConverter_CalculateByProfileSpecificRequiredProbability)
+ {
+ return DikeHeightCalculationType.CalculateByProfileSpecificRequiredProbability;
+ }
+ }
+ return base.ConvertFrom(context, culture, value);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.cs
===================================================================
diff -u -r5a0ad0f264935355e5739924708870db8513d5c1 -r7a466d4ccb9d859b47f565b400808eb6933b18f0
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.cs (.../GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.cs) (revision 5a0ad0f264935355e5739924708870db8513d5c1)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.cs (.../GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.cs) (revision 7a466d4ccb9d859b47f565b400808eb6933b18f0)
@@ -29,11 +29,21 @@
///
/// The tag of elements containing the name of the dike profile.
///
- public const string HydraulicBoundaryLocationElement = "dijkprofiel";
+ public const string DikeProfileElement = "dijkprofiel";
///
/// The name for the critical flow rate stochast.
///
public static string CriticalFlowRateStochastName = "overslagdebiet";
+
+ ///
+ /// The identifier for the dike height elements.
+ ///
+ internal const string DikeHeightElement = "dijkhoogte";
+
+ ///
+ /// The identifier for the dike height calculation type elements.
+ ///
+ internal const string DikeHeightCalculationTypeElement = "hbnberekenen";
}
}
\ No newline at end of file
Fisheye: Tag d2b9feaf8aceaa9a96d0e6e19fd6fbbee8987ca6 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.Designer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag d2b9feaf8aceaa9a96d0e6e19fd6fbbee8987ca6 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Properties/Resources.resx'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/GrassCoverErosionInwardsCalculationConfigurationReader.cs (revision 7a466d4ccb9d859b47f565b400808eb6933b18f0)
@@ -0,0 +1,112 @@
+// 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.Collections.Generic;
+using System.Xml.Linq;
+using Core.Common.Base.IO;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.IO;
+using Ringtoets.Common.IO.Readers;
+using Ringtoets.Common.IO.Schema;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.GrassCoverErosionInwards.IO.Properties;
+using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources;
+
+namespace Ringtoets.GrassCoverErosionInwards.IO.Readers
+{
+ ///
+ /// This class reads a grass cover erosion inwards configuration from XML and creates
+ /// a collection of corresponding , typically
+ /// containing one or more .
+ ///
+ public class GrassCoverErosionInwardsCalculationConfigurationReader : CalculationConfigurationReader
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The file path to the XML file.
+ /// Thrown when is invalid.
+ /// Thrown when:
+ ///
+ /// points to a file that does not exist.
+ /// points to a file that does not contain valid XML.
+ /// points to a file that does not pass the schema validation.
+ /// points to a file that does not contain configuration elements.
+ ///
+ ///
+ public GrassCoverErosionInwardsCalculationConfigurationReader(string xmlFilePath)
+ : base(xmlFilePath,
+ Resources.GEKBConfiguratieSchema,
+ new Dictionary
+ {
+ {
+ "HrLocatieSchema.xsd", RingtoetsCommonIOResources.HrLocatieSchema
+ },
+ {
+ "OrientatieSchema.xsd", RingtoetsCommonIOResources.OrientatieSchema
+ },
+ {
+ "GolfReductieSchema.xsd", RingtoetsCommonIOResources.GolfReductieSchema
+ },
+ {
+ "StochastSchema.xsd", RingtoetsCommonIOResources.StochastSchema
+ }
+ }) {}
+
+ protected override ReadGrassCoverErosionInwardsCalculation ParseCalculationElement(XElement calculationElement)
+ {
+ var constructionProperties = new ReadGrassCoverErosionInwardsCalculation.ConstructionProperties
+ {
+ Name = calculationElement.Attribute(ConfigurationSchemaIdentifiers.NameAttribute)?.Value,
+ HydraulicBoundaryLocation = CalculationConfigurationReaderHelper.GetStringValueFromDescendantElement(calculationElement,
+ ConfigurationSchemaIdentifiers.HydraulicBoundaryLocationElement),
+ DikeProfile = CalculationConfigurationReaderHelper.GetStringValueFromDescendantElement(calculationElement,
+ GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.DikeProfileElement),
+ Orientation = CalculationConfigurationReaderHelper.GetDoubleValueFromDescendantElement(calculationElement,
+ ConfigurationSchemaIdentifiers.Orientation),
+ DikeHeight = CalculationConfigurationReaderHelper.GetDoubleValueFromDescendantElement(calculationElement,
+ GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.DikeHeightElement),
+ DikeHeightCalculationType = (DikeHeightCalculationType?) CalculationConfigurationReaderHelper.GetConvertedValueFromDescendantElement(calculationElement,
+ GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.DikeHeightCalculationTypeElement),
+ UseBreakWater = CalculationConfigurationReaderHelper.GetBoolValueFromDescendantElement(calculationElement,
+ ConfigurationSchemaIdentifiers.UseBreakWater),
+ BreakWaterType = (BreakWaterType?) CalculationConfigurationReaderHelper.GetConvertedValueFromDescendantElement(calculationElement,
+ ConfigurationSchemaIdentifiers.BreakWaterType),
+ BreakWaterHeight = CalculationConfigurationReaderHelper.GetDoubleValueFromDescendantElement(calculationElement,
+ ConfigurationSchemaIdentifiers.BreakWaterHeight),
+ UseForeshore = CalculationConfigurationReaderHelper.GetBoolValueFromDescendantElement(calculationElement,
+ ConfigurationSchemaIdentifiers.UseForeshore)
+ };
+
+ XElement criticalFlowRateElement = CalculationConfigurationReaderHelper.GetStochastElement(calculationElement, GrassCoverErosionInwardsCalculationConfigurationSchemaIdentifiers.CriticalFlowRateStochastName);
+ if (criticalFlowRateElement != null)
+ {
+ constructionProperties.CriticalFlowRateMean = CalculationConfigurationReaderHelper.GetDoubleValueFromDescendantElement(criticalFlowRateElement,
+ ConfigurationSchemaIdentifiers.MeanElement);
+ constructionProperties.CriticalFlowRateStandardDeviation = CalculationConfigurationReaderHelper.GetDoubleValueFromDescendantElement(criticalFlowRateElement,
+ ConfigurationSchemaIdentifiers.StandardDeviationElement);
+ }
+
+ return new ReadGrassCoverErosionInwardsCalculation(constructionProperties);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/ReadGrassCoverErosionInwardsCalculation.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/ReadGrassCoverErosionInwardsCalculation.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Readers/ReadGrassCoverErosionInwardsCalculation.cs (revision 7a466d4ccb9d859b47f565b400808eb6933b18f0)
@@ -0,0 +1,192 @@
+// 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 Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.IO.Readers;
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Ringtoets.GrassCoverErosionInwards.IO.Readers
+{
+ ///
+ /// Class that represents a grass cover erosion inwards calculation that is read via
+ /// .
+ ///
+ public class ReadGrassCoverErosionInwardsCalculation : IReadConfigurationItem
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The container of the properties for the
+ /// .
+ /// Thrown when
+ /// is null.
+ public ReadGrassCoverErosionInwardsCalculation(ConstructionProperties constructionProperties)
+ {
+ if (constructionProperties == null)
+ {
+ throw new ArgumentNullException(nameof(constructionProperties));
+ }
+
+ Name = constructionProperties.Name;
+ HydraulicBoundaryLocation = constructionProperties.HydraulicBoundaryLocation;
+ DikeProfile = constructionProperties.DikeProfile;
+ Orientation = constructionProperties.Orientation;
+ DikeHeight = constructionProperties.DikeHeight;
+ DikeHeightCalculationType = constructionProperties.DikeHeightCalculationType;
+ UseBreakWater = constructionProperties.UseBreakWater;
+ BreakWaterType = constructionProperties.BreakWaterType;
+ BreakWaterHeight = constructionProperties.BreakWaterHeight;
+ UseForeshore = constructionProperties.UseForeshore;
+ CriticalFlowRateMean = constructionProperties.CriticalFlowRateMean;
+ CriticalFlowRateStandardDeviation = constructionProperties.CriticalFlowRateStandardDeviation;
+ }
+
+ ///
+ /// Gets the name of the hydraulic boundary location of the read grass cover erosion
+ /// inwards calculation.
+ ///
+ public string HydraulicBoundaryLocation { get; }
+
+ ///
+ /// Gets the name of the dike profile of the read grass cover erosion inwards calculation.
+ ///
+ public string DikeProfile { get; }
+
+ ///
+ /// Gets the orientation of the grass cover erosion inwards calculation.
+ ///
+ public double? Orientation { get; }
+
+ ///
+ /// Gets the dike height of the grass cover erosion inwards calculation.
+ ///
+ public double? DikeHeight { get; }
+
+ ///
+ /// Gets the value for how the dike height should be calculated for the grass cover
+ /// erosion inwards calculation.
+ ///
+ public DikeHeightCalculationType? DikeHeightCalculationType { get; }
+
+ ///
+ /// Gets the value indicating if the break water for the grass cover erosion inwards
+ /// calculation should be used.
+ ///
+ public bool? UseBreakWater { get; }
+
+ ///
+ /// Gets the type of break water for the grass cover erosion inwards calculation.
+ ///
+ public BreakWaterType? BreakWaterType { get; }
+
+ ///
+ /// Gets the height of the break water for the grass cover erosion inwards calculation.
+ ///
+ public double? BreakWaterHeight { get; }
+
+ ///
+ /// Gets the value indicating if the foreshore for the grass cover erosion inwards
+ /// calculation should be used.
+ ///
+ public bool? UseForeshore { get; }
+
+ ///
+ /// Gets the mean of the critical flow distribution for the grass cover erosion
+ /// inwards calculation.
+ ///
+ public double? CriticalFlowRateMean { get; }
+
+ ///
+ /// Gets the standard deviation of the critical flow distribution for the grass
+ /// cover erosion inwards calculation.
+ ///
+ public double? CriticalFlowRateStandardDeviation { get; }
+
+ public string Name { get; }
+
+ ///
+ /// Class holding the various construction parameters for .
+ ///
+ public class ConstructionProperties
+ {
+ ///
+ /// Gets or sets the value for .
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the value for .
+ ///
+ public string HydraulicBoundaryLocation { get; set; }
+
+ ///
+ /// Gets or sets the value for .
+ ///
+ public string DikeProfile { get; set; }
+
+ ///
+ /// Gets or sets the value for .
+ ///
+ public double? Orientation { get; set; }
+
+ ///
+ /// Gets or sets the value for .
+ ///
+ public double? DikeHeight { get; set; }
+
+ ///
+ /// Gets or sets the value for .
+ ///
+ public DikeHeightCalculationType? DikeHeightCalculationType { get; set; }
+
+ ///
+ /// Gets or sets the value for .
+ ///
+ public bool? UseBreakWater { get; set; }
+
+ ///
+ /// Gets or sets the value for .
+ ///
+ public BreakWaterType? BreakWaterType { get; set; }
+
+ ///
+ /// Gets or sets the value for .
+ ///
+ public double? BreakWaterHeight { get; set; }
+
+ ///
+ /// Gets or sets the value for .
+ ///
+ public bool? UseForeshore { get; set; }
+
+ ///
+ /// Gets or sets the value for .
+ ///
+ public double? CriticalFlowRateMean { get; set; }
+
+ ///
+ /// Gets or sets the value for .
+ ///
+ public double? CriticalFlowRateStandardDeviation { get; set; }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Resources/GEKBConfiguratieSchema.xsd
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Resources/GEKBConfiguratieSchema.xsd (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Resources/GEKBConfiguratieSchema.xsd (revision 7a466d4ccb9d859b47f565b400808eb6933b18f0)
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj
===================================================================
diff -u -r92df0a0ac0a4e0ccd5d7505d748f55167c2aac81 -r7a466d4ccb9d859b47f565b400808eb6933b18f0
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.csproj) (revision 92df0a0ac0a4e0ccd5d7505d748f55167c2aac81)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.csproj) (revision 7a466d4ccb9d859b47f565b400808eb6933b18f0)
@@ -35,20 +35,32 @@
+
Properties\GlobalAssembly.cs
+
+
+ True
+ True
+ Resources.resx
+
+
+
Copying.licenseheader
+
+ Designer
+
@@ -72,6 +84,13 @@
False
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+