XAML-Map-Control/MapControl/Shared/WmtsTileSource.cs
2026-04-13 17:14:49 +02:00

21 lines
663 B
C#

using System;
using System.Collections.Generic;
namespace MapControl;
public class WmtsTileSource(WmtsTileMatrixSet tileMatrixSet) : TileSource
{
private readonly string uriFormat = tileMatrixSet.UriTemplate
.Replace("{TileMatrix}", "{0}")
.Replace("{TileCol}", "{1}")
.Replace("{TileRow}", "{2}");
private readonly List<WmtsTileMatrix> tileMatrixes = tileMatrixSet.TileMatrixes;
public override Uri GetUri(int zoomLevel, int column, int row)
{
return zoomLevel < tileMatrixes.Count
? new Uri(string.Format(uriFormat, tileMatrixes[zoomLevel].Identifier, column, row))
: null;
}
}