Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj
===================================================================
diff -u -r498145f32a037111ff2b09fd5076b5d5ec97288b -r3f73936da98ec936963df7f4487cb152371a40f5
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 498145f32a037111ff2b09fd5076b5d5ec97288b)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 3f73936da98ec936963df7f4487cb152371a40f5)
@@ -150,12 +150,14 @@
WaveHeightLocationsView.cs
+
UserControl
WmtsLocationControl.cs
+
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsCapability.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsCapability.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsCapability.cs (revision 3f73936da98ec936963df7f4487cb152371a40f5)
@@ -0,0 +1,103 @@
+// 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 Core.Components.Gis.Data;
+
+namespace Ringtoets.Integration.Forms.Views
+{
+ ///
+ /// Class representing a capability coming from a Web Map Tile Service (WMTS).
+ ///
+ public class WmtsCapability
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The id of the WMTS capability.
+ /// The type of image format of the WMTS capability.
+ /// The title of the WMTS capability.
+ /// The coordinate system of the WMTS capability.
+ /// Thrown when any of the input parameters is null.
+ /// Thrown when is not stated as a MIME-type.
+ public WmtsCapability(string id, string format, string title, string coordinateSystem)
+ {
+ if (id == null)
+ {
+ throw new ArgumentNullException(nameof(id));
+ }
+ if (format == null)
+ {
+ throw new ArgumentNullException(nameof(format));
+ }
+ if (title == null)
+ {
+ throw new ArgumentNullException(nameof(title));
+ }
+ if (coordinateSystem == null)
+ {
+ throw new ArgumentNullException(nameof(coordinateSystem));
+ }
+ if (!format.StartsWith("image/"))
+ {
+ throw new ArgumentException(@"Specified image format is not a MIME type.", nameof(format));
+ }
+
+ Id = id;
+ Format = format;
+ Title = title;
+ CoordinateSystem = coordinateSystem;
+ }
+
+ ///
+ /// Gets the id of the WMTS capability.
+ ///
+ public string Id { get;}
+
+ ///
+ /// Gets the image format of the WMTS capability.
+ ///
+ public string Format { get; }
+
+ ///
+ /// Gets the title of the WMTS capability.
+ ///
+ public string Title { get; }
+
+ ///
+ /// Gets the coordinate system of the WMTS capability.
+ ///
+ public string CoordinateSystem { get; }
+
+ ///
+ /// Creates a new instance of based upon the local properties.
+ ///
+ /// The name of the source (for visualization purposes only).
+ /// The URL to the capabilities of the WMTS.
+ /// The newly created .
+ /// Thrown when
+ /// or is null.
+ public WmtsMapData ToWmtsMapdata(string displayName, string sourceCapabilitiesUrl)
+ {
+ return new WmtsMapData(displayName, sourceCapabilitiesUrl, Id, Format);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsCapabilityRow.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsCapabilityRow.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/WmtsCapabilityRow.cs (revision 3f73936da98ec936963df7f4487cb152371a40f5)
@@ -0,0 +1,92 @@
+// 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;
+
+namespace Ringtoets.Integration.Forms.Views
+{
+ ///
+ /// Class for displaying a as a row in a grid view.
+ ///
+ public class WmtsCapabilityRow
+ {
+ private readonly WmtsCapability wmtsCapability;
+
+ ///
+ /// Creates new instance of .
+ ///
+ /// The to wrap
+ /// so that it can be displayed as a row.
+ /// Thrown when is null.
+ public WmtsCapabilityRow(WmtsCapability wmtsCapability)
+ {
+ if (wmtsCapability == null)
+ {
+ throw new ArgumentNullException(nameof(wmtsCapability));
+ }
+ this.wmtsCapability = wmtsCapability;
+ }
+
+ ///
+ /// Gets the id of the .
+ ///
+ public string Id
+ {
+ get
+ {
+ return wmtsCapability.Id;
+ }
+ }
+
+ ///
+ /// Gets the image format of the .
+ ///
+ public string Format
+ {
+ get
+ {
+ return wmtsCapability.Format;
+ }
+ }
+
+ ///
+ /// Gets the title of the .
+ ///
+ public string Title
+ {
+ get
+ {
+ return wmtsCapability.Title;
+ }
+ }
+
+ ///
+ /// Gets the coordinate system of the .
+ ///
+ public string CoordinateSystem
+ {
+ get
+ {
+ return wmtsCapability.CoordinateSystem;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj
===================================================================
diff -u -r498145f32a037111ff2b09fd5076b5d5ec97288b -r3f73936da98ec936963df7f4487cb152371a40f5
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 498145f32a037111ff2b09fd5076b5d5ec97288b)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 3f73936da98ec936963df7f4487cb152371a40f5)
@@ -116,7 +116,9 @@
+
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WmtsCapabilityRowTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WmtsCapabilityRowTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WmtsCapabilityRowTest.cs (revision 3f73936da98ec936963df7f4487cb152371a40f5)
@@ -0,0 +1,62 @@
+// 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 NUnit.Framework;
+using Ringtoets.Integration.Forms.Views;
+
+namespace Ringtoets.Integration.Forms.Test.Views
+{
+ [TestFixture]
+ public class WmtsCapabilityRowTest
+ {
+ [Test]
+ public void Constructor_WmtsCapabilityNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new WmtsCapabilityRow(null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("wmtsCapability", paramName);
+ }
+
+ [Test]
+ public void Constructor_ValidWmtsCapability_ExpectedProperties()
+ {
+ // Setup
+ const string id = "laag1(abc)";
+ const string format = "image/png";
+ const string title = "Eerste kaartlaag";
+ const string coordinateSystem = "Coördinatenstelsel";
+ var wmtsCapability = new WmtsCapability(id, format, title, coordinateSystem);
+
+ // Call
+ var row = new WmtsCapabilityRow(wmtsCapability);
+
+ // Assert
+ Assert.AreEqual(id, row.Id);
+ Assert.AreEqual(format, row.Format);
+ Assert.AreEqual(title, row.Title);
+ Assert.AreEqual(coordinateSystem, row.CoordinateSystem);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WmtsCapabilityTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WmtsCapabilityTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/WmtsCapabilityTest.cs (revision 3f73936da98ec936963df7f4487cb152371a40f5)
@@ -0,0 +1,185 @@
+// 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 Core.Common.TestUtil;
+using Core.Components.Gis.Data;
+using NUnit.Framework;
+using Ringtoets.Integration.Forms.Views;
+
+namespace Ringtoets.Integration.Forms.Test.Views
+{
+ public class WmtsCapabilityTest
+ {
+ [Test]
+ public void Constructor_IdNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ const string format = "image/png";
+ const string title = "Eerste kaartlaag";
+ const string coordinateSystem = "Coördinatenstelsel";
+
+ // Call
+ TestDelegate call = () => new WmtsCapability(null, format, title, coordinateSystem);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("id", paramName);
+ }
+
+ [Test]
+ public void Constructor_FormatNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ const string id = "laag1(abc)";
+ const string title = "Eerste kaartlaag";
+ const string coordinateSystem = "Coördinatenstelsel";
+
+ // Call
+ TestDelegate call = () => new WmtsCapability(id, null, title, coordinateSystem);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("format", paramName);
+ }
+
+ [Test]
+ public void Constructor_TitleNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ const string id = "laag1(abc)";
+ const string format = "image/png";
+ const string coordinateSystem = "Coördinatenstelsel";
+
+ // Call
+ TestDelegate call = () => new WmtsCapability(id, format, null, coordinateSystem);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("title", paramName);
+ }
+
+ [Test]
+ public void Constructor_CoordinateSystemNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ const string id = "laag1(abc)";
+ const string format = "image/png";
+ const string title = "Eerste kaartlaag";
+
+ // Call
+ TestDelegate call = () => new WmtsCapability(id, format, title, null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("coordinateSystem", paramName);
+ }
+
+ [Test]
+ public void Constructor_FormatNotMIMEType_ThrowsArgumentException()
+ {
+ // Setup
+ const string id = "laag1(abc)";
+ const string format = "some string";
+ const string title = "Eerste kaartlaag";
+ const string coordinateSystem = "Coördinatenstelsel";
+
+ // Call
+ TestDelegate call = () => new WmtsCapability(id, format, title, coordinateSystem);
+
+ // Assert
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "Specified image format is not a MIME type.");
+ }
+
+ [Test]
+ public void Constructor_ValidProperties_ExpectedProperties()
+ {
+ // Setup
+ const string id = "laag1(abc)";
+ const string format = "image/png";
+ const string title = "Eerste kaartlaag";
+ const string coordinateSystem = "Coördinatenstelsel";
+
+ // Call
+ var wmtsCapability = new WmtsCapability(id, format, title, coordinateSystem);
+
+ // Assert
+ Assert.AreEqual(id, wmtsCapability.Id);
+ Assert.AreEqual(format, wmtsCapability.Format);
+ Assert.AreEqual(title, wmtsCapability.Title);
+ Assert.AreEqual(coordinateSystem, wmtsCapability.CoordinateSystem);
+ }
+
+
+ [Test]
+ public void ToWmtsMapData_DisplayNameNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var wmtsCapability = new WmtsCapability("laag1(abc)", "image/png", "Eerste kaartlaag", "Coördinatenstelsel");
+ const string sourceCapabilitiesUrl = "sourceCapabilitiesUrl";
+
+ // Call
+ TestDelegate call = () => wmtsCapability.ToWmtsMapdata(null, sourceCapabilitiesUrl);
+
+ // Assert
+ Assert.Throws(call);
+ }
+
+ [Test]
+ public void ToWmtsMapData_CapabilitiesUrlNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var wmtsCapability = new WmtsCapability("laag1(abc)", "image/png", "Eerste kaartlaag", "Coördinatenstelsel");
+ const string displayName = "displayName";
+
+ // Call
+ TestDelegate call = () => wmtsCapability.ToWmtsMapdata(displayName, null);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("sourceCapabilitiesUrl", paramName);
+ }
+
+ [Test]
+ public void ToWmtsMapData_ValidParameters_ReturnsNewWmtsMapData()
+ {
+ // Setup
+ const string id = "laag1(abc)";
+ const string format = "image/png";
+ const string title = "Eerste kaartlaag";
+ const string coordinateSystem = "Coördinatenstelsel";
+ const string displayName = "displayName";
+ const string sourceCapabilitiesUrl = "sourceCapabilitiesUrl";
+
+ var wmtsCapability = new WmtsCapability(id, format, title, coordinateSystem);
+
+ // Call
+ WmtsMapData mapData = wmtsCapability.ToWmtsMapdata(displayName, sourceCapabilitiesUrl);
+
+ // Assert
+ Assert.IsInstanceOf(mapData);
+ Assert.AreEqual(displayName, mapData.Name);
+ Assert.AreEqual(sourceCapabilitiesUrl, mapData.SourceCapabilitiesUrl);
+ }
+
+
+ }
+}
\ No newline at end of file