Merge pull request #1298 from ahocevar/gfi-callback
The source determines who can do GetFeatureInfo
This commit is contained in:
@@ -48,17 +48,21 @@ goog.inherits(ol.renderer.Layer, goog.Disposable);
|
||||
* successful queries. The passed arguments are the resulting feature
|
||||
* information and the layer.
|
||||
* @param {function()=} opt_error Callback for unsuccessful queries.
|
||||
* @return {boolean} Whether getFeatureInfoForPixel was called on the source.
|
||||
*/
|
||||
ol.renderer.Layer.prototype.getFeatureInfoForPixel =
|
||||
function(pixel, success, opt_error) {
|
||||
var layer = this.getLayer();
|
||||
var source = layer.getSource();
|
||||
var haveGetFeatureInfo = false;
|
||||
if (goog.isFunction(source.getFeatureInfoForPixel)) {
|
||||
var callback = function(layerFeatureInfo) {
|
||||
success(layerFeatureInfo, layer);
|
||||
};
|
||||
source.getFeatureInfoForPixel(pixel, this.getMap(), callback, opt_error);
|
||||
haveGetFeatureInfo = true;
|
||||
}
|
||||
return haveGetFeatureInfo;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user