Index: Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs =================================================================== diff -u -r0e06c680a679bb9ca03fc2fec450c884cc6a282b -r0000dc5281368d94b73b65908096fc255d17a852 --- Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs (.../MapControl.cs) (revision 0e06c680a679bb9ca03fc2fec450c884cc6a282b) +++ Core/Components/src/Core.Components.DotSpatial.Forms/MapControl.cs (.../MapControl.cs) (revision 0000dc5281368d94b73b65908096fc255d17a852) @@ -215,6 +215,7 @@ if (!mapLayer.Projection.Equals(Projection)) { mapLayer.Reproject(Projection); + mapLayer.Invalidate(); } } } Index: Core/Components/src/Core.Components.DotSpatial/Layer/MapLineDataLayer.cs =================================================================== diff -u -rac288b3406ebf34fadb4923674c3b93777cfbd84 -r0000dc5281368d94b73b65908096fc255d17a852 --- Core/Components/src/Core.Components.DotSpatial/Layer/MapLineDataLayer.cs (.../MapLineDataLayer.cs) (revision ac288b3406ebf34fadb4923674c3b93777cfbd84) +++ Core/Components/src/Core.Components.DotSpatial/Layer/MapLineDataLayer.cs (.../MapLineDataLayer.cs) (revision 0000dc5281368d94b73b65908096fc255d17a852) @@ -24,7 +24,6 @@ using Core.Components.Gis.Data; using Core.Components.Gis.Features; using DotSpatial.Controls; -using DotSpatial.Projections; namespace Core.Components.DotSpatial.Layer { @@ -67,12 +66,5 @@ converter.ConvertLayerProperties(mapLineData, this); } - - public override void Reproject(ProjectionInfo targetProjection) - { - base.Reproject(targetProjection); - - Invalidate(); - } } } \ No newline at end of file Index: Core/Components/src/Core.Components.DotSpatial/Layer/MapPointDataLayer.cs =================================================================== diff -u -rac288b3406ebf34fadb4923674c3b93777cfbd84 -r0000dc5281368d94b73b65908096fc255d17a852 --- Core/Components/src/Core.Components.DotSpatial/Layer/MapPointDataLayer.cs (.../MapPointDataLayer.cs) (revision ac288b3406ebf34fadb4923674c3b93777cfbd84) +++ Core/Components/src/Core.Components.DotSpatial/Layer/MapPointDataLayer.cs (.../MapPointDataLayer.cs) (revision 0000dc5281368d94b73b65908096fc255d17a852) @@ -24,7 +24,6 @@ using Core.Components.Gis.Data; using Core.Components.Gis.Features; using DotSpatial.Controls; -using DotSpatial.Projections; namespace Core.Components.DotSpatial.Layer { @@ -67,12 +66,5 @@ converter.ConvertLayerProperties(mapPointData, this); } - - public override void Reproject(ProjectionInfo targetProjection) - { - base.Reproject(targetProjection); - - Invalidate(); - } } } \ No newline at end of file Index: Core/Components/src/Core.Components.DotSpatial/Layer/MapPolygonDataLayer.cs =================================================================== diff -u -rac288b3406ebf34fadb4923674c3b93777cfbd84 -r0000dc5281368d94b73b65908096fc255d17a852 --- Core/Components/src/Core.Components.DotSpatial/Layer/MapPolygonDataLayer.cs (.../MapPolygonDataLayer.cs) (revision ac288b3406ebf34fadb4923674c3b93777cfbd84) +++ Core/Components/src/Core.Components.DotSpatial/Layer/MapPolygonDataLayer.cs (.../MapPolygonDataLayer.cs) (revision 0000dc5281368d94b73b65908096fc255d17a852) @@ -24,7 +24,6 @@ using Core.Components.Gis.Data; using Core.Components.Gis.Features; using DotSpatial.Controls; -using DotSpatial.Projections; namespace Core.Components.DotSpatial.Layer { @@ -67,12 +66,5 @@ converter.ConvertLayerProperties(mapPolygonData, this); } - - public override void Reproject(ProjectionInfo targetProjection) - { - base.Reproject(targetProjection); - - Invalidate(); - } } } \ No newline at end of file Index: Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs =================================================================== diff -u -rbd7f1f37cf99d61c548f5038a855db77f8c4ef00 -r0000dc5281368d94b73b65908096fc255d17a852 --- Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs (.../MapControlTest.cs) (revision bd7f1f37cf99d61c548f5038a855db77f8c4ef00) +++ Core/Components/test/Core.Components.DotSpatial.Forms.Test/MapControlTest.cs (.../MapControlTest.cs) (revision 0000dc5281368d94b73b65908096fc255d17a852) @@ -571,6 +571,60 @@ #region BackgroundMapData + [Test] + public void GivenMapControlWithBackgroundData_WhenProjectionChanged_MapLayersItemChangedFired() + { + // Given + var itemChangedCount = 0; + WmtsMapData newBackgroundMapData = WmtsMapDataTestHelper.CreateAlternativePdokMapData(); + WmtsMapData startingBackgroundMapData = WmtsMapDataTestHelper.CreateUnconnectedMapData(); + + using (new UseCustomSettingsHelper(testSettingsHelper)) + using (new UseCustomTileSourceFactoryConfig(newBackgroundMapData)) + using (var map = new MapControl + { + BackgroundMapData = startingBackgroundMapData + }) + { + Map mapView = map.Controls.OfType().First(); + + var mapPointData = new MapPointData("Points") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + new[] + { + new Point2D(1.1, 2.2) + } + }) + }) + } + }; + var mapDataCollection = new MapDataCollection("Root collection"); + mapDataCollection.Add(mapPointData); + + map.Data = mapDataCollection; + SetTestExtents(mapView); + + IMapLayer[] layersBeforeUpdate = mapView.Layers.ToArray(); + var pointFeatureLayer = (FeatureLayer) layersBeforeUpdate[0]; + pointFeatureLayer.ItemChanged += (sender, args) => itemChangedCount++; + + // When + startingBackgroundMapData.Configure(newBackgroundMapData.SourceCapabilitiesUrl, + newBackgroundMapData.SelectedCapabilityIdentifier, + newBackgroundMapData.PreferredFormat); + startingBackgroundMapData.NotifyObservers(); + + // Then + Assert.AreEqual(1, itemChangedCount); + } + } + #region WmtsMapData [Test] Index: Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapLineDataLayerTest.cs =================================================================== diff -u -rac288b3406ebf34fadb4923674c3b93777cfbd84 -r0000dc5281368d94b73b65908096fc255d17a852 --- Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapLineDataLayerTest.cs (.../MapLineDataLayerTest.cs) (revision ac288b3406ebf34fadb4923674c3b93777cfbd84) +++ Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapLineDataLayerTest.cs (.../MapLineDataLayerTest.cs) (revision 0000dc5281368d94b73b65908096fc255d17a852) @@ -135,23 +135,6 @@ CollectionAssert.AreEqual(drawnFeatures, mapLineDataLayer.DataSet.Features); } - [Test] - public void GivenMapLineDataLayer_WhenReprojected_ItemChangedFired() - { - // Given - var count = 0; - var mapLineData = new MapLineData("Test name"); - var mapLineDataLayer = new MapLineDataLayer(mapLineData); - - mapLineDataLayer.ItemChanged += (sender, args) => count++; - - // When - mapLineDataLayer.Reproject(KnownCoordinateSystems.Geographic.World.WGS1984); - - // Then - Assert.AreEqual(1, count); - } - private static void SetMapLineDataTestProperties(MapLineData mapLineData) { mapLineData.Name = "Another test name"; Index: Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapPointDataLayerTest.cs =================================================================== diff -u -rac288b3406ebf34fadb4923674c3b93777cfbd84 -r0000dc5281368d94b73b65908096fc255d17a852 --- Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapPointDataLayerTest.cs (.../MapPointDataLayerTest.cs) (revision ac288b3406ebf34fadb4923674c3b93777cfbd84) +++ Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapPointDataLayerTest.cs (.../MapPointDataLayerTest.cs) (revision 0000dc5281368d94b73b65908096fc255d17a852) @@ -134,23 +134,6 @@ CollectionAssert.AreEqual(drawnFeatures, mapPointDataLayer.DataSet.Features); } - [Test] - public void GivenMapPointDataLayer_WhenReprojected_ItemChangedFired() - { - // Given - var count = 0; - var mapPointData = new MapPointData("Test name"); - var mapPointDataLayer = new MapPointDataLayer(mapPointData); - - mapPointDataLayer.ItemChanged += (sender, args) => count++; - - // When - mapPointDataLayer.Reproject(KnownCoordinateSystems.Geographic.World.WGS1984); - - // Then - Assert.AreEqual(1, count); - } - private static void SetMapPointDataTestProperties(MapPointData mapPointData) { mapPointData.Name = "Another test name"; Index: Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapPolygonDataLayerTest.cs =================================================================== diff -u -rac288b3406ebf34fadb4923674c3b93777cfbd84 -r0000dc5281368d94b73b65908096fc255d17a852 --- Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapPolygonDataLayerTest.cs (.../MapPolygonDataLayerTest.cs) (revision ac288b3406ebf34fadb4923674c3b93777cfbd84) +++ Core/Components/test/Core.Components.DotSpatial.Test/Layer/MapPolygonDataLayerTest.cs (.../MapPolygonDataLayerTest.cs) (revision 0000dc5281368d94b73b65908096fc255d17a852) @@ -134,23 +134,6 @@ CollectionAssert.AreEqual(drawnFeatures, mapPolygonDataLayer.DataSet.Features); } - [Test] - public void GivenMapPolygonDataLayer_WhenReprojected_ItemChangedFired() - { - // Given - var count = 0; - var mapPolygonData = new MapPolygonData("Test name"); - var mapPolygonDataLayer = new MapPolygonDataLayer(mapPolygonData); - - mapPolygonDataLayer.ItemChanged += (sender, args) => count++; - - // When - mapPolygonDataLayer.Reproject(KnownCoordinateSystems.Geographic.World.WGS1984); - - // Then - Assert.AreEqual(1, count); - } - private static void SetMapPolygonDataTestProperties(MapPolygonData mapPolygonData) { mapPolygonData.Name = "Another test name";