Index: DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io.Tests/IoDamMStabDocSeriliazerTests.cs =================================================================== diff -u -r3138 -r3141 --- DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io.Tests/IoDamMStabDocSeriliazerTests.cs (.../IoDamMStabDocSeriliazerTests.cs) (revision 3138) +++ DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io.Tests/IoDamMStabDocSeriliazerTests.cs (.../IoDamMStabDocSeriliazerTests.cs) (revision 3141) @@ -55,6 +55,9 @@ private IoMStabDamDoc CreateMStabDamDocExample() { var ioMStabDamDoc = new IoMStabDamDoc(); + const double xLeftBoundary = 1.0; + const double xRightBoundary = 15.00; + const double yDeep = -100.0; // Geometry Creation Options ioMStabDamDoc.MStabInput.GeometryCreationOptions.MaterialForDike = "DikeMaterial"; @@ -72,7 +75,7 @@ // SurfaceLine ioMStabDamDoc.MStabInput.SurfaceLine.Add(new IoGeometryPoint() { - X = 1.0, + X = xLeftBoundary, Y = 1.5 }); ioMStabDamDoc.MStabInput.SurfaceLine.Add(new IoGeometryPoint() @@ -107,14 +110,14 @@ }); ioMStabDamDoc.MStabInput.SurfaceLine.Add(new IoGeometryPoint() { - X = 15.0, + X = xRightBoundary, Y = 0.5 }); // Characteristic Points ioMStabDamDoc.MStabInput.CharacteristicPoints.Add(new IoCharacteristicPoint() { - X = 1.0, + X = xLeftBoundary, Y = 1.5, CharacteristicPointType = CharacteristicPointType.SurfaceLevelOutside }); @@ -144,11 +147,67 @@ }); ioMStabDamDoc.MStabInput.CharacteristicPoints.Add(new IoCharacteristicPoint() { - X = 15.0, + X = xRightBoundary, Y = 0.5, CharacteristicPointType = CharacteristicPointType.SurfaceLevelInside }); + // PL-Lines + var pl1 = new IoPlLine(); + pl1.IsPhreatic = true; + pl1.BoundaryLayer = 1; + pl1.Points.Add(new IoGeometryPoint() + { + X = xLeftBoundary, + Y = -1.0 + }); + pl1.Points.Add(new IoGeometryPoint() + { + X = 0.5 * (xRightBoundary + xLeftBoundary), + Y = -2.0 + }); + pl1.Points.Add(new IoGeometryPoint() + { + X = xRightBoundary, + Y = -1.5 + }); + ioMStabDamDoc.MStabInput.ExternalPlLines.Add(pl1); + + var pl2 = new IoPlLine(); + pl2.IsPhreatic = false; + pl2.BoundaryLayer = 2; + pl2.Points.Add(new IoGeometryPoint() + { + X = xLeftBoundary, + Y = yDeep + }); + pl1.Points.Add(new IoGeometryPoint() + { + X = xRightBoundary, + Y = yDeep + }); + ioMStabDamDoc.MStabInput.ExternalPlLines.Add(pl2); + + var pl3 = new IoPlLine(); + pl3.IsPhreatic = false; + pl3.BoundaryLayer = 1; + pl3.Points.Add(new IoGeometryPoint() + { + X = xLeftBoundary, + Y = yDeep + }); + pl1.Points.Add(new IoGeometryPoint() + { + X = xRightBoundary, + Y = yDeep + }); + ioMStabDamDoc.MStabInput.ExternalPlLines.Add(pl3); + + var pl4 = new IoPlLine(); + pl4.IsPhreatic = false; + pl4.BoundaryLayer = 0; + ioMStabDamDoc.MStabInput.ExternalPlLines.Add(pl4); + return ioMStabDamDoc; } } Index: DamTools/LayerOnSlopeTool/trunk/xsd/DamMStabDefinitions.xsd =================================================================== diff -u -r3136 -r3141 --- DamTools/LayerOnSlopeTool/trunk/xsd/DamMStabDefinitions.xsd (.../DamMStabDefinitions.xsd) (revision 3136) +++ DamTools/LayerOnSlopeTool/trunk/xsd/DamMStabDefinitions.xsd (.../DamMStabDefinitions.xsd) (revision 3141) @@ -34,13 +34,13 @@ - - + + - - + + Index: DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io/FillXmlDamMStabDocFromIo.cs =================================================================== diff -u -r3138 -r3141 --- DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io/FillXmlDamMStabDocFromIo.cs (.../FillXmlDamMStabDocFromIo.cs) (revision 3138) +++ DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io/FillXmlDamMStabDocFromIo.cs (.../FillXmlDamMStabDocFromIo.cs) (revision 3141) @@ -20,36 +20,61 @@ // All rights reserved. using System.Collections.Generic; +using System.Data; namespace Deltares.LayerOnSlopeTool.Io { /// Class for transferring Io data to Xml data public static class FillXmlDamMStabDocFromIo { /// Fills the XML dam m stab document. - /// The io dam m stab dam document. + /// The io dam m stab dam document. /// - public static tnsPrefixDamMStabDoc FillXmlDamMStabDoc(IoMStabDamDoc ioDamMStabDamDoc) + public static tnsPrefixDamMStabDoc FillXmlDamMStabDoc(IoMStabDamDoc ioMStabDamDoc) { var xmlDamMStabDoc = new tnsPrefixDamMStabDoc(); xmlDamMStabDoc.tnsPrefixDamMStabInput = new tnsPrefixDamMStabDocTnsPrefixDamMStabInput(); xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixGeometryCreationOptions = new tnsbPrefixGeometryCreationOptions(); - TransferGeometryCreationOptions(ioDamMStabDamDoc.MStabInput.GeometryCreationOptions, xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixGeometryCreationOptions); + TransferGeometryCreationOptions(ioMStabDamDoc.MStabInput.GeometryCreationOptions, xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixGeometryCreationOptions); xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixModel = new tnsbPrefixModel(); - TransferModel(ioDamMStabDamDoc.MStabInput.Model, xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixModel); + TransferModel(ioMStabDamDoc.MStabInput.Model, xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixModel); - xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixSurfaceLine = new tnsbPrefixSurfaceLineTnsbPrefixSurfacePoint[ioDamMStabDamDoc.MStabInput.SurfaceLine.Count]; - TransferSurfaceline(ioDamMStabDamDoc.MStabInput.SurfaceLine, xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixSurfaceLine); + xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixSurfaceLine = new tnsbPrefixSurfaceLineTnsbPrefixSurfacePoint[ioMStabDamDoc.MStabInput.SurfaceLine.Count]; + TransferSurfaceline(ioMStabDamDoc.MStabInput.SurfaceLine, xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixSurfaceLine); xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixCharacteristicPoints = - new tnsbPrefixCharacteristicPointsTnsbPrefixCharacteristicPoint[ioDamMStabDamDoc.MStabInput.CharacteristicPoints.Count]; - TransferCharacteristicPoints(ioDamMStabDamDoc.MStabInput.CharacteristicPoints, xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixCharacteristicPoints); + new tnsbPrefixCharacteristicPointsTnsbPrefixCharacteristicPoint[ioMStabDamDoc.MStabInput.CharacteristicPoints.Count]; + TransferCharacteristicPoints(ioMStabDamDoc.MStabInput.CharacteristicPoints, xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixCharacteristicPoints); + xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixExternalPLLines = + new tnsbPrefixExternalPLLinesTnsbPrefixPLLine[ioMStabDamDoc.MStabInput.ExternalPlLines.Count]; + TransferPlLines(ioMStabDamDoc.MStabInput.ExternalPlLines, xmlDamMStabDoc.tnsPrefixDamMStabInput.tnsbPrefixExternalPLLines); + return xmlDamMStabDoc; } + private static void TransferPlLines(List ioPlLines, tnsbPrefixExternalPLLinesTnsbPrefixPLLine[] xmlPlLines) + { + for (int plLineIndex = 0; plLineIndex < ioPlLines.Count; plLineIndex++) + { + xmlPlLines[plLineIndex] = new tnsbPrefixExternalPLLinesTnsbPrefixPLLine(); + var ioPlLine = ioPlLines[plLineIndex]; + xmlPlLines[plLineIndex].BoundaryLayer = ioPlLine.BoundaryLayer; + xmlPlLines[plLineIndex].IsPhreatic = ioPlLine.IsPhreatic; + xmlPlLines[plLineIndex].tnsbPrefixPLPoint = new tnsbPrefixExternalPLLinesTnsbPrefixPLLineTnsbPrefixPLPoint[ioPlLine.Points.Count]; + for (int pointIndex = 0; pointIndex < ioPlLine.Points.Count; pointIndex++) + { + xmlPlLines[plLineIndex].tnsbPrefixPLPoint[pointIndex] = new tnsbPrefixExternalPLLinesTnsbPrefixPLLineTnsbPrefixPLPoint() + { + XCoord = ioPlLine.Points[pointIndex].X, + YCoord = ioPlLine.Points[pointIndex].Y + }; + } + } + } + private static void TransferCharacteristicPoints(List ioCharacteristicPoints, tnsbPrefixCharacteristicPointsTnsbPrefixCharacteristicPoint[] xmlCharacteristicPoints) { Index: DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io/FillIoDamMStabDocFromXml.cs =================================================================== diff -u -r3138 -r3141 --- DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io/FillIoDamMStabDocFromXml.cs (.../FillIoDamMStabDocFromXml.cs) (revision 3138) +++ DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io/FillIoDamMStabDocFromXml.cs (.../FillIoDamMStabDocFromXml.cs) (revision 3141) @@ -27,18 +27,43 @@ public static class FillIoDamMStabDocFromXml { /// Fills the io dam m stab document. - /// The XML dam m stab dam document. + /// The XML dam m stab dam document. /// - public static IoMStabDamDoc FillIoDamMStabDoc(tnsPrefixDamMStabDoc xmlDamMStabDamDoc) + public static IoMStabDamDoc FillIoDamMStabDoc(tnsPrefixDamMStabDoc xmlMStabDamDoc) { var ioMStabDamDoc = new IoMStabDamDoc(); - TransferGeometryCreationOptions(xmlDamMStabDamDoc.tnsPrefixDamMStabInput.tnsbPrefixGeometryCreationOptions, ioMStabDamDoc.MStabInput.GeometryCreationOptions); - TransferModel(xmlDamMStabDamDoc.tnsPrefixDamMStabInput.tnsbPrefixModel, ioMStabDamDoc.MStabInput.Model); - TransferSurfaceLine(xmlDamMStabDamDoc.tnsPrefixDamMStabInput.tnsbPrefixSurfaceLine, ioMStabDamDoc.MStabInput.SurfaceLine); - TransferCharacteristicPoints(xmlDamMStabDamDoc.tnsPrefixDamMStabInput.tnsbPrefixCharacteristicPoints, ioMStabDamDoc.MStabInput.CharacteristicPoints); + TransferGeometryCreationOptions(xmlMStabDamDoc.tnsPrefixDamMStabInput.tnsbPrefixGeometryCreationOptions, ioMStabDamDoc.MStabInput.GeometryCreationOptions); + TransferModel(xmlMStabDamDoc.tnsPrefixDamMStabInput.tnsbPrefixModel, ioMStabDamDoc.MStabInput.Model); + TransferSurfaceLine(xmlMStabDamDoc.tnsPrefixDamMStabInput.tnsbPrefixSurfaceLine, ioMStabDamDoc.MStabInput.SurfaceLine); + TransferCharacteristicPoints(xmlMStabDamDoc.tnsPrefixDamMStabInput.tnsbPrefixCharacteristicPoints, ioMStabDamDoc.MStabInput.CharacteristicPoints); + TransferPlLines(xmlMStabDamDoc.tnsPrefixDamMStabInput.tnsbPrefixExternalPLLines, ioMStabDamDoc.MStabInput.ExternalPlLines); return ioMStabDamDoc; } + private static void TransferPlLines(tnsbPrefixExternalPLLinesTnsbPrefixPLLine[] xmlPlLines, List ioPlLines) + { + for (int plLineIndex = 0; plLineIndex < xmlPlLines.Length; plLineIndex++) + { + var xmlPlLine = xmlPlLines[plLineIndex]; + ioPlLines.Add(new IoPlLine() + { + IsPhreatic = xmlPlLine.IsPhreatic, + BoundaryLayer = xmlPlLine.BoundaryLayer + }); + if (xmlPlLine.tnsbPrefixPLPoint != null) + { + for (int pointIndex = 0; pointIndex < xmlPlLine.tnsbPrefixPLPoint.Length; pointIndex++) + { + ioPlLines[plLineIndex].Points.Add(new IoGeometryPoint() + { + X = xmlPlLine.tnsbPrefixPLPoint[pointIndex].XCoord, + Y = xmlPlLine.tnsbPrefixPLPoint[pointIndex].YCoord + }); + } + } + } + } + private static void TransferCharacteristicPoints(tnsbPrefixCharacteristicPointsTnsbPrefixCharacteristicPoint[] xmlCharacteristicPoints, List ioCharacteristicPoints) { Index: DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io/DamMStabDoc.cs =================================================================== diff -u -r3136 -r3141 --- DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io/DamMStabDoc.cs (.../DamMStabDoc.cs) (revision 3136) +++ DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io/DamMStabDoc.cs (.../DamMStabDoc.cs) (revision 3141) @@ -206,10 +206,8 @@ private bool isPhreaticField; - private bool isPhreaticFieldSpecified; + private int boundaryLayerField; - private string boundaryLayerField; - /// [System.Xml.Serialization.XmlElementAttribute("tnsbPrefixPLPoint")] public tnsbPrefixExternalPLLinesTnsbPrefixPLLineTnsbPrefixPLPoint[] tnsbPrefixPLPoint { @@ -233,20 +231,9 @@ } /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - public bool IsPhreaticSpecified { + [System.Xml.Serialization.XmlAttributeAttribute()] + public int BoundaryLayer { get { - return this.isPhreaticFieldSpecified; - } - set { - this.isPhreaticFieldSpecified = value; - } - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute(DataType="integer")] - public string BoundaryLayer { - get { return this.boundaryLayerField; } set { @@ -265,12 +252,8 @@ private double xCoordField; - private bool xCoordFieldSpecified; - private double yCoordField; - private bool yCoordFieldSpecified; - /// [System.Xml.Serialization.XmlAttributeAttribute()] public double XCoord { @@ -283,17 +266,6 @@ } /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - public bool XCoordSpecified { - get { - return this.xCoordFieldSpecified; - } - set { - this.xCoordFieldSpecified = value; - } - } - - /// [System.Xml.Serialization.XmlAttributeAttribute()] public double YCoord { get { @@ -303,17 +275,6 @@ this.yCoordField = value; } } - - /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - public bool YCoordSpecified { - get { - return this.yCoordFieldSpecified; - } - set { - this.yCoordFieldSpecified = value; - } - } } /// Index: DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io/IoPlLine.cs =================================================================== diff -u -r3117 -r3141 --- DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io/IoPlLine.cs (.../IoPlLine.cs) (revision 3117) +++ DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.Io/IoPlLine.cs (.../IoPlLine.cs) (revision 3141) @@ -19,10 +19,25 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Collections.Generic; + namespace Deltares.LayerOnSlopeTool.Io { + /// PL-line type public class IoPlLine { - + /// Gets or sets a value indicating whether this instance is the phreatic line. + /// + /// true if this instance is the phreatic line; otherwise, false. + public bool IsPhreatic { get; set; } + + /// Gets or sets the index of the boundary layer. + /// The index of the boundary layer. + public int BoundaryLayer { get; set; } + + /// Gets the points. + /// The points. + public List Points { get; } = new List(); + } } \ No newline at end of file