Tests for UTFGrid tiles.
This commit is contained in:
@@ -62,7 +62,7 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
|
||||
|
||||
/**
|
||||
* APIMethod: destroy
|
||||
* nullify references to prevent circular references and memory leaks
|
||||
* Clean up.
|
||||
*/
|
||||
destroy: function() {
|
||||
this.clear();
|
||||
@@ -82,6 +82,7 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
|
||||
var drawn = OpenLayers.Tile.prototype.draw.apply(this, arguments);
|
||||
if (drawn) {
|
||||
if (this.isLoading) {
|
||||
this.abortLoading();
|
||||
//if we're already loading, send 'reload' instead of 'loadstart'.
|
||||
this.events.triggerEvent("reload");
|
||||
} else {
|
||||
@@ -93,7 +94,7 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
|
||||
if (this.layer.useJSONP) {
|
||||
// Use JSONP method to avoid xbrowser policy
|
||||
var ols = new OpenLayers.Protocol.Script({
|
||||
url: this.url,
|
||||
url: this.url,
|
||||
callback: function(response) {
|
||||
this.isLoading = false;
|
||||
this.events.triggerEvent("loadend");
|
||||
@@ -102,9 +103,10 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
|
||||
scope: this
|
||||
});
|
||||
ols.read();
|
||||
this.request = ols;
|
||||
} else {
|
||||
// Use standard XHR
|
||||
OpenLayers.Request.GET({
|
||||
this.request = OpenLayers.Request.GET({
|
||||
url: this.url,
|
||||
callback: function(response) {
|
||||
this.isLoading = false;
|
||||
@@ -121,9 +123,21 @@ OpenLayers.Tile.UTFGrid = OpenLayers.Class(OpenLayers.Tile, {
|
||||
}
|
||||
return drawn;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: abortLoading
|
||||
* Cancel a pending request.
|
||||
*/
|
||||
abortLoading: function() {
|
||||
if (this.request) {
|
||||
this.request.abort();
|
||||
delete this.request;
|
||||
}
|
||||
this.isLoading = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: parseJSON
|
||||
* Method: parseData
|
||||
* Parse the JSON from a request
|
||||
*
|
||||
* Parameters:
|
||||
|
||||
Reference in New Issue
Block a user