From 8b3a12fccf66d1d370a83e95941187be21d52a56 Mon Sep 17 00:00:00 2001 From: ClemensFischer Date: Wed, 29 Oct 2025 22:20:54 +0100 Subject: [PATCH] Simplify SupportedCrsIds --- MapControl/Shared/MapImageLayer.cs | 5 ++++- MapControl/Shared/WmsImageLayer.cs | 13 ++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/MapControl/Shared/MapImageLayer.cs b/MapControl/Shared/MapImageLayer.cs index 042777d6..2871e598 100644 --- a/MapControl/Shared/MapImageLayer.cs +++ b/MapControl/Shared/MapImageLayer.cs @@ -125,7 +125,10 @@ namespace MapControl /// public double LoadingProgress => (double)GetValue(LoadingProgressProperty); - public abstract IReadOnlyCollection SupportedCrsIds { get; } + /// + /// Gets a collection of all CRSs supported by a MapImageLayer. + /// + public IReadOnlyCollection SupportedCrsIds { get; protected set; } protected override void SetParentMap(MapBase map) { diff --git a/MapControl/Shared/WmsImageLayer.cs b/MapControl/Shared/WmsImageLayer.cs index 90d5e815..36010aac 100644 --- a/MapControl/Shared/WmsImageLayer.cs +++ b/MapControl/Shared/WmsImageLayer.cs @@ -73,13 +73,6 @@ namespace MapControl /// public IReadOnlyCollection AvailableLayers { get; private set; } - /// - /// Gets a collection of all CRSs supported by a WMS. - /// - public override IReadOnlyCollection SupportedCrsIds => supportedCrsIds; - - private List supportedCrsIds; - private bool HasLayer => RequestLayers != null || AvailableLayers?.Count > 0 || @@ -120,19 +113,17 @@ namespace MapControl var ns = capabilities.Name.Namespace; var capability = capabilities.Element(ns + "Capability"); - supportedCrsIds = capability + SupportedCrsIds = capability .Descendants(ns + "Layer") .Descendants(ns + "CRS") .Select(e => e.Value) .ToList(); - var layerNames = capability + AvailableLayers = capability .Descendants(ns + "Layer") .Select(e => e.Element(ns + "Name")?.Value) .Where(n => !string.IsNullOrEmpty(n)) .ToList(); - - AvailableLayers = layerNames; } }