Index: src/Common/SharpMap/Map/Map.cs =================================================================== diff -u -r12d3ca90d930bd544210c41acccb7ef1271a7e8c -r8edbe5e2130c81b456385607891c6ef98928f88e --- src/Common/SharpMap/Map/Map.cs (.../Map.cs) (revision 12d3ca90d930bd544210c41acccb7ef1271a7e8c) +++ src/Common/SharpMap/Map/Map.cs (.../Map.cs) (revision 8edbe5e2130c81b456385607891c6ef98928f88e) @@ -876,6 +876,7 @@ } } + [EditAction] private void CreateCoordinateSystemFromWkt(string value) { if (createCoordinateSystemFromWkt) return; @@ -968,6 +969,7 @@ } } + [EditAction] private void UpdateLayerCoordinateTransformation(ILayer layer) { if (CoordinateSystem == null) @@ -1072,8 +1074,8 @@ throw new NotImplementedException(); case NotifyCollectionChangeAction.Add: - layer1.Map = this; - + SetMapInLayer(layer1); + CheckMapExtends(layer1); UpdateLayerCoordinateTransformation(layer1); @@ -1092,6 +1094,7 @@ } } + [EditAction] private void SetRenderOrderAfterInsert(ILayer layer) { // Group layers are ignored in this code (by design) @@ -1119,6 +1122,7 @@ newLayers.ForEach(l => l.RenderOrder = allLayers.IndexOf(l) + 1); } + [EditAction] private void SetRenderOrderAfterRemove(ILayer layer) { // Group layers are ignored in this code (by design) @@ -1139,6 +1143,12 @@ .ForEach(l => l.RenderOrder -= oldLayers.Count); } + [EditAction] + private void SetMapInLayer(ILayer layer) + { + layer.Map = this; + } + /// /// Zooms map to extends if the added layer is the only layer with valid envelope. ///