From ab53a32f1ecea821df8cb187f3fed8e523fd1bbc Mon Sep 17 00:00:00 2001 From: Javier Abadia Date: Wed, 16 Jul 2014 13:22:30 -0700 Subject: [PATCH] fixed show tiles - now we only show tiles that belong to the same basemap --- lib/tiles/offlineTilesEnabler.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/tiles/offlineTilesEnabler.js b/lib/tiles/offlineTilesEnabler.js index aeefcb7..2e20fa7 100644 --- a/lib/tiles/offlineTilesEnabler.js +++ b/lib/tiles/offlineTilesEnabler.js @@ -261,16 +261,15 @@ define([ var tilingScheme = new TilingScheme(this); store.getAllTiles(function(url,img,err) { - if(url) + if(url && url.indexOf(layer.url) == 0) { if(url.indexOf("_alllayers") != -1) { // V101/LAYERS/_alllayers/L01/R0C18C0B10 components = url.split("/"); level = parseInt(components[ components.length - 2].slice(1),10); - // how to extract row and col? - //col = parseInt( components[ components.length -1]); - //row = parseInt( components[ components.length -1]); + col = parseInt( components[ components.length -1].substring(1,5), 16); + row = parseInt( components[ components.length -1].substring(6,10), 16); } else { @@ -278,14 +277,17 @@ define([ level = parseInt(components[ components.length - 3],10); col = parseInt(components[ components.length - 2],10); row = parseInt(components[ components.length - 1],10); - cellId = [row,col]; - polygon = tilingScheme.getCellPolygonFromCellId(cellId, level); - callback(polygon); } + cellId = [row,col]; + polygon = tilingScheme.getCellPolygonFromCellId(cellId, level); + callback(polygon); } else { - callback(null,err); + if(!url) + { + callback(null,err); + } } }); };