This commit is contained in:
javi 2015-11-06 11:03:19 +01:00
parent c27b2471da
commit 53d5072c4b

View File

@ -39,16 +39,6 @@
NAME: "tileJSON", NAME: "tileJSON",
filterRange: function(attrIndex, min, max) {
this.filter = attrIndex + "=" + min + "," + max;
this.reload()
},
filterExact: function(attrIndex, exact) {
this.filter = attrIndex + "=" + exact
this.reload()
},
/** /**
* return the torque tile encoded in an efficient javascript * return the torque tile encoded in an efficient javascript
* structure: * structure:
@ -259,14 +249,11 @@
var limit_x = Math.pow(2, zoom); var limit_x = Math.pow(2, zoom);
var corrected_x = ((coord.x % limit_x) + limit_x) % limit_x; var corrected_x = ((coord.x % limit_x) + limit_x) % limit_x;
var index = Math.abs(corrected_x + coord.y) % subdomains.length; var index = Math.abs(corrected_x + coord.y) % subdomains.length;
var url = this.tileUrls[(corrected_x + coord.y) % this.tileUrls.length] var url = this.templateUrl
.replace('{x}', corrected_x) .replace('{x}', corrected_x)
.replace('{y}', coord.y) .replace('{y}', coord.y)
.replace('{z}', zoom) .replace('{z}', zoom)
.replace('{s}', subdomains[index]) .replace('{s}', subdomains[index])
if (this.filter) {
url += "?" + this.filter
}
torque.net.get( url , function (data) { torque.net.get( url , function (data) {
if (data && data.responseText) { if (data && data.responseText) {
var rows = JSON.parse(data.responseText); var rows = JSON.parse(data.responseText);
@ -338,7 +325,6 @@
self.options[k] = data[k]; self.options[k] = data[k];
} }
self.templateUrl = data.tiles[0]; self.templateUrl = data.tiles[0];
self.tileUrls = data.tiles;
if (self.templateUrl.indexOf("http") !== 0){ if (self.templateUrl.indexOf("http") !== 0){
self.templateUrl = self.options.tileJSON.substring(0, self.options.tileJSON.lastIndexOf("/") + 1) + self.templateUrl; self.templateUrl = self.options.tileJSON.substring(0, self.options.tileJSON.lastIndexOf("/") + 1) + self.templateUrl;
} }