Use Source as default parameter for Layer.

This commit is contained in:
Simon Seyock
2021-08-06 10:16:20 +02:00
parent d7b443bf44
commit d6e0eb75fa
7 changed files with 16 additions and 16 deletions

View File

@@ -11,7 +11,7 @@ import {listen, unlistenByKey} from './events.js';
*/
/**
* @typedef {Feature|import("./render/Feature.js").default} FeatureLike
* @typedef {Feature<import("./geom/Geometry.js").default>|import("./render/Feature.js").default} FeatureLike
*/
/***

View File

@@ -66,7 +66,7 @@ import {removeNode} from './dom.js';
/**
* @typedef {Object} AtPixelOptions
* @property {undefined|function(import("./layer/Layer.js").default): boolean} [layerFilter] Layer filter
* @property {undefined|function(import("./layer/Layer.js").default<import("./source/Source").default>): boolean} [layerFilter] Layer filter
* function. The filter function will receive one argument, the
* {@link module:ol/layer/Layer layer-candidate} and it should return a boolean value.
* Only layers which are visible and for which this function returns `true`
@@ -553,7 +553,7 @@ class PluggableMap extends BaseObject {
* callback with each intersecting feature. Layers included in the detection can
* be configured through the `layerFilter` option in `opt_options`.
* @param {import("./pixel.js").Pixel} pixel Pixel.
* @param {function(import("./Feature.js").FeatureLike, import("./layer/Layer.js").default, import("./geom/SimpleGeometry.js").default): T} callback Feature callback. The callback will be
* @param {function(import("./Feature.js").FeatureLike, import("./layer/Layer.js").default<import("./source/Source").default>, import("./geom/SimpleGeometry.js").default): T} callback Feature callback. The callback will be
* called with two arguments. The first argument is one
* {@link module:ol/Feature feature} or
* {@link module:ol/render/Feature render feature} at the pixel, the second is

View File

@@ -30,7 +30,7 @@ const SelectEventType = {
* {@link module:ol/render/Feature} and an
* {@link module:ol/layer/Layer} and returns `true` if the feature may be
* selected or `false` otherwise.
* @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default):boolean} FilterFunction
* @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default<import("../source/Source").default>):boolean} FilterFunction
*/
/**
@@ -49,7 +49,7 @@ const SelectEventType = {
* feature removes all from the selection.
* See `toggle`, `add`, `remove` options for adding/removing extra features to/
* from the selection.
* @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default): boolean} [layers]
* @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} [layers]
* A list of layers from which features should be selected. Alternatively, a
* filter function can be provided. The function will be called for each layer
* in the map and should return `true` for layers that you want to be
@@ -252,7 +252,7 @@ class Select extends Interaction {
*/
this.features_ = options.features || new Collection();
/** @type {function(import("../layer/Layer.js").default): boolean} */
/** @type {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} */
let layerFilter;
if (options.layers) {
if (typeof options.layers === 'function') {
@@ -269,7 +269,7 @@ class Select extends Interaction {
/**
* @private
* @type {function(import("../layer/Layer.js").default): boolean}
* @type {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean}
*/
this.layerFilter_ = layerFilter;

View File

@@ -38,7 +38,7 @@ const TranslateEventType = {
* {@link module:ol/render/Feature} and an
* {@link module:ol/layer/Layer} and returns `true` if the feature may be
* translated or `false` otherwise.
* @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default):boolean} FilterFunction
* @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default<import("../source/Source").default>):boolean} FilterFunction
*/
/**
@@ -49,7 +49,7 @@ const TranslateEventType = {
* Default is {@link module:ol/events/condition.always}.
* @property {Collection<import("../Feature.js").default>} [features] Only features contained in this collection will be able to be translated. If
* not specified, all features on the map will be able to be translated.
* @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default): boolean} [layers] A list of layers from which features should be
* @property {Array<import("../layer/Layer.js").default>|function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} [layers] A list of layers from which features should be
* translated. Alternatively, a filter function can be provided. The
* function will be called for each layer in the map and should return
* `true` for layers that you want to be translatable. If the option is
@@ -171,7 +171,7 @@ class Translate extends PointerInteraction {
*/
this.features_ = options.features !== undefined ? options.features : null;
/** @type {function(import("../layer/Layer.js").default): boolean} */
/** @type {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} */
let layerFilter;
if (options.layers) {
if (typeof options.layers === 'function') {
@@ -188,7 +188,7 @@ class Translate extends PointerInteraction {
/**
* @private
* @type {function(import("../layer/Layer.js").default): boolean}
* @type {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean}
*/
this.layerFilter_ = layerFilter;

View File

@@ -153,9 +153,9 @@ class CompositeMapRenderer extends MapRenderer {
* @param {import("../pixel.js").Pixel} pixel Pixel.
* @param {import("../PluggableMap.js").FrameState} frameState FrameState.
* @param {number} hitTolerance Hit tolerance in pixels.
* @param {function(import("../layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback Layer
* @param {function(import("../layer/Layer.js").default<import("../source/Source").default>, (Uint8ClampedArray|Uint8Array)): T} callback Layer
* callback.
* @param {function(import("../layer/Layer.js").default): boolean} layerFilter Layer filter
* @param {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} layerFilter Layer filter
* function, only layers which are visible and for which this function
* returns `true` will be tested for features. By default, all visible
* layers will be tested.

View File

@@ -175,9 +175,9 @@ class MapRenderer extends Disposable {
* @param {import("../pixel.js").Pixel} pixel Pixel.
* @param {import("../PluggableMap.js").FrameState} frameState FrameState.
* @param {number} hitTolerance Hit tolerance in pixels.
* @param {function(import("../layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback Layer
* @param {function(import("../layer/Layer.js").default<import("../source/Source".).default>, (Uint8ClampedArray|Uint8Array)): T} callback Layer
* callback.
* @param {function(import("../layer/Layer.js").default): boolean} layerFilter Layer filter
* @param {function(import("../layer/Layer.js").default<import("../source/Source").default>): boolean} layerFilter Layer filter
* function, only layers which are visible and for which this function
* returns `true` will be tested for features. By default, all visible
* layers will be tested.

View File

@@ -13,7 +13,7 @@ import {getUid} from '../util.js';
* unmanaged layers. The third is the {@link module:ol/geom/SimpleGeometry} of the feature. For features
* with a GeometryCollection geometry, it will be the first detected geometry from the collection.
* @template T
* @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default, import("../geom/SimpleGeometry.js").default): T} FeatureCallback
* @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default<import("../source/Source").default>, import("../geom/SimpleGeometry.js").default): T} FeatureCallback
*/
/**