Index: Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs
===================================================================
diff -u -rf245fcfc202b53559917a5b89810a30c42949303 -r8b36313c9a9136c821c2614762889a63968aa8e6
--- Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs (.../MapControl.cs) (revision f245fcfc202b53559917a5b89810a30c42949303)
+++ Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs (.../MapControl.cs) (revision 8b36313c9a9136c821c2614762889a63968aa8e6)
@@ -261,7 +261,7 @@
private void DrawMapData(FeatureBasedMapData featureBasedMapData)
{
- var mapFeatureLayer = MapFeatureLayerFactory.CreateLayer(featureBasedMapData);
+ var mapFeatureLayer = FeatureBasedMapDataLayerFactory.Create(featureBasedMapData);
var drawnMapData = new DrawnMapData
{
Fisheye: Tag 8b36313c9a9136c821c2614762889a63968aa8e6 refers to a dead (removed) revision in file `Core/Components/src/Core.Components.DotSpatial/Converter/MapFeatureLayerFactory.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Components/src/Core.Components.DotSpatial/Core.Components.DotSpatial.csproj
===================================================================
diff -u -rf245fcfc202b53559917a5b89810a30c42949303 -r8b36313c9a9136c821c2614762889a63968aa8e6
--- Core/Components/src/Core.Components.DotSpatial/Core.Components.DotSpatial.csproj (.../Core.Components.DotSpatial.csproj) (revision f245fcfc202b53559917a5b89810a30c42949303)
+++ Core/Components/src/Core.Components.DotSpatial/Core.Components.DotSpatial.csproj (.../Core.Components.DotSpatial.csproj) (revision 8b36313c9a9136c821c2614762889a63968aa8e6)
@@ -67,7 +67,7 @@
-
+
Index: Core/Components/src/Core.Components.DotSpatial/Layer/FeatureBasedMapDataLayerFactory.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.DotSpatial/Layer/FeatureBasedMapDataLayerFactory.cs (revision 0)
+++ Core/Components/src/Core.Components.DotSpatial/Layer/FeatureBasedMapDataLayerFactory.cs (revision 8b36313c9a9136c821c2614762889a63968aa8e6)
@@ -0,0 +1,61 @@
+// 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 Lesser 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 Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser 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 Core.Components.DotSpatial.Layer
+{
+ ///
+ /// A factory to create based on .
+ ///
+ public static class FeatureBasedMapDataLayerFactory
+ {
+ ///
+ /// Creates a based on .
+ ///
+ /// The to create a from.
+ /// A instance.
+ /// Thrown when the given type is not supported.
+ public static IFeatureBasedMapDataLayer Create(FeatureBasedMapData data)
+ {
+ var mapPointData = data as MapPointData;
+ if (mapPointData != null)
+ {
+ return new MapPointDataLayer(mapPointData);
+ }
+
+ var mapLineData = data as MapLineData;
+ if (mapLineData != null)
+ {
+ return new MapLineDataLayer(mapLineData);
+ }
+
+ var mapPolygonData = data as MapPolygonData;
+ if (mapPolygonData != null)
+ {
+ return new MapPolygonDataLayer(mapPolygonData);
+ }
+
+ throw new NotSupportedException(string.Format("FeatureBasedMapData of type {0} is not supported.", data.GetType().Name));
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 8b36313c9a9136c821c2614762889a63968aa8e6 refers to a dead (removed) revision in file `Core/Components/test/Core.Components.DotSpatial.Test/Converter/MapFeatureLayerFactoryTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Components/test/Core.Components.DotSpatial.Test/Core.Components.DotSpatial.Test.csproj
===================================================================
diff -u -r72b0b9489dd743b6a2a3c80ccc42ae5a9ad203ae -r8b36313c9a9136c821c2614762889a63968aa8e6
--- Core/Components/test/Core.Components.DotSpatial.Test/Core.Components.DotSpatial.Test.csproj (.../Core.Components.DotSpatial.Test.csproj) (revision 72b0b9489dd743b6a2a3c80ccc42ae5a9ad203ae)
+++ Core/Components/test/Core.Components.DotSpatial.Test/Core.Components.DotSpatial.Test.csproj (.../Core.Components.DotSpatial.Test.csproj) (revision 8b36313c9a9136c821c2614762889a63968aa8e6)
@@ -83,7 +83,7 @@
-
+
Index: Core/Components/test/Core.Components.DotSpatial.Test/Layer/FeatureBasedMapDataLayerFactoryTest.cs
===================================================================
diff -u
--- Core/Components/test/Core.Components.DotSpatial.Test/Layer/FeatureBasedMapDataLayerFactoryTest.cs (revision 0)
+++ Core/Components/test/Core.Components.DotSpatial.Test/Layer/FeatureBasedMapDataLayerFactoryTest.cs (revision 8b36313c9a9136c821c2614762889a63968aa8e6)
@@ -0,0 +1,76 @@
+// 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 Lesser 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 Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser 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.DotSpatial.Layer;
+using Core.Components.DotSpatial.TestUtil;
+using Core.Components.Gis.Data;
+using NUnit.Framework;
+
+namespace Core.Components.DotSpatial.Test.Layer
+{
+ [TestFixture]
+ public class FeatureBasedMapDataLayerFactoryTest
+ {
+ [Test]
+ public void Create_MapPointData_ReturnMapPointDataLayer()
+ {
+ // Call
+ IFeatureBasedMapDataLayer layer = FeatureBasedMapDataLayerFactory.Create(new MapPointData("test data"));
+
+ // Assert
+ Assert.IsInstanceOf(layer);
+ }
+
+ [Test]
+ public void Create_MapLineData_ReturnMapLineDataLayer()
+ {
+ // Call
+ IFeatureBasedMapDataLayer layer = FeatureBasedMapDataLayerFactory.Create(new MapLineData("test data"));
+
+ // Assert
+ Assert.IsInstanceOf(layer);
+ }
+
+ [Test]
+ public void Create_MapPolygonData_ReturnMapPolygonDataLayer()
+ {
+ // Call
+ IFeatureBasedMapDataLayer layer = FeatureBasedMapDataLayerFactory.Create(new MapPolygonData("test data"));
+
+ // Assert
+ Assert.IsInstanceOf(layer);
+ }
+
+ [Test]
+ public void Create_OtherData_ThrownsNotSupportedException()
+ {
+ // Setup
+ var testData = new TestFeatureBasedMapData("test data");
+
+ // Call
+ TestDelegate test = () => FeatureBasedMapDataLayerFactory.Create(testData);
+
+ // Assert
+ Assert.Throws(test);
+ }
+ }
+}
\ No newline at end of file