Index: src/Common/SharpMap/Layers/GroupLayer.cs =================================================================== diff -u -r8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9 -r4874aa2ad39e53fa0bf2fadc1b6bdb3525daeff5 --- src/Common/SharpMap/Layers/GroupLayer.cs (.../GroupLayer.cs) (revision 8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9) +++ src/Common/SharpMap/Layers/GroupLayer.cs (.../GroupLayer.cs) (revision 4874aa2ad39e53fa0bf2fadc1b6bdb3525daeff5) @@ -79,7 +79,7 @@ switch (e.Action) { case NotifyCollectionChangeAction.Add: //set map property for layers being added - SetMapInLayer((ILayer) e.Item); + ((ILayer) e.Item).Map = Map; ((ILayer) e.Item).RenderRequired = true; break; case NotifyCollectionChangeAction.Remove: @@ -90,12 +90,6 @@ } } - [EditAction] - private void SetMapInLayer(ILayer layer) - { - layer.Map = Map; - } - void LayersCollectionChanging(object sender, NotifyCollectionChangingEventArgs e) { // performance @@ -106,7 +100,10 @@ if (sender == layers) //only for own layer collection { - CheckIfLayersIsMutableOrThrow(); + if (LayersReadOnly) + { + throw new InvalidOperationException("It is not allowed to add or remove layers from a grouplayer that has a read-only layers collection"); + } } if (CollectionChanging != null) @@ -115,16 +112,6 @@ } } - [EditAction] //a bit of a hack, not strictly an edit action - private void CheckIfLayersIsMutableOrThrow() - { - if (LayersReadOnly) - { - throw new InvalidOperationException( - "It is not allowed to add or remove layers from a grouplayer that has a read-only layers collection"); - } - } - [NoNotifyPropertyChange] public override bool RenderRequired { @@ -188,15 +175,6 @@ } } - [EditAction] - private void AfterMapSet() - { - foreach (ILayer layer in Layers) - { - layer.Map = Map; - } - } - private IEventedList layers; /// @@ -209,7 +187,10 @@ if (!isMapInitialized) { isMapInitialized = true; - AfterMapSet(); + foreach (ILayer layer in Layers) + { + layer.Map = Map; + } } return layers; Index: src/Common/SharpMap/Layers/Layer.cs =================================================================== diff -u -rd505e5545e25721aee2dfb60bc2a27ab1878a0ad -r4874aa2ad39e53fa0bf2fadc1b6bdb3525daeff5 --- src/Common/SharpMap/Layers/Layer.cs (.../Layer.cs) (revision d505e5545e25721aee2dfb60bc2a27ab1878a0ad) +++ src/Common/SharpMap/Layers/Layer.cs (.../Layer.cs) (revision 4874aa2ad39e53fa0bf2fadc1b6bdb3525daeff5) @@ -735,7 +735,6 @@ UpdateCoordinateTransformation(); } - [EditAction] protected void UpdateCoordinateTransformation() { if (map == null) @@ -1112,20 +1111,14 @@ { labelLayer = value; - AfterLabelLayerSet(); + if (labelLayer != null) + { + labelLayer.Parent = this; + labelLayer.Map = map; + } } } - [EditAction] - private void AfterLabelLayerSet() - { - if (labelLayer != null) - { - labelLayer.Parent = this; - labelLayer.Map = map; - } - } - #region IDisposable Members ///