private void UpdateTiles(WmtsTileMatrixSet tileMatrixSet) { var tiles = new List <Tile>(); foreach (var layer in ChildLayers) { layer.UpdateTiles(); tiles.AddRange(layer.Tiles); } var tileSource = TileSource as WmtsTileSource; var sourceName = SourceName; if (tileSource != null && tileMatrixSet != null) { tileSource.TileMatrixSet = tileMatrixSet; if (sourceName != null) { sourceName += "/" + tileMatrixSet.Identifier .Replace(':', '_') .Replace(';', '_') .Replace(',', '_') .Replace('/', '_') .Replace('\\', '_'); } } TileImageLoader.LoadTiles(tiles, tileSource, sourceName); }
private void UpdateTiles() { var newTiles = new List <Tile>(); if (ParentMap != null && TileMatrix != null && TileSource != null) { var maxZoomLevel = Math.Min(TileMatrix.ZoomLevel, MaxZoomLevel); if (maxZoomLevel >= MinZoomLevel) { var minZoomLevel = maxZoomLevel; if (this == ParentMap.MapLayer) // load background tiles { minZoomLevel = Math.Max(TileMatrix.ZoomLevel - MaxBackgroundLevels, MinZoomLevel); } for (var z = minZoomLevel; z <= maxZoomLevel; z++) { var tileSize = 1 << (TileMatrix.ZoomLevel - z); var x1 = (int)Math.Floor((double)TileMatrix.XMin / tileSize); // may be negative var x2 = TileMatrix.XMax / tileSize; var y1 = Math.Max(TileMatrix.YMin / tileSize, 0); var y2 = Math.Min(TileMatrix.YMax / tileSize, (1 << z) - 1); for (var y = y1; y <= y2; y++) { for (var x = x1; x <= x2; x++) { var tile = Tiles.FirstOrDefault(t => t.ZoomLevel == z && t.X == x && t.Y == y); if (tile == null) { tile = new Tile(z, x, y); var equivalentTile = Tiles.FirstOrDefault( t => t.ZoomLevel == z && t.XIndex == tile.XIndex && t.Y == y && t.Image.Source != null); if (equivalentTile != null) { tile.SetImage(equivalentTile.Image.Source, false); // no fade-in animation } } newTiles.Add(tile); } } } } } Tiles = newTiles; Children.Clear(); foreach (var tile in Tiles) { Children.Add(tile.Image); } TileImageLoader.LoadTiles(Tiles, TileSource, SourceName); }
protected virtual void LoadTiles(IEnumerable <Tile> tiles, string cacheName) { TileImageLoader.LoadTiles(tiles, TileSource, cacheName); }