Version 4.17.0: Added support for WMTS

This commit is contained in:
ClemensF 2020-03-21 01:52:17 +01:00
parent b687487be2
commit e06e910126
4 changed files with 204 additions and 173 deletions

View file

@ -9,22 +9,22 @@ namespace MapControl
{
public class WmtsTileSource : TileSource
{
private readonly IList<WmtsTileMatrix> tileMatrixes;
public WmtsTileSource(string uriFormat, IList<WmtsTileMatrix> tileMatrixes)
public WmtsTileSource(string uriFormat)
: base(uriFormat)
{
this.tileMatrixes = tileMatrixes;
}
public WmtsTileMatrixSet TileMatrixSet { get; set; }
public override Uri GetUri(int x, int y, int zoomLevel)
{
Uri uri = null;
if (zoomLevel >= 0 && zoomLevel < tileMatrixes.Count)
if (TileMatrixSet != null && zoomLevel >= 0 && zoomLevel < TileMatrixSet.TileMatrixes.Count)
{
uri = new Uri(UriFormat
.Replace("{TileMatrix}", tileMatrixes[zoomLevel].Identifier)
.Replace("{TileMatrixSet}", TileMatrixSet.Identifier)
.Replace("{TileMatrix}", TileMatrixSet.TileMatrixes[zoomLevel].Identifier)
.Replace("{TileCol}", x.ToString())
.Replace("{TileRow}", y.ToString()));
}