Index: Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs
===================================================================
diff -u -r40a4c368130f3807f6be1e7c9a4884baf0570dbc -r2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a
--- Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision 40a4c368130f3807f6be1e7c9a4884baf0570dbc)
+++ Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (.../TestHelperTest.cs) (revision 2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a)
@@ -211,6 +211,8 @@
path = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin);
Assert.IsTrue(Directory.Exists(path));
+ path = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.GrassCoverErosionInwards.IO);
+ Assert.IsTrue(Directory.Exists(path));
path = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.GrassCoverErosionInwards.Integration);
Assert.IsTrue(Directory.Exists(path));
Index: Core/Common/test/Core.Common.TestUtil/TestDataPath.cs
===================================================================
diff -u -r27c758a14c9658eb064ec971f10611b9994d28e7 -r2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a
--- Core/Common/test/Core.Common.TestUtil/TestDataPath.cs (.../TestDataPath.cs) (revision 27c758a14c9658eb064ec971f10611b9994d28e7)
+++ Core/Common/test/Core.Common.TestUtil/TestDataPath.cs (.../TestDataPath.cs) (revision 2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a)
@@ -84,6 +84,7 @@
public static class GrassCoverErosionInwards
{
+ public static readonly TestDataPath IO = System.IO.Path.Combine("Ringtoets", "GrassCoverErosionInwards", "test", "Ringtoets.GrassCoverErosionInwards.IO.Test");
public static readonly TestDataPath Integration = System.IO.Path.Combine("Ringtoets", "GrassCoverErosionInwards", "test", "Ringtoets.GrassCoverErosionInwards.Integration.Test");
}
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Schema/ConfigurationSchemaIdentifiers.cs
===================================================================
diff -u -r3aa7e76b08eadd9497740489ed3daad5f2e13b0e -r2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a
--- Ringtoets/Common/src/Ringtoets.Common.IO/Schema/ConfigurationSchemaIdentifiers.cs (.../ConfigurationSchemaIdentifiers.cs) (revision 3aa7e76b08eadd9497740489ed3daad5f2e13b0e)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Schema/ConfigurationSchemaIdentifiers.cs (.../ConfigurationSchemaIdentifiers.cs) (revision 2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a)
@@ -70,5 +70,53 @@
/// The identifier for standard deviation elements.
///
public const string StandardDeviationElement = "standaardafwijking";
+
+ ///
+ /// The tag of elements containing the orientation of the profile.
+ ///
+ public const string Orientation = "orientatie";
+
+ ///
+ /// The tag of elements containing parameters that define wave reduction.
+ ///
+ public const string WaveReduction = "golfreductie";
+
+ ///
+ /// The tag of elements containing the value indicating whether to use break water.
+ ///
+ public const string UseBreakWater = "damgebruiken";
+
+ ///
+ /// The tag of elements containing the type of the break water.
+ ///
+ public const string BreakWaterType = "damtype";
+
+ ///
+ /// The tag of elements containing the height of the break water.
+ ///
+ public const string BreakWaterHeight = "damhoogte";
+
+ ///
+ /// The tag of elements containing the value indicating whether to use break water.
+ ///
+ public const string UseForeshore = "voorlandgebruiken";
+
+ ///
+ /// The possible content of the element indicating a
+ /// caisson type of break water.
+ ///
+ public const string BreakWaterCaisson = "caisson";
+
+ ///
+ /// The possible content of the element indicating a
+ /// dam type of break water.
+ ///
+ public const string BreakWaterDam = "havendam";
+
+ ///
+ /// The possible content of the element indicating a
+ /// wall type of break water.
+ ///
+ public const string BreakWaterWall = "verticalewand";
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Writers/CalculationConfigurationWriter.cs
===================================================================
diff -u -r0e700dc5121b8f56c96d1d552056bbe6ebe29300 -r2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a
--- Ringtoets/Common/src/Ringtoets.Common.IO/Writers/CalculationConfigurationWriter.cs (.../CalculationConfigurationWriter.cs) (revision 0e700dc5121b8f56c96d1d552056bbe6ebe29300)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Writers/CalculationConfigurationWriter.cs (.../CalculationConfigurationWriter.cs) (revision 2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a)
@@ -21,10 +21,13 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
using System.Xml;
using Core.Common.IO.Exceptions;
using Core.Common.Utils.Properties;
using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.Probabilistics;
using Ringtoets.Common.IO.Schema;
@@ -37,32 +40,6 @@
public abstract class CalculationConfigurationWriter where T : class, ICalculation
{
///
- /// Writes a single in XML format to file.
- ///
- /// The calculation to write.
- /// The writer to use for writing.
- /// Thrown when the is closed.
- protected abstract void WriteCalculation(T calculation, XmlWriter writer);
-
- ///
- /// Writes the in XML format to file.
- ///
- /// The distributions, as tuples of name and distribution, to write.
- /// The writer to use for writing.
- /// Thrown when the is closed.
- protected static void WriteDistributions(IEnumerable> distributions, XmlWriter writer)
- {
- writer.WriteStartElement(ConfigurationSchemaIdentifiers.StochastsElement);
-
- foreach (Tuple distribution in distributions)
- {
- WriteDistribution(distribution.Item2, distribution.Item1, writer);
- }
-
- writer.WriteEndElement();
- }
-
- ///
/// Writes a piping configuration to an XML file.
///
/// The root calculation group containing the piping configuration to write.
@@ -105,6 +82,62 @@
}
}
+ ///
+ /// Writes a single in XML format to file.
+ ///
+ /// The calculation to write.
+ /// The writer to use for writing.
+ /// Thrown when the is closed.
+ protected abstract void WriteCalculation(T calculation, XmlWriter writer);
+
+ ///
+ /// Writes the in XML format to file.
+ ///
+ /// The distributions, as tuples of name and distribution, to write.
+ /// The writer to use for writing.
+ /// Thrown when is null.
+ /// Thrown when the is closed.
+ protected static void WriteDistributions(IEnumerable> distributions, XmlWriter writer)
+ {
+ if (distributions == null)
+ {
+ throw new ArgumentNullException(nameof(distributions));
+ }
+
+ Tuple[] disributionArray = distributions.ToArray();
+
+ if (disributionArray.Any())
+ {
+ writer.WriteStartElement(ConfigurationSchemaIdentifiers.StochastsElement);
+
+ foreach (Tuple distribution in disributionArray)
+ {
+ WriteDistribution(distribution.Item2, distribution.Item1, writer);
+ }
+
+ writer.WriteEndElement();
+ }
+ }
+
+ ///
+ /// Writes the properties of the in XML format to file.
+ ///
+ /// The break water to write.
+ /// The writer to use for writing.
+ /// Thrown when the is closed.
+ protected static void WriteBreakWaterProperties(BreakWater breakWater, XmlWriter writer)
+ {
+ if (breakWater != null)
+ {
+ writer.WriteElementString(
+ ConfigurationSchemaIdentifiers.BreakWaterType,
+ BreakWaterTypeAsXmlString(breakWater.Type));
+ writer.WriteElementString(
+ ConfigurationSchemaIdentifiers.BreakWaterHeight,
+ XmlConvert.ToString(breakWater.Height));
+ }
+ }
+
private void WriteConfiguration(CalculationGroup calculationGroup, XmlWriter writer)
{
foreach (ICalculationBase child in calculationGroup.Children)
@@ -123,6 +156,21 @@
}
}
+ private static string BreakWaterTypeAsXmlString(BreakWaterType type)
+ {
+ switch (type)
+ {
+ case BreakWaterType.Caisson:
+ return ConfigurationSchemaIdentifiers.BreakWaterCaisson;
+ case BreakWaterType.Dam:
+ return ConfigurationSchemaIdentifiers.BreakWaterDam;
+ case BreakWaterType.Wall:
+ return ConfigurationSchemaIdentifiers.BreakWaterWall;
+ default:
+ throw new InvalidEnumArgumentException(nameof(type), (int) type, typeof(BreakWaterType));
+ }
+ }
+
private static void WriteDistribution(IDistribution distribution, string elementName, XmlWriter writer)
{
writer.WriteStartElement(ConfigurationSchemaIdentifiers.StochastElement);
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/CalculationConfigurationWriterTest.cs
===================================================================
diff -u -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526 -r2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/CalculationConfigurationWriterTest.cs (.../CalculationConfigurationWriterTest.cs) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/CalculationConfigurationWriterTest.cs (.../CalculationConfigurationWriterTest.cs) (revision 2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a)
@@ -22,13 +22,15 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Security.AccessControl;
using System.Xml;
using Core.Common.Base.Data;
using Core.Common.IO.Exceptions;
using Core.Common.TestUtil;
using NUnit.Framework;
using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.Probabilistics;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.IO.Writers;
@@ -131,14 +133,79 @@
}
[Test]
- public void WriteDistribution_Always_WritesEachDistributionAsElement()
+ public void WriteDistribution_WithoutDistributions_ArgumentNullException()
{
// Setup
string filePath = TestHelper.GetScratchPadPath("test_distributions_write.xml");
string expectedXmlFilePath = TestHelper.GetTestDataPath(
TestDataPath.Ringtoets.Common.IO,
Path.Combine(nameof(CalculationConfigurationWriter), "distributions.xml"));
+ try
+ {
+ using (XmlWriter xmlWriter = XmlWriter.Create(filePath, new XmlWriterSettings
+ {
+ Indent = true,
+ ConformanceLevel = ConformanceLevel.Fragment
+ }))
+ {
+ var writer = new SimpleCalculationConfigurationWriter();
+
+ // Call
+ Assert.Throws(() => writer.PublicWriteDistributions(null, xmlWriter));
+ }
+
+ // Assert
+ string actualXml = File.ReadAllText(filePath);
+
+ Assert.IsEmpty(actualXml);
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ [Test]
+ public void WriteDistribution_EmptyDistributions_NothingWrittenToFile()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath("test_distributions_write.xml");
+
+ try
+ {
+ using (XmlWriter xmlWriter = XmlWriter.Create(filePath, new XmlWriterSettings
+ {
+ Indent = true,
+ ConformanceLevel = ConformanceLevel.Fragment
+ }))
+ {
+ var writer = new SimpleCalculationConfigurationWriter();
+
+ // Call
+ writer.PublicWriteDistributions(Enumerable.Empty>(), xmlWriter);
+ }
+
+ // Assert
+ string actualXml = File.ReadAllText(filePath);
+
+ Assert.IsEmpty(actualXml);
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ [Test]
+ public void WriteDistribution_WithDistributions_WritesEachDistributionAsElement()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath("test_distributions_write.xml");
+ string expectedXmlFilePath = TestHelper.GetTestDataPath(
+ TestDataPath.Ringtoets.Common.IO,
+ Path.Combine(nameof(CalculationConfigurationWriter), "distributions.xml"));
+
var distributions = new List>
{
new Tuple("normal", new NormalDistribution
@@ -155,13 +222,16 @@
try
{
- using (XmlWriter writer = XmlWriter.Create(filePath, new XmlWriterSettings
+ using (XmlWriter xmlWriter = XmlWriter.Create(filePath, new XmlWriterSettings
{
- Indent = true
+ Indent = true,
+ ConformanceLevel = ConformanceLevel.Fragment
}))
{
+ var writer = new SimpleCalculationConfigurationWriter();
+
// Call
- new SimpleCalculationConfigurationWriter().PublicWriteDistributions(distributions, writer);
+ writer.PublicWriteDistributions(distributions, xmlWriter);
}
// Assert
@@ -177,6 +247,83 @@
}
[Test]
+ public void WriteBreakWaterProperties_BreakWaterNull_NothingWrittenToFile()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath(
+ $"{nameof(WriteBreakWaterProperties_WithBreakWater_WritesPropertiesToFile)}.xml");
+
+ try
+ {
+ using (XmlWriter xmlWriter = XmlWriter.Create(filePath, new XmlWriterSettings
+ {
+ Indent = true,
+ ConformanceLevel = ConformanceLevel.Fragment
+ }))
+ {
+ var writer = new SimpleCalculationConfigurationWriter();
+
+ // Call
+ writer.PublicWriteBreakWaterProperties(null, xmlWriter);
+ }
+
+ // Assert
+ string actualXml = File.ReadAllText(filePath);
+
+ Assert.IsEmpty(actualXml);
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ [Test]
+ [TestCase(BreakWaterType.Wall, 26.3, "breakWaterWall.xml")]
+ [TestCase(BreakWaterType.Caisson, 1.5, "breakWaterCaisson.xml")]
+ [TestCase(BreakWaterType.Dam, -55.1, "breakWaterDam.xml")]
+ public void WriteBreakWaterProperties_WithBreakWater_WritesPropertiesToFile(
+ BreakWaterType type,
+ double height,
+ string expectedContentFilePath)
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath(
+ $"{nameof(WriteBreakWaterProperties_WithBreakWater_WritesPropertiesToFile)}.xml");
+
+ string expectedXmlFilePath = TestHelper.GetTestDataPath(
+ TestDataPath.Ringtoets.Common.IO,
+ Path.Combine(nameof(CalculationConfigurationWriter), expectedContentFilePath));
+
+ var breakWater = new BreakWater(type, (RoundedDouble) height);
+
+ try
+ {
+ using (XmlWriter xmlWriter = XmlWriter.Create(filePath, new XmlWriterSettings
+ {
+ Indent = true,
+ ConformanceLevel = ConformanceLevel.Fragment
+ }))
+ {
+ var writer = new SimpleCalculationConfigurationWriter();
+
+ // Call
+ writer.PublicWriteBreakWaterProperties(breakWater, xmlWriter);
+ }
+
+ // Assert
+ string actualXml = File.ReadAllText(filePath);
+ string expectedXml = File.ReadAllText(expectedXmlFilePath);
+
+ Assert.AreEqual(expectedXml, actualXml);
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ [Test]
[TestCaseSource(nameof(CalculationConfigurations))]
public void Write_DifferentCalculationAndCalculationGroupConfigurations_ValidFile(CalculationGroup rootGroup, string expectedFileContentsFileName)
{
@@ -218,6 +365,11 @@
{
WriteDistributions(distributions, writer);
}
+
+ public void PublicWriteBreakWaterProperties(BreakWater breakWater, XmlWriter writer)
+ {
+ WriteBreakWaterProperties(breakWater, writer);
+ }
}
private static IEnumerable CalculationConfigurations()
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/breakWaterCaisson.xml
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/breakWaterCaisson.xml (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/breakWaterCaisson.xml (revision 2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a)
@@ -0,0 +1,2 @@
+caisson
+1.5
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/breakWaterDam.xml
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/breakWaterDam.xml (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/breakWaterDam.xml (revision 2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a)
@@ -0,0 +1,2 @@
+havendam
+-55.1
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/breakWaterWall.xml
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/breakWaterWall.xml (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/breakWaterWall.xml (revision 2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a)
@@ -0,0 +1,2 @@
+verticalewand
+26.3
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/distributions.xml
===================================================================
diff -u -r08b12333ce2b0a269716e677a7036c5bed0d129c -r2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/distributions.xml (.../distributions.xml) (revision 08b12333ce2b0a269716e677a7036c5bed0d129c)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationWriter/distributions.xml (.../distributions.xml) (revision 2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a)
@@ -1,5 +1,4 @@
-
-
+0.20.1
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsConfigurationExporter.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsConfigurationExporter.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsConfigurationExporter.cs (revision 2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a)
@@ -0,0 +1,46 @@
+// 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.Calculation;
+using Ringtoets.Common.IO.Exporters;
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Ringtoets.GrassCoverErosionInwards.IO
+{
+ ///
+ /// Exports a grass cover erosion inwards configuration and stores it as an XML file.
+ ///
+ public class GrassCoverErosionInwardsConfigurationExporter
+ : ConfigurationExporter
+ {
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The calculation group to export.
+ /// The path of the XML file to export to.
+ /// Thrown when is null.
+ /// Thrown when is invalid.
+ public GrassCoverErosionInwardsConfigurationExporter(CalculationGroup calculationGroup, string filePath)
+ : base(calculationGroup, filePath) { }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsConfigurationSchemaIdentifiers.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsConfigurationSchemaIdentifiers.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsConfigurationSchemaIdentifiers.cs (revision 2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a)
@@ -0,0 +1,39 @@
+// 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.
+
+namespace Ringtoets.GrassCoverErosionInwards.IO
+{
+ ///
+ /// Container of identifiers related to the grass cover erosion inwards configuration schema definition.
+ ///
+ internal static class GrassCoverErosionInwardsConfigurationSchemaIdentifiers
+ {
+ ///
+ /// The tag of elements containing the name of the dike profile.
+ ///
+ public const string HydraulicBoundaryLocationElement = "dijkprofiel";
+
+ ///
+ /// The name for the critical flow rate stochast.
+ ///
+ public static string CriticalFlowRateStochastName = "overslagdebiet";
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsConfigurationWriter.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsConfigurationWriter.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsConfigurationWriter.cs (revision 2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a)
@@ -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.Collections.Generic;
+using System.Xml;
+using Ringtoets.Common.Data.Probabilistics;
+using Ringtoets.Common.IO.Schema;
+using Ringtoets.Common.IO.Writers;
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Ringtoets.GrassCoverErosionInwards.IO
+{
+ ///
+ /// Writer for writing a piping configuration to XML.
+ ///
+ public class GrassCoverErosionInwardsConfigurationWriter : CalculationConfigurationWriter {
+
+ protected override void WriteCalculation(GrassCoverErosionInwardsCalculation calculation, XmlWriter writer)
+ {
+ writer.WriteStartElement(ConfigurationSchemaIdentifiers.CalculationElement);
+ writer.WriteAttributeString(ConfigurationSchemaIdentifiers.NameAttribute, calculation.Name);
+
+ GrassCoverErosionInwardsInput input = calculation.InputParameters;
+
+ if (input.HydraulicBoundaryLocation != null)
+ {
+ writer.WriteElementString(ConfigurationSchemaIdentifiers.HydraulicBoundaryLocationElement,
+ input.HydraulicBoundaryLocation.Name);
+ }
+ if (input.DikeProfile != null)
+ {
+ writer.WriteElementString(GrassCoverErosionInwardsConfigurationSchemaIdentifiers.HydraulicBoundaryLocationElement,
+ input.DikeProfile.Name);
+ }
+
+ writer.WriteElementString(
+ ConfigurationSchemaIdentifiers.Orientation,
+ XmlConvert.ToString(input.Orientation));
+
+ WriteWaveReduction(input, writer);
+
+ WriteDistributions(CreateInputDistributions(input), writer);
+
+ writer.WriteEndElement();
+ }
+
+ private static IEnumerable> CreateInputDistributions(GrassCoverErosionInwardsInput calculationInputParameters)
+ {
+ yield return Tuple.Create(
+ GrassCoverErosionInwardsConfigurationSchemaIdentifiers.CriticalFlowRateStochastName,
+ calculationInputParameters.CriticalFlowRate);
+ }
+
+ private static void WriteWaveReduction(GrassCoverErosionInwardsInput input, XmlWriter writer)
+ {
+ writer.WriteStartElement(ConfigurationSchemaIdentifiers.WaveReduction);
+
+ writer.WriteElementString(
+ ConfigurationSchemaIdentifiers.UseBreakWater,
+ XmlConvert.ToString(input.UseBreakWater));
+
+ WriteBreakWaterProperties(input.BreakWater, writer);
+
+ writer.WriteElementString(
+ ConfigurationSchemaIdentifiers.UseForeshore,
+ XmlConvert.ToString(input.UseForeshore));
+
+ writer.WriteEndElement();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj
===================================================================
diff -u -r1b12d6bcd79e88a65efa3ec7c60999a4bd44caca -r2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.csproj) (revision 1b12d6bcd79e88a65efa3ec7c60999a4bd44caca)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.csproj) (revision 2923096aeb41e1fb5d4ba0ad43ccb9f95ca7407a)
@@ -34,18 +34,44 @@
+
Properties\GlobalAssembly.cs
+
+
+
Copying.licenseheader
+
+
+ {3BBFD65B-B277-4E50-AE6D-BD24C3434609}
+ Core.Common.Base
+ False
+
+
+ {D4200F43-3F72-4F42-AF0A-8CED416A38EC}
+ Ringtoets.Common.Data
+ False
+
+
+ {52BA7627-CBAB-4209-BE77-3B5F31378277}
+ Ringtoets.Common.IO
+ False
+
+
+ {90DE728E-48EF-4665-AB38-3D88E41D9F4D}
+ Ringtoets.GrassCoverErosionInwards.Data
+ False
+
+