Simplify SupportedCrsIds

This commit is contained in:
ClemensFischer 2025-10-29 22:20:54 +01:00
parent ce7c33f6e4
commit 8b3a12fccf
2 changed files with 6 additions and 12 deletions

View file

@ -125,7 +125,10 @@ namespace MapControl
/// </summary>
public double LoadingProgress => (double)GetValue(LoadingProgressProperty);
public abstract IReadOnlyCollection<string> SupportedCrsIds { get; }
/// <summary>
/// Gets a collection of all CRSs supported by a MapImageLayer.
/// </summary>
public IReadOnlyCollection<string> SupportedCrsIds { get; protected set; }
protected override void SetParentMap(MapBase map)
{

View file

@ -73,13 +73,6 @@ namespace MapControl
/// </summary>
public IReadOnlyCollection<string> AvailableLayers { get; private set; }
/// <summary>
/// Gets a collection of all CRSs supported by a WMS.
/// </summary>
public override IReadOnlyCollection<string> SupportedCrsIds => supportedCrsIds;
private List<string> 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;
}
}