Merge pull request #184 from fredj/get-url-async
Change getUrlAsync parameters. r=ahocevar
This commit is contained in:
@@ -205,12 +205,10 @@ OpenLayers.Layer.ArcIMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
* Parameters:
|
||||
* bounds - {<OpenLayers.Bounds>} A bounds representing the bbox for the
|
||||
* request.
|
||||
* scope - {Object} The scope of the callback method.
|
||||
* prop - {String} The name of the property in the scoped object to
|
||||
* recieve the image url.
|
||||
* callback - {Function} Function to call when image url is retrieved.
|
||||
* scope - {Object} The scope of the callback method.
|
||||
*/
|
||||
getURLasync: function(bounds, scope, prop, callback) {
|
||||
getURLasync: function(bounds, callback, scope) {
|
||||
bounds = this.adjustBounds(bounds);
|
||||
|
||||
// create an arcxml request to generate the image
|
||||
@@ -239,11 +237,7 @@ OpenLayers.Layer.ArcIMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||
var axlResp = new OpenLayers.Format.ArcXML();
|
||||
var arcxml = axlResp.read(doc);
|
||||
|
||||
scope[prop] = this.getUrlOrImage(arcxml.image.output);
|
||||
|
||||
// call the callback function to recieve the updated property on the
|
||||
// scoped object
|
||||
callback.apply(scope);
|
||||
callback.call(scope, this.getUrlOrImage(arcxml.image.output));
|
||||
},
|
||||
scope: this
|
||||
});
|
||||
|
||||
@@ -168,15 +168,14 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
||||
this.layer.div.appendChild(this.getTile());
|
||||
if (this.layer.async) {
|
||||
// Asynchronous image requests call the asynchronous getURL method
|
||||
// on the layer to fetch an image that covers 'this.bounds', in the scope of
|
||||
// 'this', setting the 'url' property of the layer itself, and running
|
||||
// the callback 'initImage' when the image request returns.
|
||||
var myId = this.asyncRequestId = (this.asyncRequestId || 0) + 1;
|
||||
this.layer.getURLasync(this.bounds, this, "url", function() {
|
||||
if (myId == this.asyncRequestId) {
|
||||
// on the layer to fetch an image that covers 'this.bounds'.
|
||||
var id = this.asyncRequestId = (this.asyncRequestId || 0) + 1;
|
||||
this.layer.getURLasync(this.bounds, function(url) {
|
||||
if (id == this.asyncRequestId) {
|
||||
this.url = url;
|
||||
this.initImage();
|
||||
}
|
||||
});
|
||||
}, this);
|
||||
} else {
|
||||
// synchronous image requests get the url immediately.
|
||||
this.url = this.layer.getURL(this.bounds);
|
||||
|
||||
@@ -86,6 +86,10 @@ If you were previously using the `OpenLayers.Layer.SphericalMercator.forwardMerc
|
||||
|
||||
`OpenLayers.Protocol.HTTP` no longer requires `OpenLayers.Format.QueryStringFilter`. It you need this, make sure it is included in your build config file.
|
||||
|
||||
## Changes in getURLasync
|
||||
|
||||
The internal `OpenLayers.Layer.getURLasync` function now take a bound, a callback and a scope. The function no longer needs update the passed property but simply to return to url.
|
||||
|
||||
## Deprecated Components
|
||||
|
||||
A number of properties, methods, and constructors have been marked as deprecated for multiple releases in the 2.x series. For the 2.12 release this deprecated functionality has been moved to a separate deprecated.js file. If you use any of the constructors or methods below, you will have to explicitly include the deprecated.js file in your build (or add it in a separate `<script>` tag after OpenLayers.js).
|
||||
|
||||
@@ -85,9 +85,8 @@
|
||||
var layer = new OpenLayers.Layer.WMS(
|
||||
"Name",
|
||||
"http://labs.metacarta.com/TESTURL?",
|
||||
{layers: 'basic'}, {async: true, getURLasync: function(bounds, scope, url, callback) {
|
||||
scope.url = this.getURL(bounds);
|
||||
callback.call(scope);
|
||||
{layers: 'basic'}, {async: true, getURLasync: function(bounds, callback) {
|
||||
callback(this.getURL(bounds));
|
||||
}}
|
||||
);
|
||||
map.addLayer(layer);
|
||||
|
||||
Reference in New Issue
Block a user