this piece of code broke if we had tiles coming from a tpk in our indexeddb

This commit is contained in:
Javier Abadia 2014-07-16 09:27:59 -07:00
parent 6992c08f3c
commit 552797bf9d

View File

@ -255,20 +255,33 @@ define([
*/
layer.getTilePolygons = function(callback) // callback(Polygon polygon) or callback(null, error)
{
var components, level, col, row, cellId, polygon;
var store = this.offline.store;
var tilingScheme = new TilingScheme(this);
store.getAllTiles(function(url,img,err)
{
if(url)
{
var components = url.split("/");
var level = parseInt(components[ components.length - 3],10);
var col = parseInt(components[ components.length - 2],10);
var row = parseInt(components[ components.length - 1],10);
var cellId = [row,col];
var polygon = tilingScheme.getCellPolygonFromCellId(cellId, level);
//if( level == 15)
callback(polygon);
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]);
}
else
{
components = url.split("/");
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);
}
}
else
{