changed signature of internal methods

This commit is contained in:
simonseyock
2016-10-19 13:31:37 +02:00
committed by simonseyock
parent 80188b2044
commit 5ce0d8aa2a
12 changed files with 22 additions and 19 deletions

View File

@@ -88,6 +88,7 @@ ol.render.canvas.ReplayGroup.prototype.finish = function() {
* @param {ol.Coordinate} coordinate Coordinate. * @param {ol.Coordinate} coordinate Coordinate.
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @param {number} rotation Rotation. * @param {number} rotation Rotation.
* @param {number} hitTolerance hit tolerance.
* @param {Object.<string, boolean>} skippedFeaturesHash Ids of features * @param {Object.<string, boolean>} skippedFeaturesHash Ids of features
* to skip. * to skip.
* @param {function((ol.Feature|ol.render.Feature)): T} callback Feature * @param {function((ol.Feature|ol.render.Feature)): T} callback Feature
@@ -96,9 +97,8 @@ ol.render.canvas.ReplayGroup.prototype.finish = function() {
* @template T * @template T
*/ */
ol.render.canvas.ReplayGroup.prototype.forEachFeatureAtCoordinate = function( ol.render.canvas.ReplayGroup.prototype.forEachFeatureAtCoordinate = function(
coordinate, resolution, rotation, skippedFeaturesHash, callback) { coordinate, resolution, rotation, hitTolerance, skippedFeaturesHash, callback) {
var hitTolerance = 10;
var contextSize = hitTolerance * 2 + 1; var contextSize = hitTolerance * 2 + 1;
var transform = ol.transform.compose(ol.transform.create(), var transform = ol.transform.compose(ol.transform.create(),

View File

@@ -177,7 +177,7 @@ ol.renderer.canvas.VectorLayer.prototype.composeFrame = function(frameState, lay
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, callback, thisArg) { ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) {
if (!this.replayGroup_) { if (!this.replayGroup_) {
return undefined; return undefined;
} else { } else {
@@ -187,7 +187,7 @@ ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtCoordinate = function(c
/** @type {Object.<string, boolean>} */ /** @type {Object.<string, boolean>} */
var features = {}; var features = {};
return this.replayGroup_.forEachFeatureAtCoordinate(coordinate, resolution, return this.replayGroup_.forEachFeatureAtCoordinate(coordinate, resolution,
rotation, {}, rotation, hitTolerance, {},
/** /**
* @param {ol.Feature|ol.render.Feature} feature Feature. * @param {ol.Feature|ol.render.Feature} feature Feature.
* @return {?} Callback result. * @return {?} Callback result.

View File

@@ -176,7 +176,7 @@ ol.renderer.canvas.VectorTileLayer.prototype.drawTileImage = function(
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.renderer.canvas.VectorTileLayer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, callback, thisArg) { ol.renderer.canvas.VectorTileLayer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) {
var resolution = frameState.viewState.resolution; var resolution = frameState.viewState.resolution;
var rotation = frameState.viewState.rotation; var rotation = frameState.viewState.rotation;
var layer = this.getLayer(); var layer = this.getLayer();
@@ -212,7 +212,7 @@ ol.renderer.canvas.VectorTileLayer.prototype.forEachFeatureAtCoordinate = functi
} }
replayGroup = tile.getReplayState().replayGroup; replayGroup = tile.getReplayState().replayGroup;
found = found || replayGroup.forEachFeatureAtCoordinate( found = found || replayGroup.forEachFeatureAtCoordinate(
tileSpaceCoordinate, resolution, rotation, {}, tileSpaceCoordinate, resolution, rotation, hitTolerance, {},
/** /**
* @param {ol.Feature|ol.render.Feature} feature Feature. * @param {ol.Feature|ol.render.Feature} feature Feature.
* @return {?} Callback result. * @return {?} Callback result.

View File

@@ -35,6 +35,7 @@ ol.inherits(ol.renderer.Layer, ol.Observable);
/** /**
* @param {ol.Coordinate} coordinate Coordinate. * @param {ol.Coordinate} coordinate Coordinate.
* @param {olx.FrameState} frameState Frame state. * @param {olx.FrameState} frameState Frame state.
* @param {number} hitTolerance hit tolerance.
* @param {function(this: S, (ol.Feature|ol.render.Feature), ol.layer.Layer): T} * @param {function(this: S, (ol.Feature|ol.render.Feature), ol.layer.Layer): T}
* callback Feature callback. * callback Feature callback.
* @param {S} thisArg Value to use as `this` when executing `callback`. * @param {S} thisArg Value to use as `this` when executing `callback`.

View File

@@ -100,6 +100,7 @@ ol.renderer.Map.expireIconCache_ = function(map, frameState) {
/** /**
* @param {ol.Coordinate} coordinate Coordinate. * @param {ol.Coordinate} coordinate Coordinate.
* @param {olx.FrameState} frameState FrameState. * @param {olx.FrameState} frameState FrameState.
* @param {number} hitTolerance hit tolerance.
* @param {function(this: S, (ol.Feature|ol.render.Feature), * @param {function(this: S, (ol.Feature|ol.render.Feature),
* ol.layer.Layer): T} callback Feature callback. * ol.layer.Layer): T} callback Feature callback.
* @param {S} thisArg Value to use as `this` when executing `callback`. * @param {S} thisArg Value to use as `this` when executing `callback`.
@@ -111,7 +112,7 @@ ol.renderer.Map.expireIconCache_ = function(map, frameState) {
* @return {T|undefined} Callback result. * @return {T|undefined} Callback result.
* @template S,T,U * @template S,T,U
*/ */
ol.renderer.Map.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, callback, thisArg, ol.renderer.Map.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg,
layerFilter, thisArg2) { layerFilter, thisArg2) {
var result; var result;
var viewState = frameState.viewState; var viewState = frameState.viewState;
@@ -155,7 +156,7 @@ ol.renderer.Map.prototype.forEachFeatureAtCoordinate = function(coordinate, fram
if (layer.getSource()) { if (layer.getSource()) {
result = layerRenderer.forEachFeatureAtCoordinate( result = layerRenderer.forEachFeatureAtCoordinate(
layer.getSource().getWrapX() ? translatedCoordinate : coordinate, layer.getSource().getWrapX() ? translatedCoordinate : coordinate,
frameState, forEachFeatureAtCoordinate, thisArg); frameState, hitTolerance, forEachFeatureAtCoordinate, thisArg);
} }
if (result) { if (result) {
return result; return result;

View File

@@ -68,14 +68,14 @@ ol.renderer.webgl.ImageLayer.prototype.createTexture_ = function(image) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.renderer.webgl.ImageLayer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, callback, thisArg) { ol.renderer.webgl.ImageLayer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) {
var layer = this.getLayer(); var layer = this.getLayer();
var source = layer.getSource(); var source = layer.getSource();
var resolution = frameState.viewState.resolution; var resolution = frameState.viewState.resolution;
var rotation = frameState.viewState.rotation; var rotation = frameState.viewState.rotation;
var skippedFeatureUids = frameState.skippedFeatureUids; var skippedFeatureUids = frameState.skippedFeatureUids;
return source.forEachFeatureAtCoordinate( return source.forEachFeatureAtCoordinate(
coordinate, resolution, rotation, skippedFeatureUids, coordinate, resolution, rotation, hitTolerance, skippedFeatureUids,
/** /**
* @param {ol.Feature|ol.render.Feature} feature Feature. * @param {ol.Feature|ol.render.Feature} feature Feature.

View File

@@ -502,7 +502,7 @@ ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) {
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.renderer.webgl.Map.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, callback, thisArg, ol.renderer.webgl.Map.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg,
layerFilter, thisArg2) { layerFilter, thisArg2) {
var result; var result;
@@ -522,7 +522,7 @@ ol.renderer.webgl.Map.prototype.forEachFeatureAtCoordinate = function(coordinate
layerFilter.call(thisArg2, layer)) { layerFilter.call(thisArg2, layer)) {
var layerRenderer = this.getLayerRenderer(layer); var layerRenderer = this.getLayerRenderer(layer);
result = layerRenderer.forEachFeatureAtCoordinate( result = layerRenderer.forEachFeatureAtCoordinate(
coordinate, frameState, callback, thisArg); coordinate, frameState, hitTolerance, callback, thisArg);
if (result) { if (result) {
return result; return result;
} }

View File

@@ -106,7 +106,7 @@ ol.renderer.webgl.VectorLayer.prototype.disposeInternal = function() {
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.renderer.webgl.VectorLayer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, callback, thisArg) { ol.renderer.webgl.VectorLayer.prototype.forEachFeatureAtCoordinate = function(coordinate, frameState, hitTolerance, callback, thisArg) {
if (!this.replayGroup_ || !this.layerState_) { if (!this.replayGroup_ || !this.layerState_) {
return undefined; return undefined;
} else { } else {

View File

@@ -155,14 +155,14 @@ ol.source.ImageVector.prototype.canvasFunctionInternal_ = function(extent, resol
* @inheritDoc * @inheritDoc
*/ */
ol.source.ImageVector.prototype.forEachFeatureAtCoordinate = function( ol.source.ImageVector.prototype.forEachFeatureAtCoordinate = function(
coordinate, resolution, rotation, skippedFeatureUids, callback) { coordinate, resolution, rotation, hitTolerance, skippedFeatureUids, callback) {
if (!this.replayGroup_) { if (!this.replayGroup_) {
return undefined; return undefined;
} else { } else {
/** @type {Object.<string, boolean>} */ /** @type {Object.<string, boolean>} */
var features = {}; var features = {};
return this.replayGroup_.forEachFeatureAtCoordinate( return this.replayGroup_.forEachFeatureAtCoordinate(
coordinate, resolution, 0, skippedFeatureUids, coordinate, resolution, 0, hitTolerance, skippedFeatureUids,
/** /**
* @param {ol.Feature|ol.render.Feature} feature Feature. * @param {ol.Feature|ol.render.Feature} feature Feature.
* @return {?} Callback result. * @return {?} Callback result.

View File

@@ -94,6 +94,7 @@ ol.source.Source.toAttributionsArray_ = function(attributionLike) {
* @param {ol.Coordinate} coordinate Coordinate. * @param {ol.Coordinate} coordinate Coordinate.
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @param {number} rotation Rotation. * @param {number} rotation Rotation.
* @param {number} hitTolerance Hit tolerance.
* @param {Object.<string, boolean>} skippedFeatureUids Skipped feature uids. * @param {Object.<string, boolean>} skippedFeatureUids Skipped feature uids.
* @param {function((ol.Feature|ol.render.Feature)): T} callback Feature * @param {function((ol.Feature|ol.render.Feature)): T} callback Feature
* callback. * callback.

View File

@@ -79,7 +79,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
var replayGroup = {}; var replayGroup = {};
renderer.replayGroup_ = replayGroup; renderer.replayGroup_ = replayGroup;
replayGroup.forEachFeatureAtCoordinate = function(coordinate, replayGroup.forEachFeatureAtCoordinate = function(coordinate,
resolution, rotation, skippedFeaturesUids, callback) { resolution, rotation, hitTolerance, skippedFeaturesUids, callback) {
var feature = new ol.Feature(); var feature = new ol.Feature();
callback(feature); callback(feature);
callback(feature); callback(feature);
@@ -99,7 +99,7 @@ describe('ol.renderer.canvas.VectorLayer', function() {
}; };
frameState.layerStates[ol.getUid(layer)] = {}; frameState.layerStates[ol.getUid(layer)] = {};
renderer.forEachFeatureAtCoordinate( renderer.forEachFeatureAtCoordinate(
coordinate, frameState, spy, undefined); coordinate, frameState, 0, spy, undefined);
expect(spy.callCount).to.be(1); expect(spy.callCount).to.be(1);
expect(spy.getCall(0).args[1]).to.equal(layer); expect(spy.getCall(0).args[1]).to.equal(layer);
}); });

View File

@@ -169,7 +169,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
}); });
renderer = new ol.renderer.canvas.VectorTileLayer(layer); renderer = new ol.renderer.canvas.VectorTileLayer(layer);
replayGroup.forEachFeatureAtCoordinate = function(coordinate, replayGroup.forEachFeatureAtCoordinate = function(coordinate,
resolution, rotation, skippedFeaturesUids, callback) { resolution, rotation, hitTolerance, skippedFeaturesUids, callback) {
var feature = new ol.Feature(); var feature = new ol.Feature();
callback(feature); callback(feature);
callback(feature); callback(feature);
@@ -190,7 +190,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
frameState.layerStates[ol.getUid(layer)] = {}; frameState.layerStates[ol.getUid(layer)] = {};
renderer.renderedTiles = [new TileClass([0, 0, -1])]; renderer.renderedTiles = [new TileClass([0, 0, -1])];
renderer.forEachFeatureAtCoordinate( renderer.forEachFeatureAtCoordinate(
coordinate, frameState, spy, undefined); coordinate, frameState, 0, spy, undefined);
expect(spy.callCount).to.be(1); expect(spy.callCount).to.be(1);
expect(spy.getCall(0).args[1]).to.equal(layer); expect(spy.getCall(0).args[1]).to.equal(layer);
}); });