Removed unused forEachFeatureAtCoordinate from ol/source/Source
Fixes #8826.
This commit is contained in:
@@ -4,7 +4,6 @@
|
|||||||
import {scale as scaleCoordinate} from '../../coordinate.js';
|
import {scale as scaleCoordinate} from '../../coordinate.js';
|
||||||
import {createCanvasContext2D} from '../../dom.js';
|
import {createCanvasContext2D} from '../../dom.js';
|
||||||
import {containsExtent, intersects} from '../../extent.js';
|
import {containsExtent, intersects} from '../../extent.js';
|
||||||
import {VOID} from '../../functions.js';
|
|
||||||
import CanvasLayerRenderer from '../canvas/Layer.js';
|
import CanvasLayerRenderer from '../canvas/Layer.js';
|
||||||
import {create as createTransform, apply as applyTransform} from '../../transform.js';
|
import {create as createTransform, apply as applyTransform} from '../../transform.js';
|
||||||
|
|
||||||
@@ -89,26 +88,6 @@ class IntermediateCanvasRenderer extends CanvasLayerRenderer {
|
|||||||
*/
|
*/
|
||||||
getImageTransform() {}
|
getImageTransform() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, thisArg) {
|
|
||||||
const layer = this.getLayer();
|
|
||||||
const source = layer.getSource();
|
|
||||||
const resolution = frameState.viewState.resolution;
|
|
||||||
const rotation = frameState.viewState.rotation;
|
|
||||||
const skippedFeatureUids = frameState.skippedFeatureUids;
|
|
||||||
return source.forEachFeatureAtCoordinate(
|
|
||||||
coordinate, resolution, rotation, hitTolerance, skippedFeatureUids,
|
|
||||||
/**
|
|
||||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
|
||||||
* @return {?} Callback result.
|
|
||||||
*/
|
|
||||||
function(feature) {
|
|
||||||
return callback.call(thisArg, feature, layer);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
@@ -117,11 +96,6 @@ class IntermediateCanvasRenderer extends CanvasLayerRenderer {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getLayer().getSource().forEachFeatureAtCoordinate !== VOID) {
|
|
||||||
// for ImageCanvas sources use the original hit-detection logic,
|
|
||||||
// so that for example also transparent polygons are detected
|
|
||||||
return super.forEachLayerAtCoordinate(coordinate, frameState, hitTolerance, callback, thisArg);
|
|
||||||
} else {
|
|
||||||
const pixel = applyTransform(this.coordinateToCanvasPixelTransform, coordinate.slice());
|
const pixel = applyTransform(this.coordinateToCanvasPixelTransform, coordinate.slice());
|
||||||
scaleCoordinate(pixel, frameState.viewState.resolution / this.renderedResolution);
|
scaleCoordinate(pixel, frameState.viewState.resolution / this.renderedResolution);
|
||||||
|
|
||||||
@@ -140,7 +114,6 @@ class IntermediateCanvasRenderer extends CanvasLayerRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export default IntermediateCanvasRenderer;
|
export default IntermediateCanvasRenderer;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @module ol/renderer/webgl/ImageLayer
|
* @module ol/renderer/webgl/ImageLayer
|
||||||
*/
|
*/
|
||||||
import {ENABLE_RASTER_REPROJECTION} from '../../reproj/common.js';
|
import {ENABLE_RASTER_REPROJECTION} from '../../reproj/common.js';
|
||||||
import {TRUE, VOID} from '../../functions.js';
|
import {TRUE} from '../../functions.js';
|
||||||
import LayerType from '../../LayerType.js';
|
import LayerType from '../../LayerType.js';
|
||||||
import ViewHint from '../../ViewHint.js';
|
import ViewHint from '../../ViewHint.js';
|
||||||
import {createCanvasContext2D} from '../../dom.js';
|
import {createCanvasContext2D} from '../../dom.js';
|
||||||
@@ -230,19 +230,6 @@ class WebGLImageLayerRenderer extends WebGLLayerRenderer {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getLayer().getSource().forEachFeatureAtCoordinate !== VOID) {
|
|
||||||
// for ImageCanvas sources use the original hit-detection logic,
|
|
||||||
// so that for example also transparent polygons are detected
|
|
||||||
const coordinate = applyTransform(
|
|
||||||
frameState.pixelToCoordinateTransform, pixel.slice());
|
|
||||||
const hasFeature = this.forEachFeatureAtCoordinate(coordinate, frameState, 0, TRUE, this);
|
|
||||||
|
|
||||||
if (hasFeature) {
|
|
||||||
return callback.call(thisArg, this.getLayer(), null);
|
|
||||||
} else {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const imageSize =
|
const imageSize =
|
||||||
[this.image_.getImage().width, this.image_.getImage().height];
|
[this.image_.getImage().width, this.image_.getImage().height];
|
||||||
|
|
||||||
@@ -275,7 +262,6 @@ class WebGLImageLayerRenderer extends WebGLLayerRenderer {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The transformation matrix to get the pixel on the image for a
|
* The transformation matrix to get the pixel on the image for a
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
* @module ol/source/Source
|
* @module ol/source/Source
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {VOID} from '../functions.js';
|
|
||||||
import BaseObject from '../Object.js';
|
import BaseObject from '../Object.js';
|
||||||
import {get as getProjection} from '../proj.js';
|
import {get as getProjection} from '../proj.js';
|
||||||
import SourceState from './State.js';
|
import SourceState from './State.js';
|
||||||
@@ -173,18 +172,6 @@ class Source extends BaseObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
|
||||||
* @param {number} resolution Resolution.
|
|
||||||
* @param {number} rotation Rotation.
|
|
||||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
|
||||||
* @param {Object<string, boolean>} skippedFeatureUids Skipped feature uids.
|
|
||||||
* @param {function(import("../Feature.js").FeatureLike): T} callback Feature callback.
|
|
||||||
* @return {T|void} Callback result.
|
|
||||||
* @template T
|
|
||||||
*/
|
|
||||||
Source.prototype.forEachFeatureAtCoordinate = VOID;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns the attributions option into an attributions function.
|
* Turns the attributions option into an attributions function.
|
||||||
|
|||||||
Reference in New Issue
Block a user