mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Updated WmtsTileSource
This commit is contained in:
parent
286926e1ea
commit
2ec4d8fa60
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
#if WPF
|
||||
|
|
|
|||
|
|
@ -131,12 +131,7 @@ namespace MapControl
|
|||
}
|
||||
else if (UpdateChildLayers(tileMatrixSet))
|
||||
{
|
||||
var tileSource = new WmtsTileSource
|
||||
{
|
||||
UriTemplate = TileUriTemplate,
|
||||
TileMatrixSet = tileMatrixSet
|
||||
};
|
||||
|
||||
var tileSource = new WmtsTileSource(tileMatrixSet, TileUriTemplate);
|
||||
var cacheName = SourceName;
|
||||
|
||||
if (!string.IsNullOrEmpty(cacheName))
|
||||
|
|
|
|||
|
|
@ -1,24 +1,30 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace MapControl
|
||||
{
|
||||
public class WmtsTileSource : UriTileSource
|
||||
{
|
||||
public WmtsTileMatrixSet TileMatrixSet { get; set; }
|
||||
private readonly IList<WmtsTileMatrix> tileMatrixes;
|
||||
|
||||
public WmtsTileSource(WmtsTileMatrixSet tileMatrixSet, string uriTemplate)
|
||||
{
|
||||
tileMatrixes = tileMatrixSet.TileMatrixes;
|
||||
UriTemplate = uriTemplate.Replace("{TileMatrixSet}", tileMatrixSet.Identifier);
|
||||
}
|
||||
|
||||
public override Uri GetUri(int zoomLevel, int column, int row)
|
||||
{
|
||||
Uri uri = null;
|
||||
|
||||
if (UriTemplate != null &&
|
||||
TileMatrixSet != null &&
|
||||
TileMatrixSet.TileMatrixes.Count > zoomLevel)
|
||||
tileMatrixes != null &&
|
||||
tileMatrixes.Count > zoomLevel)
|
||||
{
|
||||
var uriBuilder = new StringBuilder(UriTemplate);
|
||||
|
||||
uriBuilder.Replace("{TileMatrixSet}", TileMatrixSet.Identifier);
|
||||
uriBuilder.Replace("{TileMatrix}", TileMatrixSet.TileMatrixes[zoomLevel].Identifier);
|
||||
uriBuilder.Replace("{TileMatrix}", tileMatrixes[zoomLevel].Identifier);
|
||||
uriBuilder.Replace("{TileCol}", column.ToString());
|
||||
uriBuilder.Replace("{TileRow}", row.ToString());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue