protected internal void OnLayerRemoved() { if (LayerRemoved != null) { LayerRemoved.Invoke(this, EventArgs.Empty); } }
/// <summary> /// Fires the LayerRemoved event. /// </summary> /// <param name="item">Layer that was removed.</param> protected virtual void OnLayerRemoved(T item) { if (EventsSuspended) { return; } LayerRemoved?.Invoke(this, new LayerEventArgs(item)); }
/// <summary> /// 移除图层 /// </summary> /// <param name="layer">图层</param> public void RemoveLayer(Layer layer) { int index = _Layers.IndexOf(layer); _Layers.Remove(layer); _DataSet.Tables.Remove(layer.Records); _TreeNode.Nodes.Remove(layer.Node); LayerRemoved?.Invoke(this, layer); MapPerformaceChanged?.Invoke(this);//重绘一级地图 }
private async Task RemoveLayer(VectorLayer vectorLayer) { vectorLayer.PropertyChanged -= OnVectorLayerPropertyChanged; LayerRemoved?.Invoke(vectorLayer); await vectorLayer.DisposeAsync(); if (Contains(vectorLayer)) { Remove(vectorLayer); } }
/// <summary> /// Removes a layer that is at the specified index /// </summary> /// <param name="layerIndex">The index of the layer to remove</param> /// <param name="dispose">Whether to dispose of the layer that was removed</param> public void RemoveLayer(int layerIndex, bool dispose = true) { IFrameLayer layer = _frame.GetLayerAt(layerIndex); BeforeLayerRemoved?.Invoke(this, new LayerControllerLayerRemovedEventArgs(layer)); _frame.RemoveLayerAt(layerIndex, dispose); // Normalize active layer _activeLayerIndex = ActiveLayerIndex; LayerRemoved?.Invoke(this, new LayerControllerLayerRemovedEventArgs(layer)); }
private void btDel_Click(object Sender, System.EventArgs E) { if (selectedLayerControl == null) { return; } LayerRemoved?.Invoke(selectedLayerControl); int layerIndex = flpLayers.Controls.IndexOf(selectedLayerControl); flpLayers.Height -= selectedLayerControl.Height + 6; flpLayers.Controls.Remove(selectedLayerControl); int currentIndex = 0; foreach (LayerControl lc in flpLayers.Controls) { if (layerIndex <= currentIndex) { LayerIndexChanged?.Invoke(lc.LayerName, currentIndex); } currentIndex++; } selectedLayerControl = null; Refresh(); }
/// <summary> /// Occurs when removing a layer. This also fires the LayerRemoved event. /// </summary> /// <param name="sender">Sender that raised the event.</param> /// <param name="e">The event args.</param> protected virtual void OnLayerRemoved(object sender, LayerEventArgs e) { LayerRemoved?.Invoke(sender, e); }
private void OnLayerRemoved(ILayer layer) { LayerRemoved?.Invoke(layer); }