TileUtfGrid#forDataAtCoordinateAndResolution
This commit is contained in:
@@ -42,6 +42,7 @@ The following methods did get the optional this (i.e. opt_this) arguments remove
|
||||
* Collection#forEach
|
||||
* geom/LineString#forEachSegment
|
||||
* Observable#on, #once, #un
|
||||
* source/TileUTFGrid#forDataAtCoordinateAndResolution
|
||||
|
||||
### v4.6.0
|
||||
|
||||
|
||||
@@ -124,28 +124,26 @@ _ol_source_TileUTFGrid_.prototype.getTemplate = function() {
|
||||
* in case of an error).
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {function(this: T, *)} callback Callback.
|
||||
* @param {T=} opt_this The object to use as `this` in the callback.
|
||||
* @param {function(*)} callback Callback.
|
||||
* @param {boolean=} opt_request If `true` the callback is always async.
|
||||
* The tile data is requested if not yet loaded.
|
||||
* @template T
|
||||
* @api
|
||||
*/
|
||||
_ol_source_TileUTFGrid_.prototype.forDataAtCoordinateAndResolution = function(
|
||||
coordinate, resolution, callback, opt_this, opt_request) {
|
||||
coordinate, resolution, callback, opt_request) {
|
||||
if (this.tileGrid) {
|
||||
var tileCoord = this.tileGrid.getTileCoordForCoordAndResolution(
|
||||
coordinate, resolution);
|
||||
var tile = /** @type {!ol.source.TileUTFGrid.Tile_} */(this.getTile(
|
||||
tileCoord[0], tileCoord[1], tileCoord[2], 1, this.getProjection()));
|
||||
tile.forDataAtCoordinate(coordinate, callback, opt_this, opt_request);
|
||||
tile.forDataAtCoordinate(coordinate, callback, null, opt_request);
|
||||
} else {
|
||||
if (opt_request === true) {
|
||||
setTimeout(function() {
|
||||
callback.call(opt_this, null);
|
||||
callback(null);
|
||||
}, 0);
|
||||
} else {
|
||||
callback.call(opt_this, null);
|
||||
callback(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -253,18 +253,7 @@ describe('ol.source.TileUTFGrid', function() {
|
||||
done();
|
||||
};
|
||||
source.forDataAtCoordinateAndResolution(
|
||||
bonn3857, resolutionZoom1, callback, null, true
|
||||
);
|
||||
});
|
||||
|
||||
it('calls callback with correct `this` bound', function(done) {
|
||||
var scope = {foo: 'bar'};
|
||||
var callback = function(data) {
|
||||
expect(this).to.be(scope);
|
||||
done();
|
||||
};
|
||||
source.forDataAtCoordinateAndResolution(
|
||||
bonn3857, resolutionZoom1, callback, scope, true
|
||||
bonn3857, resolutionZoom1, callback, true
|
||||
);
|
||||
});
|
||||
|
||||
@@ -275,7 +264,7 @@ describe('ol.source.TileUTFGrid', function() {
|
||||
done();
|
||||
};
|
||||
source.forDataAtCoordinateAndResolution(
|
||||
noState3857, resolutionZoom1, callback, null, true
|
||||
noState3857, resolutionZoom1, callback, true
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user