mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-12 01:44:21 +00:00
Updated WmtsTileSource
This commit is contained in:
parent
286926e1ea
commit
2ec4d8fa60
3 changed files with 12 additions and 12 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue