From c563abaf7a46953199301ef9933a4491f4dc1562 Mon Sep 17 00:00:00 2001 From: Thomas Hervey Date: Wed, 18 Jul 2018 15:49:04 -0400 Subject: [PATCH] pass dimensions to tile --- modules/services/mapillary.js | 2 +- modules/services/openstreetcam.js | 2 +- modules/services/osm.js | 9 +-------- modules/services/streetside.js | 2 +- modules/util/tile.js | 4 ++-- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/modules/services/mapillary.js b/modules/services/mapillary.js index 93870f94b..db387fd1f 100644 --- a/modules/services/mapillary.js +++ b/modules/services/mapillary.js @@ -84,7 +84,7 @@ function loadTiles(which, url, projection) { var s = projection.scale() * 2 * Math.PI; var currZoom = Math.floor(Math.max(Math.log(s) / Math.log(2) - 8, 0)); - var tiles = geoTile.filterNullIsland(geoTile.getTiles(tileZoom, projection)); + var tiles = geoTile.filterNullIsland(geoTile.getTiles(tileZoom, projection, projection.clipExtent()[1], 0)); geoTile.removeInflightRequests(which, tiles, abortRequest, ',0'); tiles.forEach(function(tile) { diff --git a/modules/services/openstreetcam.js b/modules/services/openstreetcam.js index 98b857670..be2953f16 100644 --- a/modules/services/openstreetcam.js +++ b/modules/services/openstreetcam.js @@ -79,7 +79,7 @@ function loadTiles(which, url, projection) { var s = projection.scale() * 2 * Math.PI, currZoom = Math.floor(Math.max(Math.log(s) / Math.log(2) - 8, 0)); - var tiles = geoTile.filterNullIsland(geoTile.getTiles(tileZoom, projection)); + var tiles = geoTile.filterNullIsland(geoTile.getTiles(tileZoom, projection, projection.clipExtent()[1], 0)); geoTile.removeInflightRequests(which, tiles, abortRequest, ',0'); tiles.forEach(function(tile) { diff --git a/modules/services/osm.js b/modules/services/osm.js index 71f71562f..67a2e29f2 100644 --- a/modules/services/osm.js +++ b/modules/services/osm.js @@ -778,15 +778,8 @@ export default { tilezoom = _tileZoom; } - var s = projection.scale() * 2 * Math.PI; - var z = Math.max(Math.log(s) / Math.log(2) - 8, 0); - var ts = 256 * Math.pow(2, z - tilezoom); - var origin = [ - s / 2 - projection.translate()[0], - s / 2 - projection.translate()[1] - ]; - var tiles = geoTile.filterNullIsland(geoTile.getTiles(_tileZoom, projection)); + var tiles = geoTile.filterNullIsland(geoTile.getTiles(_tileZoom, projection, dimensions, 0)); // remove inflight requests that no longer cover the view.. var hadRequests = !_isEmpty(cache.inflight); diff --git a/modules/services/streetside.js b/modules/services/streetside.js index 591a21172..4252c05a8 100644 --- a/modules/services/streetside.js +++ b/modules/services/streetside.js @@ -94,7 +94,7 @@ function loadTiles(which, url, projection, margin) { var s = projection.scale() * 2 * Math.PI; var currZoom = Math.floor(Math.max(Math.log(s) / Math.log(2) - 8, 0)); - var tiles = geoTile.filterNullIsland(geoTile.getTiles(tileZoom, projection, margin)); + var tiles = geoTile.filterNullIsland(geoTile.getTiles(tileZoom, projection, projection.clipExtent()[1], margin)); tiles.forEach(function (tile) { loadNextTilePage(which, currZoom, url, tile); diff --git a/modules/util/tile.js b/modules/util/tile.js index 78d9a6423..546b4f10a 100644 --- a/modules/util/tile.js +++ b/modules/util/tile.js @@ -71,7 +71,7 @@ export function utilTile() { * Using d3.geo.tiles.js from lib, gets tile extents for each grid tile in a grid created from * an area around (and including) the current map view extents. */ - tile.getTiles = function(tileZoom, projection, margin) { + tile.getTiles = function(tileZoom, projection, dimensions, margin) { // s is the current map scale // z is the 'Level of Detail', or zoom-level, where Level 1 is far from the earth, and Level 23 is close to the ground. // ts ('tile size') here is the formula for determining the width/height of the map in pixels, but with a modification. @@ -88,7 +88,7 @@ export function utilTile() { var tiler = this .scaleExtent([tileZoom, tileZoom]) .scale(s) - .size(projection.clipExtent()[1]) + .size(dimensions) .translate(projection.translate()) .margin(margin || 0); // request nearby tiles so we can connect sequences.