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;
|
||||||
using System.Security.Policy;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
#if WPF
|
#if WPF
|
||||||
|
|
|
||||||
|
|
@ -131,12 +131,7 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
else if (UpdateChildLayers(tileMatrixSet))
|
else if (UpdateChildLayers(tileMatrixSet))
|
||||||
{
|
{
|
||||||
var tileSource = new WmtsTileSource
|
var tileSource = new WmtsTileSource(tileMatrixSet, TileUriTemplate);
|
||||||
{
|
|
||||||
UriTemplate = TileUriTemplate,
|
|
||||||
TileMatrixSet = tileMatrixSet
|
|
||||||
};
|
|
||||||
|
|
||||||
var cacheName = SourceName;
|
var cacheName = SourceName;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(cacheName))
|
if (!string.IsNullOrEmpty(cacheName))
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,30 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace MapControl
|
namespace MapControl
|
||||||
{
|
{
|
||||||
public class WmtsTileSource : UriTileSource
|
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)
|
public override Uri GetUri(int zoomLevel, int column, int row)
|
||||||
{
|
{
|
||||||
Uri uri = null;
|
Uri uri = null;
|
||||||
|
|
||||||
if (UriTemplate != null &&
|
if (UriTemplate != null &&
|
||||||
TileMatrixSet != null &&
|
tileMatrixes != null &&
|
||||||
TileMatrixSet.TileMatrixes.Count > zoomLevel)
|
tileMatrixes.Count > zoomLevel)
|
||||||
{
|
{
|
||||||
var uriBuilder = new StringBuilder(UriTemplate);
|
var uriBuilder = new StringBuilder(UriTemplate);
|
||||||
|
|
||||||
uriBuilder.Replace("{TileMatrixSet}", TileMatrixSet.Identifier);
|
uriBuilder.Replace("{TileMatrix}", tileMatrixes[zoomLevel].Identifier);
|
||||||
uriBuilder.Replace("{TileMatrix}", TileMatrixSet.TileMatrixes[zoomLevel].Identifier);
|
|
||||||
uriBuilder.Replace("{TileCol}", column.ToString());
|
uriBuilder.Replace("{TileCol}", column.ToString());
|
||||||
uriBuilder.Replace("{TileRow}", row.ToString());
|
uriBuilder.Replace("{TileRow}", row.ToString());
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue