Implement ol.renderer.Layer#forEachFeatureAtCoordinate

And remove identical implementation in children classes.
This commit is contained in:
Frederic Junod
2015-04-28 14:07:57 +02:00
parent 1d6530ce9c
commit dd07fd7977
4 changed files with 18 additions and 68 deletions
+18 -1
View File
@@ -48,7 +48,24 @@ goog.inherits(ol.renderer.Layer, ol.Observable);
* @return {T|undefined} Callback result.
* @template S,T
*/
ol.renderer.Layer.prototype.forEachFeatureAtCoordinate = goog.nullFunction;
ol.renderer.Layer.prototype.forEachFeatureAtCoordinate =
function(coordinate, frameState, callback, thisArg) {
var layer = this.getLayer();
var source = layer.getSource();
var resolution = frameState.viewState.resolution;
var rotation = frameState.viewState.rotation;
var skippedFeatureUids = frameState.skippedFeatureUids;
return source.forEachFeatureAtCoordinate(
coordinate, resolution, rotation, skippedFeatureUids,
/**
* @param {ol.Feature} feature Feature.
* @return {?} Callback result.
*/
function(feature) {
return callback.call(thisArg, feature, layer);
});
};
/**