/// <summary> /// Zooms map to extends if the added layer is the only layer with valid envelope. /// </summary> /// <param name="layer"></param> private void CheckMapExtends(ILayer layer) { var allVisibleLayersWereEmpty = Layers.Except(new[] { layer }).All(l => l.Envelope.IsNull || !l.IsVisible); if (allVisibleLayersWereEmpty && (layer.Envelope != null && !layer.Envelope.IsNull)) { ZoomToExtents(); } }
/// <summary> /// Zooms map to extends if the added layer is the only layer with valid envelope. /// </summary> /// <param name="layer"></param> private void CheckMapExtends(ILayer layer) { //error.... var allVisibleLayersWereEmpty = Layers.Except(new[] { layer }).All(l => l.Envelope.IsNull || !l.Visible); if (!allVisibleLayersWereEmpty) { return; } var layerEnvelope = layer.Envelope; if (layerEnvelope != null && !layerEnvelope.IsNull) { ZoomToExtents(); } }