Index: Core/Components/src/Core.Components.DotSpatial/BaseMap.cs =================================================================== diff -u -rd841739a41fc898c60822e80e67f351b8e68f794 -rf665ce5f69f43f2ee4a96a05e44b849d019bb53a --- Core/Components/src/Core.Components.DotSpatial/BaseMap.cs (.../BaseMap.cs) (revision d841739a41fc898c60822e80e67f351b8e68f794) +++ Core/Components/src/Core.Components.DotSpatial/BaseMap.cs (.../BaseMap.cs) (revision f665ce5f69f43f2ee4a96a05e44b849d019bb53a) @@ -27,7 +27,7 @@ namespace Core.Components.DotSpatial { /// - /// The map view + /// This class describes a map view with configured projection and function mode. /// public sealed class BaseMap : Control, IMap { @@ -36,16 +36,13 @@ private Map map; /// - /// Creates a new instance of + /// Creates a new instance of . /// public BaseMap() { InitializeMapView(); } - /// - /// Gets and sets the . When is not empty it will load the data on the map. - /// public MapData Data { get @@ -69,9 +66,9 @@ map.ClearLayers(); if (data != null) { - foreach (var feature in mapDataFactory.Create(data)) + foreach (var featureSet in mapDataFactory.Create(data)) { - map.Layers.Add(feature); + map.Layers.Add(featureSet); } } } @@ -82,8 +79,9 @@ { ProjectionModeDefine = ActionMode.Never, Dock = DockStyle.Fill, - FunctionMode = FunctionMode.Pan, + FunctionMode = FunctionMode.Pan }; + Controls.Add(map); } } Index: Core/Components/test/Core.Components.DotSpatial.Test/BaseMapTest.cs =================================================================== diff -u -r3167b898b071fea4cf86c775bca5467fab086038 -rf665ce5f69f43f2ee4a96a05e44b849d019bb53a --- Core/Components/test/Core.Components.DotSpatial.Test/BaseMapTest.cs (.../BaseMapTest.cs) (revision 3167b898b071fea4cf86c775bca5467fab086038) +++ Core/Components/test/Core.Components.DotSpatial.Test/BaseMapTest.cs (.../BaseMapTest.cs) (revision f665ce5f69f43f2ee4a96a05e44b849d019bb53a) @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Linq; using System.Windows.Forms; using Core.Common.Utils.Reflection; @@ -26,7 +25,7 @@ } [Test] - public void Data_NotKnowMapData_ThrowsNotSupportedException() + public void Data_UnknownMapData_ThrowsNotSupportedException() { // Setup var map = new BaseMap(); @@ -58,13 +57,12 @@ // Setup var map = new BaseMap(); var testData = new MapPointData(Enumerable.Empty>()); - map.Data = testData; // Call - var data = map.Data; + map.Data = testData; // Assert - Assert.AreSame(testData, data); + Assert.AreSame(testData, map.Data); } [Test] @@ -81,5 +79,26 @@ // Assert Assert.AreEqual(1, mapView.Layers.Count); } + + [Test] + public void Data_SetToNull_MapFeaturesCleared() + { + // Setup + var map = new BaseMap(); + var testData = new MapPointData(Enumerable.Empty>()); + var mapView = TypeUtils.GetField(map, "map"); + + map.Data = testData; + + // Precondition + Assert.AreEqual(1, mapView.Layers.Count); + + // Call + map.Data = null; + + // Assert + Assert.IsNull(map.Data); + Assert.AreEqual(0, mapView.Layers.Count); + } } } \ No newline at end of file Index: Core/Components/test/Core.Components.DotSpatial.Test/Exceptions/MapDataExceptionTest.cs =================================================================== diff -u -r37dc25947c67f84a31ca868d2acceec4f48721cc -rf665ce5f69f43f2ee4a96a05e44b849d019bb53a --- Core/Components/test/Core.Components.DotSpatial.Test/Exceptions/MapDataExceptionTest.cs (.../MapDataExceptionTest.cs) (revision 37dc25947c67f84a31ca868d2acceec4f48721cc) +++ Core/Components/test/Core.Components.DotSpatial.Test/Exceptions/MapDataExceptionTest.cs (.../MapDataExceptionTest.cs) (revision f665ce5f69f43f2ee4a96a05e44b849d019bb53a) @@ -1,6 +1,5 @@ using System; using Core.Components.DotSpatial.Exceptions; -using Microsoft.Win32; using NUnit.Framework; namespace Core.Components.DotSpatial.Test.Exceptions Index: Core/Plugins/src/Core.Plugins.DotSpatial/DotSpatialGuiPlugin.cs =================================================================== diff -u -r6522a9f7396e770f8ecdcfda59c0966a86f6fb23 -rf665ce5f69f43f2ee4a96a05e44b849d019bb53a --- Core/Plugins/src/Core.Plugins.DotSpatial/DotSpatialGuiPlugin.cs (.../DotSpatialGuiPlugin.cs) (revision 6522a9f7396e770f8ecdcfda59c0966a86f6fb23) +++ Core/Plugins/src/Core.Plugins.DotSpatial/DotSpatialGuiPlugin.cs (.../DotSpatialGuiPlugin.cs) (revision f665ce5f69f43f2ee4a96a05e44b849d019bb53a) @@ -52,19 +52,12 @@ public override void Activate() { mapLegendController = CreateLegendController(Gui); - mapRibbon = CreateMapRibbon(mapLegendController); + mapRibbon = CreateMapRibbon(); Gui.ActiveViewChanged += GuiOnActiveViewChanged; activated = true; } - private MapLegendController CreateLegendController(IToolViewController toolViewController) - { - var controller = new MapLegendController(toolViewController); - controller.OnOpenLegend += (s, e) => UpdateComponentsForActiveView(); - return controller; - } - public override void Dispose() { if (activated) @@ -83,8 +76,15 @@ }; } - private MapRibbon CreateMapRibbon(MapLegendController mapLegendController) + private MapLegendController CreateLegendController(IToolViewController toolViewController) { + var controller = new MapLegendController(toolViewController); + controller.OnOpenLegend += (s, e) => UpdateComponentsForActiveView(); + return controller; + } + + private MapRibbon CreateMapRibbon() + { return new MapRibbon { ToggleLegendViewCommand = new ToggleMapLegendViewCommand(mapLegendController) @@ -97,7 +97,7 @@ } /// - /// Updates the components which the knows about so that it reflects + /// Updates the components which the knows about so that it reflects /// the currently active view. /// private void UpdateComponentsForActiveView() Index: Core/Plugins/src/Core.Plugins.DotSpatial/Forms/MapDataView.cs =================================================================== diff -u -reff23cd289c9dfc4d626a76cac16477cebfdb0fe -rf665ce5f69f43f2ee4a96a05e44b849d019bb53a --- Core/Plugins/src/Core.Plugins.DotSpatial/Forms/MapDataView.cs (.../MapDataView.cs) (revision eff23cd289c9dfc4d626a76cac16477cebfdb0fe) +++ Core/Plugins/src/Core.Plugins.DotSpatial/Forms/MapDataView.cs (.../MapDataView.cs) (revision f665ce5f69f43f2ee4a96a05e44b849d019bb53a) @@ -26,21 +26,21 @@ namespace Core.Plugins.DotSpatial.Forms { /// - /// The user control for the Map. + /// This class represents a simple view with a map, to which data can be added. /// public partial class MapDataView : UserControl, IMapView { private readonly BaseMap baseMap; private MapData data; /// - /// Creates a new instance of MapDataView and adds the map view to the . + /// Creates a new instance of . /// public MapDataView() { baseMap = new BaseMap { - Dock = DockStyle.Fill, + Dock = DockStyle.Fill }; Controls.Add(baseMap); } @@ -57,7 +57,7 @@ if (data != null) { - baseMap.Data = data; + Map.Data = data; } } } Index: Core/Plugins/src/Core.Plugins.DotSpatial/MapRibbon.xaml =================================================================== diff -u -r65524a2e6ec33a816e25ff8d15d3d2bd1ebbcf56 -rf665ce5f69f43f2ee4a96a05e44b849d019bb53a --- Core/Plugins/src/Core.Plugins.DotSpatial/MapRibbon.xaml (.../MapRibbon.xaml) (revision 65524a2e6ec33a816e25ff8d15d3d2bd1ebbcf56) +++ Core/Plugins/src/Core.Plugins.DotSpatial/MapRibbon.xaml (.../MapRibbon.xaml) (revision f665ce5f69f43f2ee4a96a05e44b849d019bb53a) @@ -20,7 +20,7 @@ - + Index: Core/Plugins/src/Core.Plugins.DotSpatial/Properties/Resources.Designer.cs =================================================================== diff -u -r1341790727b3578050fde0968605fc9499781954 -rf665ce5f69f43f2ee4a96a05e44b849d019bb53a --- Core/Plugins/src/Core.Plugins.DotSpatial/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1341790727b3578050fde0968605fc9499781954) +++ Core/Plugins/src/Core.Plugins.DotSpatial/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f665ce5f69f43f2ee4a96a05e44b849d019bb53a) @@ -100,9 +100,9 @@ /// /// Looks up a localized string similar to Open het kaartenpaneel.. /// - public static string Ribbon_Toggle_Legend_ToopTip { + public static string Ribbon_Toggle_Legend_ToolTip { get { - return ResourceManager.GetString("Ribbon_Toggle_Legend_ToopTip", resourceCulture); + return ResourceManager.GetString("Ribbon_Toggle_Legend_ToolTip", resourceCulture); } } } Index: Core/Plugins/src/Core.Plugins.DotSpatial/Properties/Resources.resx =================================================================== diff -u -r1341790727b3578050fde0968605fc9499781954 -rf665ce5f69f43f2ee4a96a05e44b849d019bb53a --- Core/Plugins/src/Core.Plugins.DotSpatial/Properties/Resources.resx (.../Resources.resx) (revision 1341790727b3578050fde0968605fc9499781954) +++ Core/Plugins/src/Core.Plugins.DotSpatial/Properties/Resources.resx (.../Resources.resx) (revision f665ce5f69f43f2ee4a96a05e44b849d019bb53a) @@ -130,7 +130,7 @@ Kaart - + Open het kaartenpaneel. \ No newline at end of file Index: Core/Plugins/test/Core.Plugins.DotSpatial.Test/Forms/MapDataViewTest.cs =================================================================== diff -u -r3167b898b071fea4cf86c775bca5467fab086038 -rf665ce5f69f43f2ee4a96a05e44b849d019bb53a --- Core/Plugins/test/Core.Plugins.DotSpatial.Test/Forms/MapDataViewTest.cs (.../MapDataViewTest.cs) (revision 3167b898b071fea4cf86c775bca5467fab086038) +++ Core/Plugins/test/Core.Plugins.DotSpatial.Test/Forms/MapDataViewTest.cs (.../MapDataViewTest.cs) (revision f665ce5f69f43f2ee4a96a05e44b849d019bb53a) @@ -47,23 +47,11 @@ var map = (BaseMap)mapView.Controls[0]; // Call - mapView.Data = null; - - // Assert - Assert.IsNull(map.Data); - } - - [Test] - public void Data_SetToNull_DoesNotThrowException() - { - // Setup - var mapView = new MapDataView(); - - // Call TestDelegate testDelegate = () => mapView.Data = null; // Assert Assert.DoesNotThrow(testDelegate); + Assert.IsNull(map.Data); } [Test]