Use FeatureLike typedef
Use `import("./Feature.js").FeatureLike` typedef instead of `import("./Feature.js").default|import("./render/Feature.js").default`
This commit is contained in:
@@ -546,7 +546,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(this: S, (import("./Feature.js").default|import("./render/Feature.js").default),
|
||||
* @param {function(this: S, import("./Feature.js").FeatureLike,
|
||||
* import("./layer/Layer.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
|
||||
@@ -579,7 +579,7 @@ class PluggableMap extends BaseObject {
|
||||
* Get all features that intersect a pixel on the viewport.
|
||||
* @param {import("./pixel.js").Pixel} pixel Pixel.
|
||||
* @param {AtPixelOptions=} opt_options Optional options.
|
||||
* @return {Array<import("./Feature.js").default|import("./render/Feature.js").default>} The detected features or
|
||||
* @return {Array<import("./Feature.js").FeatureLike>} The detected features or
|
||||
* `null` if none were found.
|
||||
* @api
|
||||
*/
|
||||
|
||||
@@ -114,7 +114,7 @@ class VectorTile extends Tile {
|
||||
/**
|
||||
* Get the features for this tile. Geometries will be in the projection returned
|
||||
* by {@link module:ol/VectorTile~VectorTile#getProjection}.
|
||||
* @return {Array<import("./Feature.js").default|import("./render/Feature.js").default>} Features.
|
||||
* @return {Array<import("./Feature.js").FeatureLike>} Features.
|
||||
* @api
|
||||
*/
|
||||
getFeatures() {
|
||||
|
||||
@@ -161,7 +161,7 @@ class MVT extends FeatureFormat {
|
||||
* @param {Object} pbf PBF
|
||||
* @param {Object} rawFeature Raw Mapbox feature.
|
||||
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
|
||||
* @return {import("../Feature.js").default|RenderFeature} Feature.
|
||||
* @return {import("../Feature.js").FeatureLike} Feature.
|
||||
*/
|
||||
createFeature_(pbf, rawFeature, opt_options) {
|
||||
const type = rawFeature.type;
|
||||
@@ -246,7 +246,7 @@ class MVT extends FeatureFormat {
|
||||
|
||||
const pbf = new PBF(/** @type {ArrayBuffer} */ (source));
|
||||
const pbfLayers = pbf.readFields(layersPBFReader, {});
|
||||
/** @type {Array<import("../Feature.js").default|RenderFeature>} */
|
||||
/** @type {Array<import("../Feature.js").FeatureLike>} */
|
||||
const features = [];
|
||||
for (const name in pbfLayers) {
|
||||
if (layers && layers.indexOf(name) == -1) {
|
||||
|
||||
@@ -34,8 +34,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").default|import("../render/Feature.js").default), import("../layer/Layer.js").default):
|
||||
* boolean} FilterFunction
|
||||
* @typedef {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default):boolean} FilterFunction
|
||||
*/
|
||||
|
||||
|
||||
@@ -263,7 +262,7 @@ class Select extends Interaction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {import("../layer/Layer.js").default} layer Layer.
|
||||
* @private
|
||||
*/
|
||||
@@ -295,7 +294,7 @@ class Select extends Interaction {
|
||||
* the (last) selected feature. Note that this will not work with any
|
||||
* programmatic method like pushing features to
|
||||
* {@link module:ol/interaction/Select~Select#getFeatures collection}.
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature
|
||||
* @return {VectorLayer} Layer.
|
||||
* @api
|
||||
*/
|
||||
@@ -370,7 +369,7 @@ class Select extends Interaction {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
removeFeatureLayerAssociation_(feature) {
|
||||
@@ -407,7 +406,7 @@ function handleEvent(mapBrowserEvent) {
|
||||
map.forEachFeatureAtPixel(mapBrowserEvent.pixel,
|
||||
(
|
||||
/**
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {import("../layer/Layer.js").default} layer Layer.
|
||||
* @return {boolean|undefined} Continue to iterate over the features.
|
||||
*/
|
||||
@@ -440,7 +439,7 @@ function handleEvent(mapBrowserEvent) {
|
||||
map.forEachFeatureAtPixel(mapBrowserEvent.pixel,
|
||||
(
|
||||
/**
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {import("../layer/Layer.js").default} layer Layer.
|
||||
* @return {boolean|undefined} Continue to iterate over the features.
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@ import CanvasImmediateRenderer from './render/canvas/Immediate.js';
|
||||
/**
|
||||
* @typedef {Object} State
|
||||
* @property {CanvasRenderingContext2D} context Canvas context that the layer is being rendered to.
|
||||
* @property {import("./Feature.js").default|import("./render/Feature.js").default} feature
|
||||
* @property {import("./Feature.js").FeatureLike} feature
|
||||
* @property {import("./geom/SimpleGeometry.js").default} geometry
|
||||
* @property {number} pixelRatio Pixel ratio used by the layer renderer.
|
||||
* @property {number} resolution Resolution that the render batch was created and optimized for.
|
||||
@@ -23,8 +23,7 @@ import CanvasImmediateRenderer from './render/canvas/Immediate.js';
|
||||
* It takes two instances of {@link module:ol/Feature} or
|
||||
* {@link module:ol/render/Feature} and returns a `{number}`.
|
||||
*
|
||||
* @typedef {function((import("./Feature.js").default|import("./render/Feature.js").default),
|
||||
* (import("./Feature.js").default|import("./render/Feature.js").default)):number} OrderFunction
|
||||
* @typedef {function(import("./Feature.js").FeatureLike, import("./Feature.js").FeatureLike):number} OrderFunction
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class LayerRenderer extends Observable {
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState Frame state.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @param {function((import("../Feature.js").default|import("../render/Feature.js").default), import("../layer/Layer.js").default): T} callback Feature callback.
|
||||
* @param {function(import("../Feature.js").FeatureLike, import("../layer/Layer.js").default): T} callback Feature callback.
|
||||
* @return {T|void} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
|
||||
@@ -93,7 +93,7 @@ class MapRenderer extends Disposable {
|
||||
* @param {import("../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {import("../PluggableMap.js").FrameState} frameState FrameState.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @param {function(this: S, (import("../Feature.js").default|import("../render/Feature.js").default),
|
||||
* @param {function(this: S, import("../Feature.js").FeatureLike,
|
||||
* import("../layer/Layer.js").default): T} callback Feature callback.
|
||||
* @param {S} thisArg Value to use as `this` when executing `callback`.
|
||||
* @param {function(this: U, import("../layer/Layer.js").default): boolean} layerFilter Layer filter
|
||||
@@ -118,7 +118,7 @@ class MapRenderer extends Disposable {
|
||||
const viewResolution = viewState.resolution;
|
||||
|
||||
/**
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {import("../layer/Layer.js").default} layer Layer.
|
||||
* @return {?} Callback result.
|
||||
*/
|
||||
|
||||
@@ -99,7 +99,7 @@ class IntermediateCanvasRenderer extends CanvasLayerRenderer {
|
||||
return source.forEachFeatureAtCoordinate(
|
||||
coordinate, resolution, rotation, hitTolerance, skippedFeatureUids,
|
||||
/**
|
||||
* @param {import("../../Feature.js").default|import("../../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
* @return {?} Callback result.
|
||||
*/
|
||||
function(feature) {
|
||||
|
||||
@@ -240,7 +240,7 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
|
||||
const features = {};
|
||||
const result = this.replayGroup_.forEachFeatureAtCoordinate(coordinate, resolution, rotation, hitTolerance, {},
|
||||
/**
|
||||
* @param {import("../../Feature.js").default|import("../../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
* @return {?} Callback result.
|
||||
*/
|
||||
function(feature) {
|
||||
|
||||
@@ -182,7 +182,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
||||
const squaredTolerance = getSquaredRenderTolerance(resolution, pixelRatio);
|
||||
|
||||
/**
|
||||
* @param {import("../../Feature.js").default|import("../../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
* @this {CanvasVectorTileLayerRenderer}
|
||||
*/
|
||||
const render = function(feature) {
|
||||
@@ -257,7 +257,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
||||
replayGroup = sourceTile.getReplayGroup(layer, tile.tileCoord.toString());
|
||||
found = found || replayGroup.forEachFeatureAtCoordinate(coordinate, resolution, rotation, hitTolerance, {},
|
||||
/**
|
||||
* @param {import("../../Feature.js").default|import("../../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
* @return {?} Callback result.
|
||||
*/
|
||||
function(feature) {
|
||||
@@ -411,7 +411,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("../../Feature.js").default|import("../../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @param {import("../../style/Style.js").default|Array<import("../../style/Style.js").default>} styles The style or array of styles.
|
||||
* @param {import("../../render/canvas/ReplayGroup.js").default} replayGroup Replay group.
|
||||
|
||||
@@ -33,8 +33,8 @@ const GEOMETRY_RENDERERS = {
|
||||
|
||||
|
||||
/**
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature1 Feature 1.
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature2 Feature 2.
|
||||
* @param {import("../Feature.js").FeatureLike} feature1 Feature 1.
|
||||
* @param {import("../Feature.js").FeatureLike} feature2 Feature 2.
|
||||
* @return {number} Order.
|
||||
*/
|
||||
export function defaultOrder(feature1, feature2) {
|
||||
@@ -88,7 +88,7 @@ function renderCircleGeometry(replayGroup, geometry, style, feature) {
|
||||
|
||||
/**
|
||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {import("../style/Style.js").default} style Style.
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @param {function(this: T, import("../events/Event.js").default)} listener Listener function.
|
||||
@@ -120,7 +120,7 @@ export function renderFeature(replayGroup, feature, style, squaredTolerance, lis
|
||||
|
||||
/**
|
||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {import("../style/Style.js").default} style Style.
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
*/
|
||||
@@ -144,7 +144,7 @@ function renderFeatureInternal(replayGroup, feature, style, squaredTolerance) {
|
||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
||||
* @param {import("../geom/Geometry.js").default} geometry Geometry.
|
||||
* @param {import("../style/Style.js").default} style Style.
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
function renderGeometry(replayGroup, geometry, style, feature) {
|
||||
if (geometry.getType() == GeometryType.GEOMETRY_COLLECTION) {
|
||||
@@ -180,7 +180,7 @@ function renderGeometryCollectionGeometry(replayGroup, geometry, style, feature)
|
||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
||||
* @param {import("../geom/LineString.js").default|import("../render/Feature.js").default} geometry Geometry.
|
||||
* @param {import("../style/Style.js").default} style Style.
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
function renderLineStringGeometry(replayGroup, geometry, style, feature) {
|
||||
const strokeStyle = style.getStroke();
|
||||
@@ -202,7 +202,7 @@ function renderLineStringGeometry(replayGroup, geometry, style, feature) {
|
||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
||||
* @param {import("../geom/MultiLineString.js").default|import("../render/Feature.js").default} geometry Geometry.
|
||||
* @param {import("../style/Style.js").default} style Style.
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
function renderMultiLineStringGeometry(replayGroup, geometry, style, feature) {
|
||||
const strokeStyle = style.getStroke();
|
||||
@@ -247,7 +247,7 @@ function renderMultiPolygonGeometry(replayGroup, geometry, style, feature) {
|
||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
||||
* @param {import("../geom/Point.js").default|import("../render/Feature.js").default} geometry Geometry.
|
||||
* @param {import("../style/Style.js").default} style Style.
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
function renderPointGeometry(replayGroup, geometry, style, feature) {
|
||||
const imageStyle = style.getImage();
|
||||
@@ -272,7 +272,7 @@ function renderPointGeometry(replayGroup, geometry, style, feature) {
|
||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
||||
* @param {import("../geom/MultiPoint.js").default|import("../render/Feature.js").default} geometry Geometry.
|
||||
* @param {import("../style/Style.js").default} style Style.
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
function renderMultiPointGeometry(replayGroup, geometry, style, feature) {
|
||||
const imageStyle = style.getImage();
|
||||
@@ -297,7 +297,7 @@ function renderMultiPointGeometry(replayGroup, geometry, style, feature) {
|
||||
* @param {import("../render/ReplayGroup.js").default} replayGroup Replay group.
|
||||
* @param {import("../geom/Polygon.js").default|import("../render/Feature.js").default} geometry Geometry.
|
||||
* @param {import("../style/Style.js").default} style Style.
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
*/
|
||||
function renderPolygonGeometry(replayGroup, geometry, style, feature) {
|
||||
const fillStyle = style.getFill();
|
||||
|
||||
@@ -88,7 +88,7 @@ class WebGLImageLayerRenderer extends WebGLLayerRenderer {
|
||||
coordinate, resolution, rotation, hitTolerance, skippedFeatureUids,
|
||||
|
||||
/**
|
||||
* @param {import("../../Feature.js").default|import("../../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
* @return {?} Callback result.
|
||||
*/
|
||||
function(feature) {
|
||||
|
||||
@@ -124,7 +124,7 @@ class WebGLVectorLayerRenderer extends WebGLLayerRenderer {
|
||||
frameState.size, frameState.pixelRatio, layerState.opacity,
|
||||
{},
|
||||
/**
|
||||
* @param {import("../../Feature.js").default|import("../../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../../Feature.js").FeatureLike} feature Feature.
|
||||
* @return {?} Callback result.
|
||||
*/
|
||||
function(feature) {
|
||||
|
||||
@@ -188,7 +188,7 @@ class Source extends BaseObject {
|
||||
* @param {number} rotation Rotation.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @param {Object<string, boolean>} skippedFeatureUids Skipped feature uids.
|
||||
* @param {function((import("../Feature.js").default|import("../render/Feature.js").default)): T} callback Feature callback.
|
||||
* @param {function(import("../Feature.js").FeatureLike): T} callback Feature callback.
|
||||
* @return {T|void} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
|
||||
@@ -100,8 +100,7 @@ import Stroke from '../style/Stroke.js';
|
||||
* {@link module:ol/style/Style} or an array of them. This way e.g. a
|
||||
* vector layer can be styled.
|
||||
*
|
||||
* @typedef {function((import("../Feature.js").default|import("../render/Feature.js").default), number):
|
||||
* (Style|Array<Style>)} StyleFunction
|
||||
* @typedef {function(import("../Feature.js").FeatureLike, number):(Style|Array<Style>)} StyleFunction
|
||||
*/
|
||||
|
||||
|
||||
@@ -109,7 +108,7 @@ import Stroke from '../style/Stroke.js';
|
||||
* A function that takes an {@link module:ol/Feature} as argument and returns an
|
||||
* {@link module:ol/geom/Geometry} that will be rendered and styled for the feature.
|
||||
*
|
||||
* @typedef {function((import("../Feature.js").default|import("../render/Feature.js").default)):
|
||||
* @typedef {function(import("../Feature.js").FeatureLike):
|
||||
* (import("../geom/Geometry.js").default|import("../render/Feature.js").default|undefined)} GeometryFunction
|
||||
*/
|
||||
|
||||
@@ -431,7 +430,7 @@ let defaultStyles = null;
|
||||
|
||||
|
||||
/**
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {number} resolution Resolution.
|
||||
* @return {Array<Style>} Style.
|
||||
*/
|
||||
@@ -538,7 +537,7 @@ export function createEditingStyle() {
|
||||
|
||||
/**
|
||||
* Function that is called with a feature and returns its default geometry.
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature to get the geometry for.
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature to get the geometry for.
|
||||
* @return {import("../geom/Geometry.js").default|import("../render/Feature.js").default|undefined} Geometry to render.
|
||||
*/
|
||||
function defaultGeometryFunction(feature) {
|
||||
|
||||
Reference in New Issue
Block a user