Index: Core/Components/src/Core.Components.DotSpatial/Converter/FeatureBasedMapDataConverter.cs =================================================================== diff -u -r0280af2522389e4f1291c22e0cbea677995e3fba -r9e14081c0645aa7b8460793d6773438f9955e87d --- Core/Components/src/Core.Components.DotSpatial/Converter/FeatureBasedMapDataConverter.cs (.../FeatureBasedMapDataConverter.cs) (revision 0280af2522389e4f1291c22e0cbea677995e3fba) +++ Core/Components/src/Core.Components.DotSpatial/Converter/FeatureBasedMapDataConverter.cs (.../FeatureBasedMapDataConverter.cs) (revision 9e14081c0645aa7b8460793d6773438f9955e87d) @@ -26,6 +26,7 @@ using System.Linq; using Core.Common.Base.Geometry; using Core.Components.Gis.Data; +using Core.Components.Gis.Features; using DotSpatial.Controls; using DotSpatial.Data; using DotSpatial.Symbology; @@ -74,6 +75,8 @@ ConvertLayerProperties((TFeatureBasedMapData) data, (TMapFeatureLayer) layer); } + protected abstract IEnumerable CreateFeatures(MapFeature mapFeature); + /// /// Creates a based on the that was given. /// Index: Core/Components/src/Core.Components.DotSpatial/Converter/MapLineDataConverter.cs =================================================================== diff -u -rf1533826e584432afb90f50645bad20a803eeac1 -r9e14081c0645aa7b8460793d6773438f9955e87d --- Core/Components/src/Core.Components.DotSpatial/Converter/MapLineDataConverter.cs (.../MapLineDataConverter.cs) (revision f1533826e584432afb90f50645bad20a803eeac1) +++ Core/Components/src/Core.Components.DotSpatial/Converter/MapLineDataConverter.cs (.../MapLineDataConverter.cs) (revision 9e14081c0645aa7b8460793d6773438f9955e87d) @@ -37,6 +37,11 @@ /// public class MapLineDataConverter : FeatureBasedMapDataConverter { + protected override IEnumerable CreateFeatures(MapFeature mapFeature) + { + yield return new Feature(GetGeometry(mapFeature)); + } + protected override IMapFeatureLayer Convert(MapLineData data) { var layer = new MapLineLayer(); Index: Core/Components/src/Core.Components.DotSpatial/Converter/MapPointDataConverter.cs =================================================================== diff -u -rf1533826e584432afb90f50645bad20a803eeac1 -r9e14081c0645aa7b8460793d6773438f9955e87d --- Core/Components/src/Core.Components.DotSpatial/Converter/MapPointDataConverter.cs (.../MapPointDataConverter.cs) (revision f1533826e584432afb90f50645bad20a803eeac1) +++ Core/Components/src/Core.Components.DotSpatial/Converter/MapPointDataConverter.cs (.../MapPointDataConverter.cs) (revision 9e14081c0645aa7b8460793d6773438f9955e87d) @@ -35,6 +35,11 @@ /// public class MapPointDataConverter : FeatureBasedMapDataConverter { + protected override IEnumerable CreateFeatures(MapFeature mapFeature) + { + return GetAllMapFeatureCoordinates(mapFeature).Select(c => new Feature(new Point(c.X, c.Y))); + } + protected override IMapFeatureLayer Convert(MapPointData data) { var layer = new MapPointLayer(); Index: Core/Components/src/Core.Components.DotSpatial/Converter/MapPolygonDataConverter.cs =================================================================== diff -u -rf1533826e584432afb90f50645bad20a803eeac1 -r9e14081c0645aa7b8460793d6773438f9955e87d --- Core/Components/src/Core.Components.DotSpatial/Converter/MapPolygonDataConverter.cs (.../MapPolygonDataConverter.cs) (revision f1533826e584432afb90f50645bad20a803eeac1) +++ Core/Components/src/Core.Components.DotSpatial/Converter/MapPolygonDataConverter.cs (.../MapPolygonDataConverter.cs) (revision 9e14081c0645aa7b8460793d6773438f9955e87d) @@ -23,6 +23,7 @@ using System.Linq; using Core.Common.Base.Geometry; using Core.Components.Gis.Data; +using Core.Components.Gis.Features; using DotSpatial.Controls; using DotSpatial.Data; using DotSpatial.Symbology; @@ -35,6 +36,31 @@ /// public class MapPolygonDataConverter : FeatureBasedMapDataConverter { + protected override IEnumerable CreateFeatures(MapFeature mapFeature) + { + var geometryList = new List(); + + foreach (var mapGeometry in mapFeature.MapGeometries) + { + IEnumerable[] pointCollections = mapGeometry.PointCollections.ToArray(); + + IEnumerable outerRingCoordinates = ConvertPoint2DElementsToCoordinates(pointCollections[0]); + ILinearRing outerRing = new LinearRing(outerRingCoordinates); + + ILinearRing[] innerRings = new ILinearRing[pointCollections.Length - 1]; + for (int i = 1; i < pointCollections.Length; i++) + { + IEnumerable innerRingCoordinates = ConvertPoint2DElementsToCoordinates(pointCollections[i]); + innerRings[i - 1] = new LinearRing(innerRingCoordinates); + } + + IPolygon polygon = new Polygon(outerRing, innerRings); + geometryList.Add(polygon); + } + + yield return new Feature(GetGeometry(geometryList)); + } + protected override IMapFeatureLayer Convert(MapPolygonData data) { var layer = new MapPolygonLayer(); Index: Core/Components/test/Core.Components.DotSpatial.Test/Converter/FeatureBasedMapDataConverterTest.cs =================================================================== diff -u -radd7a5c83fb8cfef850828654881bffac28adc4d -r9e14081c0645aa7b8460793d6773438f9955e87d --- Core/Components/test/Core.Components.DotSpatial.Test/Converter/FeatureBasedMapDataConverterTest.cs (.../FeatureBasedMapDataConverterTest.cs) (revision add7a5c83fb8cfef850828654881bffac28adc4d) +++ Core/Components/test/Core.Components.DotSpatial.Test/Converter/FeatureBasedMapDataConverterTest.cs (.../FeatureBasedMapDataConverterTest.cs) (revision 9e14081c0645aa7b8460793d6773438f9955e87d) @@ -20,11 +20,14 @@ // All rights reserved. using System; +using System.Collections.Generic; using Core.Common.TestUtil; using Core.Components.DotSpatial.Converter; using Core.Components.DotSpatial.TestUtil; using Core.Components.Gis.Data; +using Core.Components.Gis.Features; using DotSpatial.Controls; +using DotSpatial.Data; using NUnit.Framework; namespace Core.Components.DotSpatial.Test.Converter @@ -121,6 +124,11 @@ throw new NotImplementedException(); } + protected override IEnumerable CreateFeatures(MapFeature mapFeature) + { + throw new NotImplementedException(); + } + protected override IMapFeatureLayer Convert(TFeatureBasedMapData data) { return new MapPointLayer();