Incomplete getFeatureInfo implementation
This commit is contained in:
@@ -16,8 +16,8 @@ goog.require('ol.tilegrid.XYZ');
|
|||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* TODO: desc
|
* TODO: desc
|
||||||
* TODO: caching
|
|
||||||
* TODO: getTilePixelSize ?
|
* TODO: getTilePixelSize ?
|
||||||
|
* TODO: lazy loading
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.Tile}
|
* @extends {ol.source.Tile}
|
||||||
@@ -58,6 +58,27 @@ ol.source.TileUTFGrid.prototype.expireCache = function(usedTiles) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ol.Coordinate} coordinate Coordinate.
|
||||||
|
* @param {number} resolution Resolution.
|
||||||
|
* @param {function(Object)} callback Info callback.
|
||||||
|
*/
|
||||||
|
ol.source.TileUTFGrid.prototype.getFeatureInfo = function(
|
||||||
|
coordinate, resolution, callback) {
|
||||||
|
if (!goog.isNull(this.tileGrid)) {
|
||||||
|
var tileCoord = this.tileGrid.getTileCoordForCoordAndResolution(
|
||||||
|
coordinate, resolution);
|
||||||
|
var tileCoordKey = this.getKeyZXY.apply(this, tileCoord);
|
||||||
|
if (this.tileCache.containsKey(tileCoordKey)) {
|
||||||
|
var tile = /** @type {!ol.Tile} */ (this.tileCache.get(tileCoordKey));
|
||||||
|
callback(tile.getData());
|
||||||
|
} else {
|
||||||
|
//TODO: async?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: very similar to ol.source.TileJSON#handleTileJSONResponse
|
* TODO: very similar to ol.source.TileJSON#handleTileJSONResponse
|
||||||
* @protected
|
* @protected
|
||||||
@@ -126,7 +147,6 @@ ol.source.TileUTFGrid.prototype.getTile =
|
|||||||
if (this.tileCache.containsKey(tileCoordKey)) {
|
if (this.tileCache.containsKey(tileCoordKey)) {
|
||||||
return /** @type {!ol.Tile} */ (this.tileCache.get(tileCoordKey));
|
return /** @type {!ol.Tile} */ (this.tileCache.get(tileCoordKey));
|
||||||
} else {
|
} else {
|
||||||
goog.asserts.assert(projection);
|
|
||||||
var tileCoord = [z, x, y];
|
var tileCoord = [z, x, y];
|
||||||
var tileUrl = this.tileUrlFunction(tileCoord, pixelRatio, projection);
|
var tileUrl = this.tileUrlFunction(tileCoord, pixelRatio, projection);
|
||||||
var tile = new ol.source.TileUTFGridTile_(
|
var tile = new ol.source.TileUTFGridTile_(
|
||||||
@@ -184,6 +204,14 @@ goog.inherits(ol.source.TileUTFGridTile_, ol.Tile);
|
|||||||
ol.source.TileUTFGridTile_.prototype.getImage = goog.nullFunction;
|
ol.source.TileUTFGridTile_.prototype.getImage = goog.nullFunction;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {Object}
|
||||||
|
*/
|
||||||
|
ol.source.TileUTFGridTile_.prototype.getData = function() { //TODO: coordinate
|
||||||
|
return this.data_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user