2025-02-27 18:46:32 +01:00
|
|
|
|
using System;
|
2025-11-29 08:25:18 +01:00
|
|
|
|
using System.Collections.Generic;
|
2020-03-20 18:12:56 +01:00
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
2025-12-02 15:29:45 +01:00
|
|
|
|
public class WmtsTileSource(WmtsTileMatrixSet tileMatrixSet) : TileSource
|
2020-03-20 18:12:56 +01:00
|
|
|
|
{
|
2025-12-02 15:29:45 +01:00
|
|
|
|
private readonly string uriFormat = tileMatrixSet.UriTemplate
|
|
|
|
|
|
.Replace("{TileMatrix}", "{0}")
|
|
|
|
|
|
.Replace("{TileCol}", "{1}")
|
|
|
|
|
|
.Replace("{TileRow}", "{2}");
|
2025-11-29 08:25:18 +01:00
|
|
|
|
|
2025-12-02 15:29:45 +01:00
|
|
|
|
private readonly List<WmtsTileMatrix> tileMatrixes = tileMatrixSet.TileMatrixes;
|
2020-03-21 01:52:17 +01:00
|
|
|
|
|
2025-09-14 21:02:21 +02:00
|
|
|
|
public override Uri GetUri(int zoomLevel, int column, int row)
|
2020-03-20 18:12:56 +01:00
|
|
|
|
{
|
2025-12-02 15:29:45 +01:00
|
|
|
|
return zoomLevel < tileMatrixes.Count
|
|
|
|
|
|
? new Uri(string.Format(uriFormat, tileMatrixes[zoomLevel].Identifier, column, row))
|
|
|
|
|
|
: null;
|
2020-03-20 18:12:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|