Index: Core/Components/src/Core.Components.DotSpatial/BaseMap.cs
===================================================================
diff -u -r3167b898b071fea4cf86c775bca5467fab086038 -rd841739a41fc898c60822e80e67f351b8e68f794
--- Core/Components/src/Core.Components.DotSpatial/BaseMap.cs (.../BaseMap.cs) (revision 3167b898b071fea4cf86c775bca5467fab086038)
+++ Core/Components/src/Core.Components.DotSpatial/BaseMap.cs (.../BaseMap.cs) (revision d841739a41fc898c60822e80e67f351b8e68f794)
@@ -69,7 +69,10 @@
map.ClearLayers();
if (data != null)
{
- map.Layers.Add(mapDataFactory.Create(data));
+ foreach (var feature in mapDataFactory.Create(data))
+ {
+ map.Layers.Add(feature);
+ }
}
}
Index: Core/Components/src/Core.Components.DotSpatial/Converter/IMapDataConverter.cs
===================================================================
diff -u -r3167b898b071fea4cf86c775bca5467fab086038 -rd841739a41fc898c60822e80e67f351b8e68f794
--- Core/Components/src/Core.Components.DotSpatial/Converter/IMapDataConverter.cs (.../IMapDataConverter.cs) (revision 3167b898b071fea4cf86c775bca5467fab086038)
+++ Core/Components/src/Core.Components.DotSpatial/Converter/IMapDataConverter.cs (.../IMapDataConverter.cs) (revision d841739a41fc898c60822e80e67f351b8e68f794)
@@ -20,6 +20,7 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using Core.Components.DotSpatial.Data;
using DotSpatial.Data;
@@ -42,9 +43,9 @@
/// Creates a based on the that was given.
///
/// The data to transform into a .
- /// A new .
+ /// A new of .
/// Thrown when returns false.
/// Thrown when is null.
- FeatureSet Convert(MapData data);
+ IList Convert(MapData data);
}
}
Index: Core/Components/src/Core.Components.DotSpatial/Converter/MapDataCollectionConverter.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.DotSpatial/Converter/MapDataCollectionConverter.cs (revision 0)
+++ Core/Components/src/Core.Components.DotSpatial/Converter/MapDataCollectionConverter.cs (revision d841739a41fc898c60822e80e67f351b8e68f794)
@@ -0,0 +1,44 @@
+// 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.Collections.Generic;
+using Core.Components.DotSpatial.Data;
+using DotSpatial.Data;
+
+namespace Core.Components.DotSpatial.Converter
+{
+ ///
+ /// The converter that converts in into (one or more) .
+ ///
+ public class MapDataCollectionConverter : MapDataConverter
+ {
+ protected override IList Convert(MapDataCollection data)
+ {
+ var factory = new MapDataFactory();
+ var featureSets = new List();
+ foreach (var mapData in data.List)
+ {
+ featureSets.AddRange(factory.Create(mapData));
+ }
+ return featureSets;
+ }
+ }
+}
Index: Core/Components/src/Core.Components.DotSpatial/Converter/MapDataConverter.cs
===================================================================
diff -u -r3167b898b071fea4cf86c775bca5467fab086038 -rd841739a41fc898c60822e80e67f351b8e68f794
--- Core/Components/src/Core.Components.DotSpatial/Converter/MapDataConverter.cs (.../MapDataConverter.cs) (revision 3167b898b071fea4cf86c775bca5467fab086038)
+++ Core/Components/src/Core.Components.DotSpatial/Converter/MapDataConverter.cs (.../MapDataConverter.cs) (revision d841739a41fc898c60822e80e67f351b8e68f794)
@@ -20,6 +20,7 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using Core.Components.DotSpatial.Data;
using DotSpatial.Data;
@@ -35,7 +36,7 @@
return data.GetType() == typeof(T);
}
- public FeatureSet Convert(MapData data)
+ public IList Convert(MapData data)
{
if (data == null)
{
@@ -54,7 +55,7 @@
/// Creates a based on the that was given.
///
/// The data to transform into a .
- /// A new .
- protected abstract FeatureSet Convert(T data);
+ /// A new of .
+ protected abstract IList Convert(T data);
}
}
Index: Core/Components/src/Core.Components.DotSpatial/Converter/MapDataFactory.cs
===================================================================
diff -u -r3167b898b071fea4cf86c775bca5467fab086038 -rd841739a41fc898c60822e80e67f351b8e68f794
--- Core/Components/src/Core.Components.DotSpatial/Converter/MapDataFactory.cs (.../MapDataFactory.cs) (revision 3167b898b071fea4cf86c775bca5467fab086038)
+++ Core/Components/src/Core.Components.DotSpatial/Converter/MapDataFactory.cs (.../MapDataFactory.cs) (revision d841739a41fc898c60822e80e67f351b8e68f794)
@@ -34,15 +34,17 @@
{
private readonly IEnumerable converters = new Collection
{
- new MapPointDataConverter()
+ new MapDataCollectionConverter(),
+ new MapPointDataConverter(),
+ new MapLineDataConverter()
};
///
/// Creates a new from the given .
///
/// The to base the creation of upon.
- /// A new .
+ /// A new of .
/// Thrown when the given type is not supported.
- public FeatureSet Create(MapData data)
+ public IList Create(MapData data)
{
foreach (var converter in converters)
{
Index: Core/Components/src/Core.Components.DotSpatial/Converter/MapLineDataConverter.cs
===================================================================
diff -u
--- Core/Components/src/Core.Components.DotSpatial/Converter/MapLineDataConverter.cs (revision 0)
+++ Core/Components/src/Core.Components.DotSpatial/Converter/MapLineDataConverter.cs (revision d841739a41fc898c60822e80e67f351b8e68f794)
@@ -0,0 +1,52 @@
+// 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.Collections.Generic;
+using System.Linq;
+using Core.Components.DotSpatial.Data;
+using DotSpatial.Data;
+using DotSpatial.Topology;
+
+namespace Core.Components.DotSpatial.Converter
+{
+ ///
+ /// The converter that converts into a containing .
+ ///
+ public class MapLineDataConverter : MapDataConverter
+ {
+ protected override IList Convert(MapLineData data)
+ {
+ var points = data.Points.ToList();
+ var featureSet = new FeatureSet(FeatureType.Line);
+
+ Coordinate[] coordinates = new Coordinate[points.Count()];
+ for (int i = 0; i < points.Count(); i++)
+ {
+ coordinates[i] = new Coordinate(points[i].Item1, points[i].Item2);
+ }
+ var lineString = new LineString(coordinates);
+ var feature = new Feature(lineString);
+ featureSet.Features.Add(feature);
+
+ return new List { featureSet };
+ }
+ }
+}
Index: Core/Components/src/Core.Components.DotSpatial/Converter/MapPointDataConverter.cs
===================================================================
diff -u -r3167b898b071fea4cf86c775bca5467fab086038 -rd841739a41fc898c60822e80e67f351b8e68f794
--- Core/Components/src/Core.Components.DotSpatial/Converter/MapPointDataConverter.cs (.../MapPointDataConverter.cs) (revision 3167b898b071fea4cf86c775bca5467fab086038)
+++ Core/Components/src/Core.Components.DotSpatial/Converter/MapPointDataConverter.cs (.../MapPointDataConverter.cs) (revision d841739a41fc898c60822e80e67f351b8e68f794)
@@ -19,15 +19,19 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.Collections.Generic;
using Core.Components.DotSpatial.Data;
using DotSpatial.Data;
using DotSpatial.Topology;
namespace Core.Components.DotSpatial.Converter
{
+ ///
+ /// The converter that converts into .
+ ///
public class MapPointDataConverter : MapDataConverter
{
- protected override FeatureSet Convert(MapPointData data)
+ protected override IList Convert(MapPointData data)
{
var featureSet = new FeatureSet(FeatureType.Point);
@@ -37,7 +41,7 @@
featureSet.Features.Add(coordinate);
}
- return featureSet;
+ return new List { featureSet };
}
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.DotSpatial/Core.Components.DotSpatial.csproj
===================================================================
diff -u -r3167b898b071fea4cf86c775bca5467fab086038 -rd841739a41fc898c60822e80e67f351b8e68f794
--- Core/Components/src/Core.Components.DotSpatial/Core.Components.DotSpatial.csproj (.../Core.Components.DotSpatial.csproj) (revision 3167b898b071fea4cf86c775bca5467fab086038)
+++ Core/Components/src/Core.Components.DotSpatial/Core.Components.DotSpatial.csproj (.../Core.Components.DotSpatial.csproj) (revision d841739a41fc898c60822e80e67f351b8e68f794)
@@ -96,11 +96,16 @@
Component
+
+
+
+
+
@@ -129,9 +134,7 @@
Designer
-
-
-
+