Index: Core/Common/src/Core.Common.BaseDelftTools/Core.Common.BaseDelftTools.csproj
===================================================================
diff -u -r5680822085007cd5f29b138846f27b523b39c340 -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/Common/src/Core.Common.BaseDelftTools/Core.Common.BaseDelftTools.csproj (.../Core.Common.BaseDelftTools.csproj) (revision 5680822085007cd5f29b138846f27b523b39c340)
+++ Core/Common/src/Core.Common.BaseDelftTools/Core.Common.BaseDelftTools.csproj (.../Core.Common.BaseDelftTools.csproj) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -94,6 +94,7 @@
+
Index: Core/Common/src/Core.Common.BaseDelftTools/Observable.cs
===================================================================
diff -u
--- Core/Common/src/Core.Common.BaseDelftTools/Observable.cs (revision 0)
+++ Core/Common/src/Core.Common.BaseDelftTools/Observable.cs (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -0,0 +1,40 @@
+using System.Collections.Generic;
+
+namespace Core.Common.BaseDelftTools
+{
+ public class Observable : IObservable
+ {
+ private readonly IList observers = new List();
+
+ ///
+ /// Attach an to this . Changes in the will notify the
+ /// .
+ ///
+ /// The to notify on changes.
+ public void Attach(IObserver observer)
+ {
+ observers.Add(observer);
+ }
+
+ ///
+ /// Detach an from this . Changes in the will no longer
+ /// notify the .
+ ///
+ /// The to no longer notify on changes.
+ public void Detach(IObserver observer)
+ {
+ observers.Remove(observer);
+ }
+
+ ///
+ /// Notifies all the observers that have been currently attached to this .
+ ///
+ public void NotifyObservers()
+ {
+ foreach (var observer in observers)
+ {
+ observer.UpdateObserver();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Core/GIS/src/Core.GIS.SharpMap.Extensions/Core.GIS.SharpMap.Extensions.csproj
===================================================================
diff -u -rc8dfbd9f64e9ecbf87650b3f2a0eb1566247ff21 -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/GIS/src/Core.GIS.SharpMap.Extensions/Core.GIS.SharpMap.Extensions.csproj (.../Core.GIS.SharpMap.Extensions.csproj) (revision c8dfbd9f64e9ecbf87650b3f2a0eb1566247ff21)
+++ Core/GIS/src/Core.GIS.SharpMap.Extensions/Core.GIS.SharpMap.Extensions.csproj (.../Core.GIS.SharpMap.Extensions.csproj) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -120,6 +120,10 @@
+
+ {82B61D20-FD4B-49BE-9252-5BF6E3EE4666}
+ Core.Common.BaseDelftTools
+
{F49BD8B2-332A-4C91-A196-8CCE0A2C7D98}
Core.Common.Utils
Index: Core/GIS/src/Core.GIS.SharpMap.UI/Core.GIS.SharpMap.UI.csproj
===================================================================
diff -u -ra950714ad9510756331d862aa35695fa0b2ed03b -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/GIS/src/Core.GIS.SharpMap.UI/Core.GIS.SharpMap.UI.csproj (.../Core.GIS.SharpMap.UI.csproj) (revision a950714ad9510756331d862aa35695fa0b2ed03b)
+++ Core/GIS/src/Core.GIS.SharpMap.UI/Core.GIS.SharpMap.UI.csproj (.../Core.GIS.SharpMap.UI.csproj) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -137,6 +137,10 @@
+
+ {82B61D20-FD4B-49BE-9252-5BF6E3EE4666}
+ Core.Common.BaseDelftTools
+
{F49BD8B2-332A-4C91-A196-8CCE0A2C7D98}
Core.Common.Utils
Index: Core/GIS/src/Core.GIS.SharpMap/Core.GIS.SharpMap.csproj
===================================================================
diff -u -ra950714ad9510756331d862aa35695fa0b2ed03b -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/GIS/src/Core.GIS.SharpMap/Core.GIS.SharpMap.csproj (.../Core.GIS.SharpMap.csproj) (revision a950714ad9510756331d862aa35695fa0b2ed03b)
+++ Core/GIS/src/Core.GIS.SharpMap/Core.GIS.SharpMap.csproj (.../Core.GIS.SharpMap.csproj) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -240,6 +240,10 @@
+
+ {82B61D20-FD4B-49BE-9252-5BF6E3EE4666}
+ Core.Common.BaseDelftTools
+
{F49BD8B2-332A-4C91-A196-8CCE0A2C7D98}
Core.Common.Utils
Index: Core/GIS/src/Core.GIS.SharpMap/Layers/Layer.cs
===================================================================
diff -u -r9f01c4daf5b7af6549045ed6ac404d18419c2555 -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/GIS/src/Core.GIS.SharpMap/Layers/Layer.cs (.../Layer.cs) (revision 9f01c4daf5b7af6549045ed6ac404d18419c2555)
+++ Core/GIS/src/Core.GIS.SharpMap/Layers/Layer.cs (.../Layer.cs) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -22,6 +22,7 @@
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
+using Core.Common.BaseDelftTools;
using Core.Common.Utils.Aop;
using Core.Common.Utils.Aop.Markers;
using Core.Common.Utils.Diagnostics;
@@ -717,6 +718,7 @@
}
quadTreeQuadLayers.Clear();
+ (map as IObservable).NotifyObservers();
}
private void RemoveQuadTreeEnvelopesLayer()
@@ -728,6 +730,7 @@
map.Layers.Remove(quadTreeEnvelopesLayer);
quadTreeEnvelopesLayer = null;
+ (map as IObservable).NotifyObservers();
}
// quad tree layers are used for debugging purposes
Index: Core/GIS/src/Core.GIS.SharpMap/Map/Map.cs
===================================================================
diff -u -r9f01c4daf5b7af6549045ed6ac404d18419c2555 -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/GIS/src/Core.GIS.SharpMap/Map/Map.cs (.../Map.cs) (revision 9f01c4daf5b7af6549045ed6ac404d18419c2555)
+++ Core/GIS/src/Core.GIS.SharpMap/Map/Map.cs (.../Map.cs) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -22,6 +22,7 @@
using System.Drawing.Imaging;
using System.Globalization;
using System.Linq;
+using Core.Common.BaseDelftTools;
using Core.Common.Utils;
using Core.Common.Utils.Aop;
using Core.Common.Utils.Aop.Markers;
@@ -82,7 +83,7 @@
///
[Entity(FireOnCollectionChange = false)]
//[Serializable]
- public class Map : IDisposable, INotifyCollectionChange, IMap
+ public class Map : Observable, IDisposable, INotifyCollectionChange, IMap
{
///
/// When layer render time is less than this - image will not be cached, increase this parameter when you get memory leaks.
@@ -744,6 +745,7 @@
foreach (ILayer layer in Layers)
{
clone.Layers.Add((ILayer) layer.Clone());
+ clone.NotifyObservers();
}
return clone;
@@ -788,6 +790,7 @@
}
ReplacingLayer = false;
+ NotifyObservers();
}
private void UpdateDimensions()
Index: Core/GIS/test/Core.GIS.SharpMap.Extensions.Tests/Core.GIS.SharpMap.Extensions.Tests.csproj
===================================================================
diff -u -rc4613d99539ce31999b3cb4c22a359a248d82919 -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/GIS/test/Core.GIS.SharpMap.Extensions.Tests/Core.GIS.SharpMap.Extensions.Tests.csproj (.../Core.GIS.SharpMap.Extensions.Tests.csproj) (revision c4613d99539ce31999b3cb4c22a359a248d82919)
+++ Core/GIS/test/Core.GIS.SharpMap.Extensions.Tests/Core.GIS.SharpMap.Extensions.Tests.csproj (.../Core.GIS.SharpMap.Extensions.Tests.csproj) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -89,6 +89,10 @@
+
+ {82B61D20-FD4B-49BE-9252-5BF6E3EE4666}
+ Core.Common.BaseDelftTools
+
{F49BD8B2-332A-4C91-A196-8CCE0A2C7D98}
Core.Common.Utils
Index: Core/GIS/test/Core.GIS.SharpMap.Tests/Core.GIS.SharpMap.Tests.csproj
===================================================================
diff -u -ra950714ad9510756331d862aa35695fa0b2ed03b -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/GIS/test/Core.GIS.SharpMap.Tests/Core.GIS.SharpMap.Tests.csproj (.../Core.GIS.SharpMap.Tests.csproj) (revision a950714ad9510756331d862aa35695fa0b2ed03b)
+++ Core/GIS/test/Core.GIS.SharpMap.Tests/Core.GIS.SharpMap.Tests.csproj (.../Core.GIS.SharpMap.Tests.csproj) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -135,6 +135,10 @@
+
+ {82B61D20-FD4B-49BE-9252-5BF6E3EE4666}
+ Core.Common.BaseDelftTools
+
{F49BD8B2-332A-4C91-A196-8CCE0A2C7D98}
Core.Common.Utils
@@ -175,7 +179,7 @@
{0A82E7D2-26F8-4A30-9787-7EEABCD7F470}
Core.GIS.SharpMapTestUtils
-
+
{EFA25023-CF6A-4FF7-8C42-B24D7F9509E1}
Core.Common.TestUtils
Index: Core/GIS/test/Core.GIS.SharpMap.UI.Tests/Core.GIS.SharpMap.UI.Tests.csproj
===================================================================
diff -u -ra950714ad9510756331d862aa35695fa0b2ed03b -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/GIS/test/Core.GIS.SharpMap.UI.Tests/Core.GIS.SharpMap.UI.Tests.csproj (.../Core.GIS.SharpMap.UI.Tests.csproj) (revision a950714ad9510756331d862aa35695fa0b2ed03b)
+++ Core/GIS/test/Core.GIS.SharpMap.UI.Tests/Core.GIS.SharpMap.UI.Tests.csproj (.../Core.GIS.SharpMap.UI.Tests.csproj) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -86,6 +86,10 @@
+
+ {82B61D20-FD4B-49BE-9252-5BF6E3EE4666}
+ Core.Common.BaseDelftTools
+
{A3C9DF74-978A-44B1-B55D-A72AC4221E3A}
Core.GIS.SharpMap.Api
@@ -122,7 +126,7 @@
{C83777FC-AABB-47D9-911F-D76255D4D541}
Core.GIS.SharpMap
-
+
{EFA25023-CF6A-4FF7-8C42-B24D7F9509E1}
Core.Common.TestUtils
Index: Core/GIS/test/Core.GIS.SharpMap.UI.Tests/Tools/SelectToolTest.cs
===================================================================
diff -u -r9f01c4daf5b7af6549045ed6ac404d18419c2555 -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/GIS/test/Core.GIS.SharpMap.UI.Tests/Tools/SelectToolTest.cs (.../SelectToolTest.cs) (revision 9f01c4daf5b7af6549045ed6ac404d18419c2555)
+++ Core/GIS/test/Core.GIS.SharpMap.UI.Tests/Tools/SelectToolTest.cs (.../SelectToolTest.cs) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -106,6 +106,7 @@
selectTool.Select(featureProvider.Features.Cast());
mapControl.Map.Layers.Remove(groupLayer);
+ mapControl.Map.NotifyObservers();
selectTool.Selection
.Should("selection is cleared on layer remove").Be.Empty();
Index: Core/GIS/test/Core.GIS.SharpMapTestUtils/Core.GIS.SharpMapTestUtils.csproj
===================================================================
diff -u -ra950714ad9510756331d862aa35695fa0b2ed03b -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/GIS/test/Core.GIS.SharpMapTestUtils/Core.GIS.SharpMapTestUtils.csproj (.../Core.GIS.SharpMapTestUtils.csproj) (revision a950714ad9510756331d862aa35695fa0b2ed03b)
+++ Core/GIS/test/Core.GIS.SharpMapTestUtils/Core.GIS.SharpMapTestUtils.csproj (.../Core.GIS.SharpMapTestUtils.csproj) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -69,7 +69,11 @@
-
+
+ {82B61D20-FD4B-49BE-9252-5BF6E3EE4666}
+ Core.Common.BaseDelftTools
+
+
{EFA25023-CF6A-4FF7-8C42-B24D7F9509E1}
Core.Common.TestUtils
Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Commands/MapAddWmsLayerCommand.cs
===================================================================
diff -u -ra950714ad9510756331d862aa35695fa0b2ed03b -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Commands/MapAddWmsLayerCommand.cs (.../MapAddWmsLayerCommand.cs) (revision a950714ad9510756331d862aa35695fa0b2ed03b)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Commands/MapAddWmsLayerCommand.cs (.../MapAddWmsLayerCommand.cs) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -40,6 +40,7 @@
layer.SetImageFormat(layer.OutputFormats[0]);
map.Layers.Add(layer);
+ map.NotifyObservers();
}
catch (Exception ex)
{
Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapLayerTreeViewNodePresenter.cs
===================================================================
diff -u -ra950714ad9510756331d862aa35695fa0b2ed03b -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapLayerTreeViewNodePresenter.cs (.../MapLayerTreeViewNodePresenter.cs) (revision a950714ad9510756331d862aa35695fa0b2ed03b)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapLayerTreeViewNodePresenter.cs (.../MapLayerTreeViewNodePresenter.cs) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -124,6 +124,7 @@
else if (sourceMap != null)
{
sourceMap.Layers.Remove((ILayer) item);
+ sourceMap.NotifyObservers();
}
else
{
Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapLegendView.cs
===================================================================
diff -u -r9f01c4daf5b7af6549045ed6ac404d18419c2555 -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapLegendView.cs (.../MapLegendView.cs) (revision 9f01c4daf5b7af6549045ed6ac404d18419c2555)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapLegendView.cs (.../MapLegendView.cs) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -32,7 +32,7 @@
private Map map;
private bool disableGuiSelectionSync;
private string ddbDatasetString = "Delft Dashboard Dataset";
-
+
public MapLegendView(IGui gui)
{
InitializeComponent();
@@ -377,6 +377,7 @@
}
map.Layers.Add(layer);
+ map.NotifyObservers();
}
private void RemoveLayer(ILayer layer)
@@ -393,6 +394,7 @@
var disposableLayer = layer as IDisposable;
disposableLayer.Dispose();
}
+ map.NotifyObservers();
}
private void ButtonRemoveLayerClick(object sender, EventArgs e)
@@ -517,6 +519,7 @@
private void AddLayergroupToolStripMenuItemClick(object sender, EventArgs e)
{
map.Layers.Add(new GroupLayer("New group"));
+ map.NotifyObservers();
}
private void ContextMenuMapVisibleChanged(object sender, EventArgs e)
Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapTreeViewNodePresenter.cs
===================================================================
diff -u -ra950714ad9510756331d862aa35695fa0b2ed03b -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapTreeViewNodePresenter.cs (.../MapTreeViewNodePresenter.cs) (revision a950714ad9510756331d862aa35695fa0b2ed03b)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapTreeViewNodePresenter.cs (.../MapTreeViewNodePresenter.cs) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -89,6 +89,7 @@
if (removed)
{
target.Layers.Insert(position, layer);
+ target.NotifyObservers();
}
}
}
Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/ProjectItemMapView.cs
===================================================================
diff -u -ra950714ad9510756331d862aa35695fa0b2ed03b -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/ProjectItemMapView.cs (.../ProjectItemMapView.cs) (revision a950714ad9510756331d862aa35695fa0b2ed03b)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/ProjectItemMapView.cs (.../ProjectItemMapView.cs) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -358,6 +358,8 @@
{
MapView.Map.ZoomToExtents();
}
+
+ MapView.Map.NotifyObservers();
}
private static IEnumerable> CreateLayerByPathLookup(ILayer layer, string path)
Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/NodePresenters/MapProjectTreeViewNodePresenter.cs
===================================================================
diff -u -ra950714ad9510756331d862aa35695fa0b2ed03b -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/NodePresenters/MapProjectTreeViewNodePresenter.cs (.../MapProjectTreeViewNodePresenter.cs) (revision a950714ad9510756331d862aa35695fa0b2ed03b)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/NodePresenters/MapProjectTreeViewNodePresenter.cs (.../MapProjectTreeViewNodePresenter.cs) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -47,17 +47,11 @@
if (item is ILayer)
{
- var sourceMap = sourceParentNodeData as Map;
- IGroupLayer sourceGroupLayer = null;
- if (sourceMap == null)
- {
- sourceGroupLayer = sourceParentNodeData as IGroupLayer;
- }
-
var layer = (ILayer) item;
target.Layers.Remove(layer); // only changing position of layer within map
target.Layers.Insert(position, layer);
+ target.NotifyObservers();
}
}
Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/SharpMapGisGuiPlugin.cs
===================================================================
diff -u -r9f01c4daf5b7af6549045ed6ac404d18419c2555 -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/SharpMapGisGuiPlugin.cs (.../SharpMapGisGuiPlugin.cs) (revision 9f01c4daf5b7af6549045ed6ac404d18419c2555)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/SharpMapGisGuiPlugin.cs (.../SharpMapGisGuiPlugin.cs) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -431,6 +431,8 @@
map.Layers.Add(layer);
}
}
+
+ map.NotifyObservers();
}
public override IEnumerable GetPersistentAssemblies()
Index: Core/Plugins/src/Core.Plugins.SharpMapGis/MapDependencyResolver.cs
===================================================================
diff -u -ra950714ad9510756331d862aa35695fa0b2ed03b -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/Plugins/src/Core.Plugins.SharpMapGis/MapDependencyResolver.cs (.../MapDependencyResolver.cs) (revision a950714ad9510756331d862aa35695fa0b2ed03b)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis/MapDependencyResolver.cs (.../MapDependencyResolver.cs) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -29,6 +29,7 @@
}
}
}
+ map.NotifyObservers();
}
private static IEnumerable GetMapLayersForData(Map map, object value)
Index: Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/Forms/MapViewTest.cs
===================================================================
diff -u -ra950714ad9510756331d862aa35695fa0b2ed03b -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/Forms/MapViewTest.cs (.../MapViewTest.cs) (revision a950714ad9510756331d862aa35695fa0b2ed03b)
+++ Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/Forms/MapViewTest.cs (.../MapViewTest.cs) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -137,6 +137,7 @@
}
mapView.Map.Layers.Add(layer);
+ mapView.Map.NotifyObservers();
});
}, layer);
Index: Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/SharpMapGisPluginGuiIntegrationTest.cs
===================================================================
diff -u -r9f01c4daf5b7af6549045ed6ac404d18419c2555 -reb012559c6dd84e85838dd827a99ea0b858bffd8
--- Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/SharpMapGisPluginGuiIntegrationTest.cs (.../SharpMapGisPluginGuiIntegrationTest.cs) (revision 9f01c4daf5b7af6549045ed6ac404d18419c2555)
+++ Core/Plugins/test/Core.Plugins.SharpMapGis.Tests/SharpMapGisPluginGuiIntegrationTest.cs (.../SharpMapGisPluginGuiIntegrationTest.cs) (revision eb012559c6dd84e85838dd827a99ea0b858bffd8)
@@ -68,6 +68,7 @@
Name = "Map"
};
map.Layers.Add(layer);
+ map.NotifyObservers();
gui.Application.Project.Items.Add(map);