diff --git a/MapControl/Shared/MapTileLayer.cs b/MapControl/Shared/MapTileLayer.cs index 7da636b8..451f9ace 100644 --- a/MapControl/Shared/MapTileLayer.cs +++ b/MapControl/Shared/MapTileLayer.cs @@ -115,6 +115,20 @@ namespace MapControl return finalSize; } + protected override void UpdateRenderTransform() + { + if (TileMatrix != null) + { + // Tile matrix origin in pixels. + // + var tileMatrixOrigin = new Point(TileSize * TileMatrix.XMin, TileSize * TileMatrix.YMin); + var tileMatrixScale = MapBase.ZoomLevelToScale(TileMatrix.ZoomLevel); + + ((MatrixTransform)RenderTransform).Matrix = + ParentMap.ViewTransform.GetTileLayerTransform(tileMatrixScale, MapTopLeft, tileMatrixOrigin); + } + } + protected override void UpdateTileCollection(bool reset) { if (ParentMap == null || !SupportedCrsIds.Contains(ParentMap.MapProjection.CrsId)) @@ -132,20 +146,6 @@ namespace MapControl } } - protected override void UpdateRenderTransform() - { - if (TileMatrix != null) - { - // Tile matrix origin in pixels. - // - var tileMatrixOrigin = new Point(TileSize * TileMatrix.XMin, TileSize * TileMatrix.YMin); - var tileMatrixScale = MapBase.ZoomLevelToScale(TileMatrix.ZoomLevel); - - ((MatrixTransform)RenderTransform).Matrix = - ParentMap.ViewTransform.GetTileLayerTransform(tileMatrixScale, MapTopLeft, tileMatrixOrigin); - } - } - private bool SetTileMatrix() { // Add 0.001 to avoid rounding issues. diff --git a/MapControl/Shared/WmtsTileLayer.cs b/MapControl/Shared/WmtsTileLayer.cs index 5c5145ea..627b56f0 100644 --- a/MapControl/Shared/WmtsTileLayer.cs +++ b/MapControl/Shared/WmtsTileLayer.cs @@ -100,6 +100,14 @@ namespace MapControl return finalSize; } + protected override void UpdateRenderTransform() + { + foreach (var layer in ChildLayers) + { + layer.UpdateRenderTransform(ParentMap.ViewTransform); + } + } + protected override void UpdateTileCollection(bool reset) { // reset parameter is ignored here because it is always false. @@ -133,14 +141,6 @@ namespace MapControl } } - protected override void UpdateRenderTransform() - { - foreach (var layer in ChildLayers) - { - layer.UpdateRenderTransform(ParentMap.ViewTransform); - } - } - private bool UpdateChildLayers(WmtsTileMatrixSet tileMatrixSet) { // Multiply scale by 1.001 to avoid rounding issues.