Make signature for *AtPixel methods more consistent

pixel/coordinate is the first argument.
This commit is contained in:
tsauerwein
2015-01-29 11:16:22 +01:00
parent b7415219a6
commit 054227fd26
12 changed files with 35 additions and 41 deletions

View File

@@ -1858,16 +1858,16 @@ ol.render.canvas.ReplayGroup.prototype.finish = function() {
/**
* @param {ol.Coordinate} coordinate Coordinate.
* @param {number} resolution Resolution.
* @param {number} rotation Rotation.
* @param {ol.Coordinate} coordinate Coordinate.
* @param {Object} skippedFeaturesHash Ids of features to skip
* @param {function(ol.Feature): T} callback Feature callback.
* @return {T|undefined} Callback result.
* @template T
*/
ol.render.canvas.ReplayGroup.prototype.forEachFeatureAtPixel = function(
resolution, rotation, coordinate, skippedFeaturesHash, callback) {
coordinate, resolution, rotation, skippedFeaturesHash, callback) {
var transform = this.hitDetectionTransform_;
ol.vec.Mat4.makeTransform2D(transform, 0.5, 0.5,

View File

@@ -1154,6 +1154,7 @@ ol.render.webgl.ReplayGroup.prototype.replayHitDetection_ = function(context,
/**
* @param {ol.Coordinate} coordinate Coordinate.
* @param {ol.webgl.Context} context Context.
* @param {ol.Coordinate} center Center.
* @param {number} resolution Resolution.
@@ -1166,15 +1167,14 @@ ol.render.webgl.ReplayGroup.prototype.replayHitDetection_ = function(context,
* @param {number} hue Global hue.
* @param {number} saturation Global saturation.
* @param {Object} skippedFeaturesHash Ids of features to skip.
* @param {ol.Coordinate} coordinate Coordinate.
* @param {function(ol.Feature): T|undefined} callback Feature callback.
* @return {T|undefined} Callback result.
* @template T
*/
ol.render.webgl.ReplayGroup.prototype.forEachFeatureAtPixel = function(
context, center, resolution, rotation, size, pixelRatio,
coordinate, context, center, resolution, rotation, size, pixelRatio,
opacity, brightness, contrast, hue, saturation, skippedFeaturesHash,
coordinate, callback) {
callback) {
var gl = context.getGL();
gl.bindFramebuffer(
gl.FRAMEBUFFER, context.getHitDetectionFramebuffer());
@@ -1215,6 +1215,7 @@ ol.render.webgl.ReplayGroup.prototype.forEachFeatureAtPixel = function(
/**
* @param {ol.Coordinate} coordinate Coordinate.
* @param {ol.webgl.Context} context Context.
* @param {ol.Coordinate} center Center.
* @param {number} resolution Resolution.
@@ -1227,13 +1228,11 @@ ol.render.webgl.ReplayGroup.prototype.forEachFeatureAtPixel = function(
* @param {number} hue Global hue.
* @param {number} saturation Global saturation.
* @param {Object} skippedFeaturesHash Ids of features to skip.
* @param {ol.Coordinate} coordinate Coordinate.
* @return {boolean} Is there a feature at the given pixel?
*/
ol.render.webgl.ReplayGroup.prototype.hasFeatureAtPixel = function(
context, center, resolution, rotation, size, pixelRatio,
opacity, brightness, contrast, hue, saturation, skippedFeaturesHash,
coordinate) {
coordinate, context, center, resolution, rotation, size, pixelRatio,
opacity, brightness, contrast, hue, saturation, skippedFeaturesHash) {
var gl = context.getGL();
gl.bindFramebuffer(
gl.FRAMEBUFFER, context.getHitDetectionFramebuffer());

View File

@@ -64,7 +64,7 @@ ol.renderer.canvas.ImageLayer.prototype.forEachFeatureAtPixel =
var rotation = frameState.viewState.rotation;
var skippedFeatureUids = frameState.skippedFeatureUids;
return source.forEachFeatureAtPixel(
resolution, rotation, coordinate, skippedFeatureUids,
coordinate, resolution, rotation, skippedFeatureUids,
/**
* @param {ol.Feature} feature Feature.
* @return {?} Callback result.

View File

@@ -126,8 +126,8 @@ ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtPixel =
var layer = this.getLayer();
/** @type {Object.<string, boolean>} */
var features = {};
return this.replayGroup_.forEachFeatureAtPixel(resolution,
rotation, coordinate, frameState.skippedFeatureUids,
return this.replayGroup_.forEachFeatureAtPixel(coordinate,
resolution, rotation, frameState.skippedFeatureUids,
/**
* @param {ol.Feature} feature Feature.
* @return {?} Callback result.

View File

@@ -55,7 +55,7 @@ ol.renderer.dom.ImageLayer.prototype.forEachFeatureAtPixel =
var rotation = frameState.viewState.rotation;
var skippedFeatureUids = frameState.skippedFeatureUids;
return source.forEachFeatureAtPixel(
resolution, rotation, coordinate, skippedFeatureUids,
coordinate, resolution, rotation, skippedFeatureUids,
/**
* @param {ol.Feature} feature Feature.
* @return {?} Callback result.

View File

@@ -186,8 +186,8 @@ ol.renderer.dom.VectorLayer.prototype.forEachFeatureAtPixel =
var layer = this.getLayer();
/** @type {Object.<string, boolean>} */
var features = {};
return this.replayGroup_.forEachFeatureAtPixel(resolution,
rotation, coordinate, frameState.skippedFeatureUids,
return this.replayGroup_.forEachFeatureAtPixel(coordinate,
resolution, rotation, frameState.skippedFeatureUids,
/**
* @param {ol.Feature} feature Feature.
* @return {?} Callback result.

View File

@@ -131,8 +131,8 @@ ol.renderer.Map.prototype.forEachFeatureAtPixel =
if (!goog.isNull(this.replayGroup)) {
/** @type {Object.<string, boolean>} */
var features = {};
result = this.replayGroup.forEachFeatureAtPixel(viewResolution,
viewRotation, coordinate, {},
result = this.replayGroup.forEachFeatureAtPixel(coordinate,
viewResolution, viewRotation, {},
/**
* @param {ol.Feature} feature Feature.
* @return {?} Callback result.
@@ -192,8 +192,8 @@ ol.renderer.Map.prototype.forEachLayerAtPixel =
var viewRotation = viewState.rotation;
if (!goog.isNull(this.replayGroup)) {
var hasFeature = this.replayGroup.forEachFeatureAtPixel(viewResolution,
viewRotation, coordinate, {}, goog.functions.TRUE);
var hasFeature = this.replayGroup.forEachFeatureAtPixel(coordinate,
viewResolution, viewRotation, {}, goog.functions.TRUE);
if (hasFeature) {
result = callback.call(thisArg, null);

View File

@@ -81,7 +81,7 @@ ol.renderer.webgl.ImageLayer.prototype.forEachFeatureAtPixel =
var rotation = frameState.viewState.rotation;
var skippedFeatureUids = frameState.skippedFeatureUids;
return source.forEachFeatureAtPixel(
resolution, rotation, coordinate, skippedFeatureUids,
coordinate, resolution, rotation, skippedFeatureUids,
/**
* @param {ol.Feature} feature Feature.

View File

@@ -560,11 +560,10 @@ ol.renderer.webgl.Map.prototype.forEachFeatureAtPixel =
// use default color values
var d = ol.renderer.webgl.Map.DEFAULT_COLOR_VALUES_;
result = this.replayGroup.forEachFeatureAtPixel(context,
viewState.center, viewState.resolution, viewState.rotation,
result = this.replayGroup.forEachFeatureAtPixel(coordinate,
context, viewState.center, viewState.resolution, viewState.rotation,
frameState.size, frameState.pixelRatio,
d.opacity, d.brightness, d.contrast, d.hue, d.saturation, {},
coordinate,
/**
* @param {ol.Feature} feature Feature.
* @return {?} Callback result.
@@ -620,11 +619,10 @@ ol.renderer.webgl.Map.prototype.hasFeatureAtPixel =
// use default color values
var d = ol.renderer.webgl.Map.DEFAULT_COLOR_VALUES_;
hasFeature = this.replayGroup.hasFeatureAtPixel(context,
viewState.center, viewState.resolution, viewState.rotation,
hasFeature = this.replayGroup.hasFeatureAtPixel(coordinate,
context, viewState.center, viewState.resolution, viewState.rotation,
frameState.size, frameState.pixelRatio,
d.opacity, d.brightness, d.contrast, d.hue, d.saturation, {},
coordinate);
d.opacity, d.brightness, d.contrast, d.hue, d.saturation, {});
if (hasFeature) {
return true;
}
@@ -667,11 +665,10 @@ ol.renderer.webgl.Map.prototype.forEachLayerAtPixel =
// use default color values
var d = ol.renderer.webgl.Map.DEFAULT_COLOR_VALUES_;
var hasFeature = this.replayGroup.hasFeatureAtPixel(context,
viewState.center, viewState.resolution, viewState.rotation,
var hasFeature = this.replayGroup.hasFeatureAtPixel(coordinate,
context, viewState.center, viewState.resolution, viewState.rotation,
frameState.size, frameState.pixelRatio,
d.opacity, d.brightness, d.contrast, d.hue, d.saturation, {},
coordinate);
d.opacity, d.brightness, d.contrast, d.hue, d.saturation, {});
if (hasFeature) {
result = callback.call(thisArg, null);
if (result) {

View File

@@ -118,12 +118,11 @@ ol.renderer.webgl.VectorLayer.prototype.forEachFeatureAtPixel =
var layerState = this.layerState_;
/** @type {Object.<string, boolean>} */
var features = {};
return this.replayGroup_.forEachFeatureAtPixel(context,
viewState.center, viewState.resolution, viewState.rotation,
return this.replayGroup_.forEachFeatureAtPixel(coordinate,
context, viewState.center, viewState.resolution, viewState.rotation,
frameState.size, frameState.pixelRatio,
layerState.opacity, layerState.brightness, layerState.contrast,
layerState.hue, layerState.saturation, frameState.skippedFeatureUids,
coordinate,
/**
* @param {ol.Feature} feature Feature.
* @return {?} Callback result.
@@ -152,12 +151,11 @@ ol.renderer.webgl.VectorLayer.prototype.hasFeatureAtPixel =
var context = mapRenderer.getContext();
var viewState = frameState.viewState;
var layerState = this.layerState_;
return this.replayGroup_.hasFeatureAtPixel(context,
viewState.center, viewState.resolution, viewState.rotation,
return this.replayGroup_.hasFeatureAtPixel(coordinate,
context, viewState.center, viewState.resolution, viewState.rotation,
frameState.size, frameState.pixelRatio,
layerState.opacity, layerState.brightness, layerState.contrast,
layerState.hue, layerState.saturation, frameState.skippedFeatureUids,
coordinate);
layerState.hue, layerState.saturation, frameState.skippedFeatureUids);
}
};

View File

@@ -153,14 +153,14 @@ ol.source.ImageVector.prototype.canvasFunctionInternal_ =
* @inheritDoc
*/
ol.source.ImageVector.prototype.forEachFeatureAtPixel = function(
resolution, rotation, coordinate, skippedFeatureUids, callback) {
coordinate, resolution, rotation, skippedFeatureUids, callback) {
if (goog.isNull(this.replayGroup_)) {
return undefined;
} else {
/** @type {Object.<string, boolean>} */
var features = {};
return this.replayGroup_.forEachFeatureAtPixel(
resolution, 0, coordinate, skippedFeatureUids,
coordinate, resolution, 0, skippedFeatureUids,
/**
* @param {ol.Feature} feature Feature.
* @return {?} Callback result.

View File

@@ -77,9 +77,9 @@ goog.inherits(ol.source.Source, ol.Observable);
/**
* @param {ol.Coordinate} coordinate Coordinate.
* @param {number} resolution Resolution.
* @param {number} rotation Rotation.
* @param {ol.Coordinate} coordinate Coordinate.
* @param {Object.<string, boolean>} skippedFeatureUids Skipped feature uids.
* @param {function(ol.Feature): T} callback Feature callback.
* @return {T|undefined} Callback result.