Index: Core/Components/src/Core.Components.DotSpatial/BaseMap.cs =================================================================== diff -u -rfbb37872d09f1ded75ce2209e8e48a6b64d8a78f -reff23cd289c9dfc4d626a76cac16477cebfdb0fe --- Core/Components/src/Core.Components.DotSpatial/BaseMap.cs (.../BaseMap.cs) (revision fbb37872d09f1ded75ce2209e8e48a6b64d8a78f) +++ Core/Components/src/Core.Components.DotSpatial/BaseMap.cs (.../BaseMap.cs) (revision eff23cd289c9dfc4d626a76cac16477cebfdb0fe) @@ -33,7 +33,7 @@ /// /// The map view /// - public sealed class BaseMap : Control + public sealed class BaseMap : Control, IMap { private static readonly ILog Log = LogManager.GetLogger(typeof(BaseMap)); private MapData data; @@ -53,27 +53,34 @@ /// Thrown when is null. /// Thrown when does not exist. /// Thrown when the data in is not valid. - public void SetMapData(MapData mapData) + public MapData Data { - if (IsDisposed) + get { - return; + return data; } - - if (mapData == null) + set { - throw new ArgumentNullException("mapData", "MapData is required when adding shapeFiles"); - } + if (IsDisposed) + { + return; + } - if (mapData.IsValid()) - { - data = mapData; - LoadData(); + if (value == null) + { + throw new ArgumentNullException("mapData", "MapData is required when adding shapeFiles"); + } + + if (value.IsValid()) + { + data = value; + LoadData(); + } + else + { + throw new MapDataException(Resources.BaseMap_SetMapData_The_data_available_in_MapData_is_not_valid_); + } } - else - { - throw new MapDataException(Resources.BaseMap_SetMapData_The_data_available_in_MapData_is_not_valid_); - } } /// Index: Core/Components/src/Core.Components.DotSpatial/IMap.cs =================================================================== diff -u -r22f1bb3808dd48f3350d6a39171fe3b002da0a91 -reff23cd289c9dfc4d626a76cac16477cebfdb0fe --- Core/Components/src/Core.Components.DotSpatial/IMap.cs (.../IMap.cs) (revision 22f1bb3808dd48f3350d6a39171fe3b002da0a91) +++ Core/Components/src/Core.Components.DotSpatial/IMap.cs (.../IMap.cs) (revision eff23cd289c9dfc4d626a76cac16477cebfdb0fe) @@ -33,4 +33,4 @@ /// MapData Data { get; set; } } -} +} \ No newline at end of file Index: Core/Components/test/Core.Components.DotSpatial.Test/BaseMapTest.cs =================================================================== diff -u -rcd2cd8c2cfa9e88043c9dd10f843ba2d7fd81338 -reff23cd289c9dfc4d626a76cac16477cebfdb0fe --- Core/Components/test/Core.Components.DotSpatial.Test/BaseMapTest.cs (.../BaseMapTest.cs) (revision cd2cd8c2cfa9e88043c9dd10f843ba2d7fd81338) +++ Core/Components/test/Core.Components.DotSpatial.Test/BaseMapTest.cs (.../BaseMapTest.cs) (revision eff23cd289c9dfc4d626a76cac16477cebfdb0fe) @@ -39,7 +39,7 @@ data.AddShapeFile(segmentsFile); // Call - TestDelegate setDataDelegate = () => map.SetMapData(data); + TestDelegate setDataDelegate = () => map.Data = data; // Assert Assert.Throws(setDataDelegate); @@ -57,7 +57,7 @@ RenameFile(tempTeenFile, binnenTeenFile); // Call - TestDelegate testDelegate = () => map.SetMapData(data); + TestDelegate testDelegate = () => map.Data = data; try { @@ -81,7 +81,7 @@ data.AddShapeFile(dijkvakgebiedenFile); // Call - TestDelegate setDataDelegate = () => map.SetMapData(data); + TestDelegate setDataDelegate = () => map.Data = data; // Assert Assert.DoesNotThrow(setDataDelegate); @@ -104,7 +104,7 @@ var preLayerCount = mapComponent.GetLayers().Count; // Call - Action action = () => map.SetMapData(data); + Action action = () => map.Data = data; // Assert TestHelper.AssertLogMessageIsGenerated(action, excpectedLog); Index: Core/Plugins/src/Core.Plugins.DotSpatial/DotSpatialGuiPlugin.cs =================================================================== diff -u -r97b8c68c7a4da08b4d969a0cababbbc50b4b4408 -reff23cd289c9dfc4d626a76cac16477cebfdb0fe --- Core/Plugins/src/Core.Plugins.DotSpatial/DotSpatialGuiPlugin.cs (.../DotSpatialGuiPlugin.cs) (revision 97b8c68c7a4da08b4d969a0cababbbc50b4b4408) +++ Core/Plugins/src/Core.Plugins.DotSpatial/DotSpatialGuiPlugin.cs (.../DotSpatialGuiPlugin.cs) (revision eff23cd289c9dfc4d626a76cac16477cebfdb0fe) @@ -61,11 +61,6 @@ base.Dispose(); } - private MapRibbon CreateMapRibbon() - { - return new MapRibbon(); - } - public override IEnumerable GetViewInfoObjects() { yield return new ViewInfo @@ -75,6 +70,11 @@ }; } + private MapRibbon CreateMapRibbon() + { + return new MapRibbon(); + } + private void GuiOnActiveViewChanged(object sender, ActiveViewChangeEventArgs activeViewChangeEventArgs) { UpdateComponentsForActiveView(); Index: Core/Plugins/src/Core.Plugins.DotSpatial/Forms/MapDataView.cs =================================================================== diff -u -rfbb37872d09f1ded75ce2209e8e48a6b64d8a78f -reff23cd289c9dfc4d626a76cac16477cebfdb0fe --- Core/Plugins/src/Core.Plugins.DotSpatial/Forms/MapDataView.cs (.../MapDataView.cs) (revision fbb37872d09f1ded75ce2209e8e48a6b64d8a78f) +++ Core/Plugins/src/Core.Plugins.DotSpatial/Forms/MapDataView.cs (.../MapDataView.cs) (revision eff23cd289c9dfc4d626a76cac16477cebfdb0fe) @@ -20,7 +20,6 @@ // All rights reserved. using System.Windows.Forms; -using Core.Common.Controls.Views; using Core.Components.DotSpatial; using Core.Components.DotSpatial.Data; @@ -29,7 +28,7 @@ /// /// The user control for the Map. /// - public partial class MapDataView : UserControl, IView + public partial class MapDataView : UserControl, IMapView { private readonly BaseMap baseMap; private MapData data; @@ -55,12 +54,20 @@ set { data = (MapData) value; - + if (data != null) { - baseMap.SetMapData(data); + baseMap.Data = data; } } } + + public IMap Map + { + get + { + return baseMap; + } + } } } \ No newline at end of file Index: Core/Plugins/src/Core.Plugins.DotSpatial/MapRibbon.xaml.cs =================================================================== diff -u -r97b8c68c7a4da08b4d969a0cababbbc50b4b4408 -reff23cd289c9dfc4d626a76cac16477cebfdb0fe --- Core/Plugins/src/Core.Plugins.DotSpatial/MapRibbon.xaml.cs (.../MapRibbon.xaml.cs) (revision 97b8c68c7a4da08b4d969a0cababbbc50b4b4408) +++ Core/Plugins/src/Core.Plugins.DotSpatial/MapRibbon.xaml.cs (.../MapRibbon.xaml.cs) (revision eff23cd289c9dfc4d626a76cac16477cebfdb0fe) @@ -19,7 +19,6 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using System.Collections.Generic; using System.Windows; using Core.Common.Controls.Commands;