SupportedCrsIds

This commit is contained in:
ClemensFischer 2025-09-19 20:22:10 +02:00
parent 7da0f7f9af
commit 5bba4d6a1b
6 changed files with 11 additions and 11 deletions

View file

@ -22,7 +22,7 @@ namespace MapControl
{ {
Brush MapBackground { get; } Brush MapBackground { get; }
Brush MapForeground { get; } Brush MapForeground { get; }
IReadOnlyCollection<string> SupportedMapProjections { get; } IReadOnlyCollection<string> SupportedCrsIds { get; }
} }
public partial class MapBase public partial class MapBase

View file

@ -127,7 +127,7 @@ namespace MapControl
/// </summary> /// </summary>
public double LoadingProgress => (double)GetValue(LoadingProgressProperty); public double LoadingProgress => (double)GetValue(LoadingProgressProperty);
public abstract IReadOnlyCollection<string> SupportedMapProjections { get; } public abstract IReadOnlyCollection<string> SupportedCrsIds { get; }
protected override void SetParentMap(MapBase map) protected override void SetParentMap(MapBase map)
{ {
@ -189,8 +189,8 @@ namespace MapControl
if (ParentMap != null && if (ParentMap != null &&
ParentMap.ActualWidth > 0d && ParentMap.ActualWidth > 0d &&
ParentMap.ActualHeight > 0d && ParentMap.ActualHeight > 0d &&
SupportedMapProjections != null && SupportedCrsIds != null &&
SupportedMapProjections.Contains(ParentMap.MapProjection.CrsId)) SupportedCrsIds.Contains(ParentMap.MapProjection.CrsId))
{ {
var width = ParentMap.ActualWidth * RelativeImageSize; var width = ParentMap.ActualWidth * RelativeImageSize;
var height = ParentMap.ActualHeight * RelativeImageSize; var height = ParentMap.ActualHeight * RelativeImageSize;

View file

@ -48,7 +48,7 @@ namespace MapControl
Description = "© [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)" Description = "© [OpenStreetMap Contributors](http://www.openstreetmap.org/copyright)"
}; };
public override IReadOnlyCollection<string> SupportedMapProjections { get; } = ["EPSG:3857"]; public override IReadOnlyCollection<string> SupportedCrsIds { get; } = ["EPSG:3857"];
public TileMatrix TileMatrix { get; private set; } public TileMatrix TileMatrix { get; private set; }
@ -117,7 +117,7 @@ namespace MapControl
protected override void UpdateTileLayerAsync(bool resetTiles) protected override void UpdateTileLayerAsync(bool resetTiles)
{ {
if (ParentMap == null || !SupportedMapProjections.Contains(ParentMap.MapProjection.CrsId)) if (ParentMap == null || !SupportedCrsIds.Contains(ParentMap.MapProjection.CrsId))
{ {
TileMatrix = null; TileMatrix = null;
Children.Clear(); Children.Clear();

View file

@ -189,7 +189,7 @@ namespace MapControl
} }
} }
public abstract IReadOnlyCollection<string> SupportedMapProjections { get; } public abstract IReadOnlyCollection<string> SupportedCrsIds { get; }
protected bool IsBaseMapLayer => parentMap != null && parentMap.Children.Count > 0 && parentMap.Children[0] == this; protected bool IsBaseMapLayer => parentMap != null && parentMap.Children.Count > 0 && parentMap.Children[0] == this;

View file

@ -81,7 +81,7 @@ namespace MapControl
/// <summary> /// <summary>
/// Gets a collection of all CRSs supported by a WMS. /// Gets a collection of all CRSs supported by a WMS.
/// </summary> /// </summary>
public override IReadOnlyCollection<string> SupportedMapProjections => mapProjections; public override IReadOnlyCollection<string> SupportedCrsIds => supportedCrsIds;
/// <summary> /// <summary>
/// Loads an XElement from the URL returned by GetCapabilitiesRequestUri(). /// Loads an XElement from the URL returned by GetCapabilitiesRequestUri().
@ -342,7 +342,7 @@ namespace MapControl
return uri.Replace(" ", "%20"); return uri.Replace(" ", "%20");
} }
private List<string> mapProjections; private List<string> supportedCrsIds;
private async void OnLoaded(object sender, RoutedEventArgs e) private async void OnLoaded(object sender, RoutedEventArgs e)
{ {
@ -357,7 +357,7 @@ namespace MapControl
var ns = capabilities.Name.Namespace; var ns = capabilities.Name.Namespace;
var capability = capabilities.Element(ns + "Capability"); var capability = capabilities.Element(ns + "Capability");
mapProjections = capability supportedCrsIds = capability
.Element(ns + "Layer") .Element(ns + "Layer")
.Descendants(ns + "CRS") .Descendants(ns + "CRS")
.Select(e => e.Value) .Select(e => e.Value)

View file

@ -76,7 +76,7 @@ namespace MapControl
/// <summary> /// <summary>
/// Gets a collection of all CRSs supported by a WMTS. /// Gets a collection of all CRSs supported by a WMTS.
/// </summary> /// </summary>
public override IReadOnlyCollection<string> SupportedMapProjections => TileMatrixSets.Keys; public override IReadOnlyCollection<string> SupportedCrsIds => TileMatrixSets.Keys;
protected IEnumerable<WmtsTileMatrixLayer> ChildLayers => Children.Cast<WmtsTileMatrixLayer>(); protected IEnumerable<WmtsTileMatrixLayer> ChildLayers => Children.Cast<WmtsTileMatrixLayer>();