diff --git a/MapControl/Shared/ImageTileList.cs b/MapControl/Shared/ImageTileList.cs index 9366fe32..94ecf28b 100644 --- a/MapControl/Shared/ImageTileList.cs +++ b/MapControl/Shared/ImageTileList.cs @@ -5,6 +5,15 @@ namespace MapControl { public class ImageTileList : List { + public ImageTileList() + { + } + + public ImageTileList(ImageTileList source, TileMatrix tileMatrix, int columnCount) + { + FillMatrix(source, tileMatrix.ZoomLevel, tileMatrix.XMin, tileMatrix.YMin, tileMatrix.XMax, tileMatrix.YMax, columnCount); + } + /// /// Adds existing ImageTile from the source collection or newly created ImageTile to fill the specified tile matrix. /// diff --git a/MapControl/Shared/WmtsTileMatrixLayer.cs b/MapControl/Shared/WmtsTileMatrixLayer.cs index f3e23355..abeda5ba 100644 --- a/MapControl/Shared/WmtsTileMatrixLayer.cs +++ b/MapControl/Shared/WmtsTileMatrixLayer.cs @@ -83,14 +83,11 @@ namespace MapControl } TileMatrix = new TileMatrix(TileMatrix.ZoomLevel, xMin, yMin, xMax, yMax); - - var tiles = new ImageTileList(); - tiles.FillMatrix(Tiles, TileMatrix.ZoomLevel, xMin, yMin, xMax, yMax, WmtsTileMatrix.MatrixWidth); - Tiles = tiles; + Tiles = new ImageTileList(Tiles, TileMatrix, WmtsTileMatrix.MatrixWidth); Children.Clear(); - foreach (var tile in tiles) + foreach (var tile in Tiles) { Children.Add(tile.Image); }