Index: Core/Components/src/Core.Components.DotSpatial/Converter/FeatureBasedMapDataConverter.cs =================================================================== diff -u -rcfaf7a697ebd90c7929af22bd4b17126ae03e6c0 -rbefc1a0f0bbc89550ee9a96fcf554487c004400a --- Core/Components/src/Core.Components.DotSpatial/Converter/FeatureBasedMapDataConverter.cs (.../FeatureBasedMapDataConverter.cs) (revision cfaf7a697ebd90c7929af22bd4b17126ae03e6c0) +++ Core/Components/src/Core.Components.DotSpatial/Converter/FeatureBasedMapDataConverter.cs (.../FeatureBasedMapDataConverter.cs) (revision befc1a0f0bbc89550ee9a96fcf554487c004400a) @@ -74,6 +74,7 @@ } layer.DataSet.InitializeVertices(); + layer.DataSet.UpdateExtent(); layer.AssignFastDrawnStates(); } Index: Core/Components/test/Core.Components.DotSpatial.Test/Converter/FeatureBasedMapDataConverterTest.cs =================================================================== diff -u -rcfaf7a697ebd90c7929af22bd4b17126ae03e6c0 -rbefc1a0f0bbc89550ee9a96fcf554487c004400a --- Core/Components/test/Core.Components.DotSpatial.Test/Converter/FeatureBasedMapDataConverterTest.cs (.../FeatureBasedMapDataConverterTest.cs) (revision cfaf7a697ebd90c7929af22bd4b17126ae03e6c0) +++ Core/Components/test/Core.Components.DotSpatial.Test/Converter/FeatureBasedMapDataConverterTest.cs (.../FeatureBasedMapDataConverterTest.cs) (revision befc1a0f0bbc89550ee9a96fcf554487c004400a) @@ -33,6 +33,7 @@ using DotSpatial.Data; using DotSpatial.Symbology; using NUnit.Framework; +using Point = DotSpatial.Topology.Point; namespace Core.Components.DotSpatial.Test.Converter { @@ -98,6 +99,52 @@ } [Test] + public void ConvertLayerFeatures_MapDataWithMetaData_MetaDataSetToLayer() + { + // Setup + var testConverter = new TestFeatureBasedMapDataConverter(); + var mapPointLayer = new MapPointLayer(); + var mapData = new Class("test") + { + Features = new[] + { + new MapFeature(Enumerable.Empty()) + { + MetaData = + { + { "Id", 1.1 }, + { "Name", "Feature 1" } + } + }, + new MapFeature(Enumerable.Empty()) + { + MetaData = + { + { "Id", 2.2 }, + { "Name", "Feature 2" } + } + } + } + }; + + // Call + testConverter.ConvertLayerFeatures(mapData, mapPointLayer); + + // Assert + var dataColumnCollection = mapPointLayer.DataSet.DataTable.Columns; + Assert.AreEqual(2, dataColumnCollection.Count); + Assert.AreEqual("1", dataColumnCollection[0].ToString()); + Assert.AreEqual("2", dataColumnCollection[1].ToString()); + + var dataRowCollection = mapPointLayer.DataSet.DataTable.Rows; + Assert.AreEqual(2, dataRowCollection.Count); + Assert.AreEqual("1.1", dataRowCollection[0][0]); + Assert.AreEqual("Feature 1", dataRowCollection[0][1]); + Assert.AreEqual("2.2", dataRowCollection[1][0]); + Assert.AreEqual("Feature 2", dataRowCollection[1][1]); + } + + [Test] public void ConvertLayerProperties_MapData_NameSetToLayer() { // Setup @@ -331,7 +378,7 @@ protected override IEnumerable CreateFeatures(MapFeature mapFeature) { - return Enumerable.Empty(); + yield return new Feature(new Point(1.1, 2.2)); } } }