Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableLine.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableLine.cs (revision 0)
+++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableLine.cs (revision e382cd31f8112438e24bd25ff1c429cf8b5fba4d)
@@ -0,0 +1,61 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Xml.Serialization;
+using Core.Common.Base.Geometry;
+
+namespace Ringtoets.AssemblyTool.IO.Model
+{
+ ///
+ /// Class that describes a serializable GML line.
+ ///
+ public class SerializableLine
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ public SerializableLine() {}
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The geometry of the line.
+ /// Thrown when
+ /// is null.
+ public SerializableLine(IEnumerable geometry)
+ {
+ if (geometry == null)
+ {
+ throw new ArgumentNullException(nameof(geometry));
+ }
+
+ LineString = new SerializableLineString(geometry);
+ }
+
+ ///
+ /// Gets or sets the line string containing the geometry of the line.
+ ///
+ [XmlElement(AssemblyXmlIdentifiers.LineString, Namespace = AssemblyXmlIdentifiers.GmlNamespace)]
+ public SerializableLineString LineString { get; set; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableLineString.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableLineString.cs (revision 0)
+++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Model/SerializableLineString.cs (revision e382cd31f8112438e24bd25ff1c429cf8b5fba4d)
@@ -0,0 +1,73 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Xml.Serialization;
+using Core.Common.Base.Geometry;
+using Ringtoets.AssemblyTool.IO.Properties;
+
+namespace Ringtoets.AssemblyTool.IO.Model
+{
+ ///
+ /// Class describing a serializable line string.
+ ///
+ public class SerializableLineString
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ public SerializableLineString()
+ {
+ CoordinateSystem = Resources.SrsName;
+ }
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The geometry of the line.
+ /// Thrown when
+ /// is null.
+ public SerializableLineString(IEnumerable geometry) : this()
+ {
+ if (geometry == null)
+ {
+ throw new ArgumentNullException(nameof(geometry));
+ }
+
+ Geometry = geometry.Select(c => c.X + " " + c.Y).Aggregate((c1, c2) => c1 + " " + c2);
+ }
+
+ ///
+ /// Gets or sets the name of the coordinate system this line is projected on.
+ ///
+ [XmlAttribute(AssemblyXmlIdentifiers.CoordinateSystem)]
+ public string CoordinateSystem { get; set; }
+
+ ///
+ /// Gets or sets the list of coordinates representing the
+ /// geometry of the line.
+ ///
+ [XmlElement(AssemblyXmlIdentifiers.Geometry)]
+ public string Geometry { get; set; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Properties/Resources.Designer.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Properties/Resources.Designer.cs (revision 0)
+++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Properties/Resources.Designer.cs (revision e382cd31f8112438e24bd25ff1c429cf8b5fba4d)
@@ -0,0 +1,102 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Ringtoets.AssemblyTool.IO.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ringtoets.AssemblyTool.IO.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Dijktraject.
+ ///
+ internal static string AssessmentSectionType {
+ get {
+ return ResourceManager.GetString("AssessmentSectionType", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to EPSG:28992.
+ ///
+ internal static string SrsName {
+ get {
+ return ResourceManager.GetString("SrsName", resourceCulture);
+ }
+ }
+ }
+}
Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Properties/Resources.resx
===================================================================
diff -u
--- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Properties/Resources.resx (revision 0)
+++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Properties/Resources.resx (revision e382cd31f8112438e24bd25ff1c429cf8b5fba4d)
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Dijktraject
+
+
+ EPSG:28992
+
+
\ No newline at end of file
Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj
===================================================================
diff -u -r460f9df20ddc6cb2ef731fad1b67dab412988761 -re382cd31f8112438e24bd25ff1c429cf8b5fba4d
--- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj (.../Ringtoets.AssemblyTool.IO.csproj) (revision 460f9df20ddc6cb2ef731fad1b67dab412988761)
+++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.IO/Ringtoets.AssemblyTool.IO.csproj (.../Ringtoets.AssemblyTool.IO.csproj) (revision e382cd31f8112438e24bd25ff1c429cf8b5fba4d)
@@ -28,6 +28,11 @@
+
+ True
+ True
+ Resources.resx
+
@@ -36,4 +41,11 @@
False
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableLineStringTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableLineStringTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableLineStringTest.cs (revision e382cd31f8112438e24bd25ff1c429cf8b5fba4d)
@@ -0,0 +1,81 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.IO.Model;
+using Ringtoets.AssemblyTool.IO.TestUtil;
+
+namespace Ringtoets.AssemblyTool.IO.Test.Model
+{
+ [TestFixture]
+ public class SerializableLineStringTest
+ {
+ [Test]
+ public void DefaultConstructor_ReturnsDefaultValues()
+ {
+ // Call
+ var lineString = new SerializableLineString();
+
+ // Assert
+ Assert.AreEqual("EPSG:28992", lineString.CoordinateSystem);
+ Assert.IsNull(lineString.Geometry);
+
+ SerializableAttributeTestHelper.AssertXmlAttributeAttribute(
+ nameof(SerializableLineString.CoordinateSystem), "srsName");
+
+ SerializableAttributeTestHelper.AssertXmlElementAttribute(
+ nameof(SerializableLineString.Geometry), "posList");
+ }
+
+ [Test]
+ public void Constructor_GeometryNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new SerializableLineString(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("geometry", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_WithValidData_ReturnsExpectedValues()
+ {
+ // Setup
+ var random = new Random(39);
+ var geometry = new[]
+ {
+ new Point2D(random.NextDouble(), random.NextDouble()),
+ new Point2D(random.NextDouble(), random.NextDouble())
+ };
+
+ // Call
+ var lineString = new SerializableLineString(geometry);
+
+ // Assert
+ Assert.AreEqual("EPSG:28992", lineString.CoordinateSystem);
+ Assert.AreEqual(geometry.Select(c => c.X + " " + c.Y).Aggregate((c1, c2) => c1 + " " + c2), lineString.Geometry);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableLineTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableLineTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Model/SerializableLineTest.cs (revision e382cd31f8112438e24bd25ff1c429cf8b5fba4d)
@@ -0,0 +1,76 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Linq;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.IO.Model;
+using Ringtoets.AssemblyTool.IO.TestUtil;
+
+namespace Ringtoets.AssemblyTool.IO.Test.Model
+{
+ [TestFixture]
+ public class SerializableLineTest
+ {
+ [Test]
+ public void DefaultConstructor_ReturnsDefaultValues()
+ {
+ // Call
+ var line = new SerializableLine();
+
+ // Assert
+ Assert.IsNull(line.LineString);
+
+ SerializableAttributeTestHelper.AssertXmlElementAttribute(
+ nameof(SerializableLine.LineString), "LineString", "http://www.opengis.net/gml/3.2");
+ }
+
+ [Test]
+ public void Constructor_GeometryNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new SerializableLine(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("geometry", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_WithValidData_ReturnsExpectedValues()
+ {
+ // Setup
+ var random = new Random(39);
+ var geometry = new[]
+ {
+ new Point2D(random.NextDouble(), random.NextDouble()),
+ new Point2D(random.NextDouble(), random.NextDouble())
+ };
+
+ // Call
+ var line = new SerializableLine(geometry);
+
+ // Assert
+ Assert.AreEqual(geometry.Select(c => c.X + " " + c.Y).Aggregate((c1, c2) => c1 + " " + c2), line.LineString.Geometry);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj
===================================================================
diff -u -r460f9df20ddc6cb2ef731fad1b67dab412988761 -re382cd31f8112438e24bd25ff1c429cf8b5fba4d
--- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj (.../Ringtoets.AssemblyTool.IO.Test.csproj) (revision 460f9df20ddc6cb2ef731fad1b67dab412988761)
+++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.Test/Ringtoets.AssemblyTool.IO.Test.csproj (.../Ringtoets.AssemblyTool.IO.Test.csproj) (revision e382cd31f8112438e24bd25ff1c429cf8b5fba4d)
@@ -15,6 +15,8 @@
+
+