Pass the callback scope to getURLasync
This commit is contained in:
@@ -206,8 +206,9 @@ OpenLayers.Layer.ArcIMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
* bounds - {<OpenLayers.Bounds>} A bounds representing the bbox for the
|
* bounds - {<OpenLayers.Bounds>} A bounds representing the bbox for the
|
||||||
* request.
|
* request.
|
||||||
* callback - {Function} Function to call when image url is retrieved.
|
* callback - {Function} Function to call when image url is retrieved.
|
||||||
|
* scope - {Object} The scope of the callback method.
|
||||||
*/
|
*/
|
||||||
getURLasync: function(bounds, callback) {
|
getURLasync: function(bounds, callback, scope) {
|
||||||
bounds = this.adjustBounds(bounds);
|
bounds = this.adjustBounds(bounds);
|
||||||
|
|
||||||
// create an arcxml request to generate the image
|
// create an arcxml request to generate the image
|
||||||
@@ -236,7 +237,7 @@ OpenLayers.Layer.ArcIMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
var axlResp = new OpenLayers.Format.ArcXML();
|
var axlResp = new OpenLayers.Format.ArcXML();
|
||||||
var arcxml = axlResp.read(doc);
|
var arcxml = axlResp.read(doc);
|
||||||
|
|
||||||
callback(this.getUrlOrImage(arcxml.image.output));
|
callback.call(scope, this.getUrlOrImage(arcxml.image.output));
|
||||||
},
|
},
|
||||||
scope: this
|
scope: this
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -170,12 +170,12 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
|||||||
// Asynchronous image requests call the asynchronous getURL method
|
// Asynchronous image requests call the asynchronous getURL method
|
||||||
// on the layer to fetch an image that covers 'this.bounds'.
|
// on the layer to fetch an image that covers 'this.bounds'.
|
||||||
var id = this.asyncRequestId = (this.asyncRequestId || 0) + 1;
|
var id = this.asyncRequestId = (this.asyncRequestId || 0) + 1;
|
||||||
this.layer.getURLasync(this.bounds, OpenLayers.Function.bind(function(url) {
|
this.layer.getURLasync(this.bounds, function(url) {
|
||||||
if (id == this.asyncRequestId) {
|
if (id == this.asyncRequestId) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.initImage();
|
this.initImage();
|
||||||
}
|
}
|
||||||
}, this));
|
}, this);
|
||||||
} else {
|
} else {
|
||||||
// synchronous image requests get the url immediately.
|
// synchronous image requests get the url immediately.
|
||||||
this.url = this.layer.getURL(this.bounds);
|
this.url = this.layer.getURL(this.bounds);
|
||||||
|
|||||||
Reference in New Issue
Block a user