/// <summary> /// Removes the given layer. /// </summary> /// <param name="layer"></param> public bool RemoveLayer(Layer layer) { lock (_layers) { if (!_layers.Remove(layer)) { return false; } } layer.LayerChanged -= new LayerChanged(layer_LayerChanged); // remove event handler. // map has obviously changed here! if (this.MapChanged != null) { this.MapChanged(); } return true; }
/// <summary> /// Called when a layer changed. /// </summary> /// <param name="sender"></param> void layer_LayerChanged(Layer sender) { if (this.MapChanged != null) { this.MapChanged(); } }
/// <summary> /// Adds a layer on top of the existing layers. /// </summary> /// <param name="layer"></param> public void AddLayer(Layer layer) { lock (_layers) { layer.LayerChanged += new LayerChanged(layer_LayerChanged); _layers.Add(layer); } // map has obviously changed here! if (this.MapChanged != null) { this.MapChanged(); } }
/// <summary> /// Inserts a layer. /// </summary> /// <param name="idx"></param> /// <param name="layer"></param> public void InsertLayer(int idx, Layer layer) { lock (_layers) { layer.LayerChanged += new LayerChanged(layer_LayerChanged); _layers.Insert(idx, layer); } // map has obviously changed here! if (this.MapChanged != null) { this.MapChanged(); } }
/// <summary> /// Called when a layer changed. /// </summary> /// <param name="sender"></param> void layer_LayerChanged(Layer sender) { if (this.MapChanged != null) { OsmSharp.Logging.Log.TraceEvent("Map.layer_LayerChanged (Before)", Logging.TraceEventType.Information, "RaiseLayerChanged"); this.MapChanged(); OsmSharp.Logging.Log.TraceEvent("Map.layer_LayerChanged (After)", Logging.TraceEventType.Information, "RaiseLayerChanged"); } }
/// <summary> /// Removes the given layer. /// </summary> /// <param name="layer"></param> public bool RemoveLayer(Layer layer) { if (_layers.Remove(layer)) { layer.LayerChanged -= new LayerChanged(layer_LayerChanged); // remove event handler. return true; } return false; }
/// <summary> /// Inserts a layer. /// </summary> /// <param name="idx"></param> /// <param name="layer"></param> public void InsertLayer(int idx, Layer layer) { layer.LayerChanged += new LayerChanged(layer_LayerChanged); _layers.Insert(idx, layer); }
/// <summary> /// Adds a layer on top of the existing layers. /// </summary> /// <param name="layer"></param> public void AddLayer(Layer layer) { layer.LayerChanged += new LayerChanged(layer_LayerChanged); _layers.Add(layer); }
internal Boolean RemoveLayer(Layer layer) { return _map.RemoveLayer(layer); }