Implement forEachLayerAtPixel for canvas

This commit is contained in:
tsauerwein
2015-01-23 16:50:42 +01:00
parent 225f0739ec
commit b4cb786f29
3 changed files with 114 additions and 0 deletions
@@ -216,6 +216,22 @@ ol.renderer.canvas.Layer.prototype.getTransform = function(frameState) {
ol.renderer.canvas.Layer.prototype.prepareFrame = goog.abstractMethod;
/**
* @param {ol.Coordinate} coordinate Coordinate.
* @param {goog.vec.Mat4.Number} imageTransformInv The transformation matrix
* to convert from a map pixel to a canvas pixel.
* @return {ol.Pixel}
* @protected
*/
ol.renderer.canvas.Layer.prototype.getPixelFromCoordinates =
function(coordinate, imageTransformInv) {
var pixelOnMap = this.getMap().getPixelFromCoordinate(coordinate);
var pixelOnCanvas = [0, 0];
ol.vec.Mat4.multVec2(imageTransformInv, pixelOnMap, pixelOnCanvas);
return pixelOnCanvas;
};
/**
* @param {ol.Size} size Size.
* @return {boolean} True when the canvas with the current size does not exceed