Get rid of overviewer.gmap, move code into util
This commit is contained in:
@@ -86,40 +86,3 @@ overviewer.classes = {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
overviewer.gmap = {
|
||||
|
||||
/**
|
||||
* Generate a function to get the path to a tile at a particular location
|
||||
* and zoom level.
|
||||
*
|
||||
* @param string path
|
||||
* @param string pathBase
|
||||
* @param string pathExt
|
||||
*/
|
||||
'getTileUrlGenerator': function(path, pathBase, pathExt) {
|
||||
return function(o) {
|
||||
var url = path;
|
||||
var zoom = o.z;
|
||||
var urlBase = ( pathBase ? pathBase : '' );
|
||||
if(o.x < 0 || o.x >= Math.pow(2, zoom) ||
|
||||
o.y < 0 || o.y >= Math.pow(2, zoom)) {
|
||||
url += '/blank';
|
||||
} else if(zoom === 0) {
|
||||
url += '/base';
|
||||
} else {
|
||||
for(var z = zoom - 1; z >= 0; --z) {
|
||||
var x = Math.floor(o.x / Math.pow(2, z)) % 2;
|
||||
var y = Math.floor(o.y / Math.pow(2, z)) % 2;
|
||||
url += '/' + (x + 2 * y);
|
||||
}
|
||||
}
|
||||
url = url + '.' + pathExt;
|
||||
if(typeof overviewerConfig.map.cacheTag !== 'undefined') {
|
||||
url += '?c=' + overviewerConfig.map.cacheTag;
|
||||
}
|
||||
return(urlBase + url);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user