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
|
* Collection#forEach
|
||||||
* geom/LineString#forEachSegment
|
* geom/LineString#forEachSegment
|
||||||
* Observable#on, #once, #un
|
* Observable#on, #once, #un
|
||||||
|
* source/TileUTFGrid#forDataAtCoordinateAndResolution
|
||||||
|
|
||||||
### v4.6.0
|
### v4.6.0
|
||||||
|
|
||||||
|
|||||||
@@ -124,28 +124,26 @@ _ol_source_TileUTFGrid_.prototype.getTemplate = function() {
|
|||||||
* in case of an error).
|
* in case of an error).
|
||||||
* @param {ol.Coordinate} coordinate Coordinate.
|
* @param {ol.Coordinate} coordinate Coordinate.
|
||||||
* @param {number} resolution Resolution.
|
* @param {number} resolution Resolution.
|
||||||
* @param {function(this: T, *)} callback Callback.
|
* @param {function(*)} callback Callback.
|
||||||
* @param {T=} opt_this The object to use as `this` in the callback.
|
|
||||||
* @param {boolean=} opt_request If `true` the callback is always async.
|
* @param {boolean=} opt_request If `true` the callback is always async.
|
||||||
* The tile data is requested if not yet loaded.
|
* The tile data is requested if not yet loaded.
|
||||||
* @template T
|
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_source_TileUTFGrid_.prototype.forDataAtCoordinateAndResolution = function(
|
_ol_source_TileUTFGrid_.prototype.forDataAtCoordinateAndResolution = function(
|
||||||
coordinate, resolution, callback, opt_this, opt_request) {
|
coordinate, resolution, callback, opt_request) {
|
||||||
if (this.tileGrid) {
|
if (this.tileGrid) {
|
||||||
var tileCoord = this.tileGrid.getTileCoordForCoordAndResolution(
|
var tileCoord = this.tileGrid.getTileCoordForCoordAndResolution(
|
||||||
coordinate, resolution);
|
coordinate, resolution);
|
||||||
var tile = /** @type {!ol.source.TileUTFGrid.Tile_} */(this.getTile(
|
var tile = /** @type {!ol.source.TileUTFGrid.Tile_} */(this.getTile(
|
||||||
tileCoord[0], tileCoord[1], tileCoord[2], 1, this.getProjection()));
|
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 {
|
} else {
|
||||||
if (opt_request === true) {
|
if (opt_request === true) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
callback.call(opt_this, null);
|
callback(null);
|
||||||
}, 0);
|
}, 0);
|
||||||
} else {
|
} else {
|
||||||
callback.call(opt_this, null);
|
callback(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -253,18 +253,7 @@ describe('ol.source.TileUTFGrid', function() {
|
|||||||
done();
|
done();
|
||||||
};
|
};
|
||||||
source.forDataAtCoordinateAndResolution(
|
source.forDataAtCoordinateAndResolution(
|
||||||
bonn3857, resolutionZoom1, callback, null, true
|
bonn3857, resolutionZoom1, callback, 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
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -275,7 +264,7 @@ describe('ol.source.TileUTFGrid', function() {
|
|||||||
done();
|
done();
|
||||||
};
|
};
|
||||||
source.forDataAtCoordinateAndResolution(
|
source.forDataAtCoordinateAndResolution(
|
||||||
noState3857, resolutionZoom1, callback, null, true
|
noState3857, resolutionZoom1, callback, true
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user