diff --git a/src/ol/render/VectorContext.js b/src/ol/render/VectorContext.js index 6db35837b0..1cb23a7757 100644 --- a/src/ol/render/VectorContext.js +++ b/src/ol/render/VectorContext.js @@ -123,14 +123,14 @@ VectorContext.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {} /** * @param {module:ol/style/Image~ImageStyle} imageStyle Image style. - * @param {ol.DeclutterGroup=} opt_declutterGroup Declutter. + * @param {module:ol/render/canvas~DeclutterGroup=} opt_declutterGroup Declutter. */ VectorContext.prototype.setImageStyle = function(imageStyle, opt_declutterGroup) {}; /** * @param {module:ol/style/Text~Text} textStyle Text style. - * @param {ol.DeclutterGroup=} opt_declutterGroup Declutter. + * @param {module:ol/render/canvas~DeclutterGroup=} opt_declutterGroup Declutter. */ VectorContext.prototype.setTextStyle = function(textStyle, opt_declutterGroup) {}; export default VectorContext; diff --git a/src/ol/render/canvas.js b/src/ol/render/canvas.js index fccdaaa284..63fc95960c 100644 --- a/src/ol/render/canvas.js +++ b/src/ol/render/canvas.js @@ -55,6 +55,19 @@ import {create as createTransform} from '../transform.js'; */ +/** + * Container for decluttered replay instructions that need to be rendered or + * omitted together, i.e. when styles render both an image and text, or for the + * characters that form text along lines. The basic elements of this array are + * `[minX, minY, maxX, maxY, count]`, where the first four entries are the + * rendered extent of the group in pixel space. `count` is the number of styles + * in the group, i.e. 2 when an image and a text are grouped, or 1 otherwise. + * In addition to these four elements, declutter instruction arrays (i.e. the + * arguments to @{link ol.render.canvas.drawImage} are appended to the array. + * @typedef {Array.<*>} DeclutterGroup + */ + + /** * @const * @type {string} diff --git a/src/ol/render/canvas/ImageReplay.js b/src/ol/render/canvas/ImageReplay.js index ece28508b8..17b80f83a4 100644 --- a/src/ol/render/canvas/ImageReplay.js +++ b/src/ol/render/canvas/ImageReplay.js @@ -23,7 +23,7 @@ const CanvasImageReplay = function( /** * @private - * @type {ol.DeclutterGroup} + * @type {module:ol/render/canvas~DeclutterGroup} */ this.declutterGroup_ = null; @@ -217,7 +217,7 @@ CanvasImageReplay.prototype.setImageStyle = function(imageStyle, declutterGroup) const origin = imageStyle.getOrigin(); this.anchorX_ = anchor[0]; this.anchorY_ = anchor[1]; - this.declutterGroup_ = /** @type {ol.DeclutterGroup} */ (declutterGroup); + this.declutterGroup_ = /** @type {module:ol/render/canvas~DeclutterGroup} */ (declutterGroup); this.hitDetectionImage_ = hitDetectionImage; this.image_ = image; this.height_ = size[1]; diff --git a/src/ol/render/canvas/Replay.js b/src/ol/render/canvas/Replay.js index fac7974624..df6801abe5 100644 --- a/src/ol/render/canvas/Replay.js +++ b/src/ol/render/canvas/Replay.js @@ -208,7 +208,7 @@ CanvasReplay.prototype.replayTextBackground_ = function(context, p1, p2, p3, p4, * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} image Image. * @param {number} anchorX Anchor X. * @param {number} anchorY Anchor Y. - * @param {ol.DeclutterGroup} declutterGroup Declutter group. + * @param {module:ol/render/canvas~DeclutterGroup} declutterGroup Declutter group. * @param {number} height Height. * @param {number} opacity Opacity. * @param {number} originX Origin X. @@ -486,7 +486,7 @@ CanvasReplay.prototype.setStrokeStyle_ = function(context, instruction) { /** - * @param {ol.DeclutterGroup} declutterGroup Declutter group. + * @param {module:ol/render/canvas~DeclutterGroup} declutterGroup Declutter group. * @param {module:ol/Feature~Feature|ol.render.Feature} feature Feature. */ CanvasReplay.prototype.renderDeclutter_ = function(declutterGroup, feature) { @@ -656,7 +656,7 @@ CanvasReplay.prototype.replay_ = function( // Remaining arguments in DRAW_IMAGE are in alphabetical order anchorX = /** @type {number} */ (instruction[4]); anchorY = /** @type {number} */ (instruction[5]); - declutterGroup = featureCallback ? null : /** @type {ol.DeclutterGroup} */ (instruction[6]); + declutterGroup = featureCallback ? null : /** @type {module:ol/render/canvas~DeclutterGroup} */ (instruction[6]); const height = /** @type {number} */ (instruction[7]); const opacity = /** @type {number} */ (instruction[8]); const originX = /** @type {number} */ (instruction[9]); @@ -695,7 +695,7 @@ CanvasReplay.prototype.replay_ = function( const begin = /** @type {number} */ (instruction[1]); const end = /** @type {number} */ (instruction[2]); const baseline = /** @type {number} */ (instruction[3]); - declutterGroup = featureCallback ? null : /** @type {ol.DeclutterGroup} */ (instruction[4]); + declutterGroup = featureCallback ? null : /** @type {module:ol/render/canvas~DeclutterGroup} */ (instruction[4]); const overflow = /** @type {number} */ (instruction[5]); const fillKey = /** @type {string} */ (instruction[6]); const maxAngle = /** @type {number} */ (instruction[7]); diff --git a/src/ol/render/canvas/ReplayGroup.js b/src/ol/render/canvas/ReplayGroup.js index a672f4f9bd..9d2c019dc8 100644 --- a/src/ol/render/canvas/ReplayGroup.js +++ b/src/ol/render/canvas/ReplayGroup.js @@ -21,7 +21,7 @@ import {create as createTransform, compose as composeTransform} from '../../tran /** * @type {Object.)>} + * number, number, boolean, Array.)>} */ const BATCH_CONSTRUCTORS = { 'Circle': CanvasPolygonReplay, @@ -57,7 +57,7 @@ const CanvasReplayGroup = function( this.declutterTree_ = declutterTree; /** - * @type {ol.DeclutterGroup} + * @type {module:ol/render/canvas~DeclutterGroup} * @private */ this.declutterGroup_ = null; @@ -219,7 +219,7 @@ export function replayDeclutter(declutterReplays, context, rotation) { /** * @param {boolean} group Group with previous replay. - * @return {ol.DeclutterGroup} Declutter instruction group. + * @return {module:ol/render/canvas~DeclutterGroup} Declutter instruction group. */ CanvasReplayGroup.prototype.addDeclutter = function(group) { let declutter = null; @@ -290,7 +290,7 @@ CanvasReplayGroup.prototype.finish = function() { * to skip. * @param {function((module:ol/Feature~Feature|ol.render.Feature)): T} callback Feature * callback. - * @param {Object.} declutterReplays Declutter + * @param {Object.} declutterReplays Declutter * replays. * @return {T|undefined} Callback result. * @template T @@ -457,7 +457,7 @@ CanvasReplayGroup.prototype.isEmpty = function() { * to skip. * @param {Array.=} opt_replayTypes Ordered replay types * to replay. Default is {@link ol.render.replay.ORDER} - * @param {Object.=} opt_declutterReplays Declutter + * @param {Object.=} opt_declutterReplays Declutter * replays. */ CanvasReplayGroup.prototype.replay = function(context, diff --git a/src/ol/render/canvas/TextReplay.js b/src/ol/render/canvas/TextReplay.js index 9ece71e546..fbcb313fa1 100644 --- a/src/ol/render/canvas/TextReplay.js +++ b/src/ol/render/canvas/TextReplay.js @@ -32,7 +32,7 @@ const CanvasTextReplay = function( /** * @private - * @type {ol.DeclutterGroup} + * @type {module:ol/render/canvas~DeclutterGroup} */ this.declutterGroup_; @@ -381,7 +381,7 @@ CanvasTextReplay.prototype.drawTextImage_ = function(label, begin, end) { * @private * @param {number} begin Begin. * @param {number} end End. - * @param {ol.DeclutterGroup} declutterGroup Declutter group. + * @param {module:ol/render/canvas~DeclutterGroup} declutterGroup Declutter group. */ CanvasTextReplay.prototype.drawChars_ = function(begin, end, declutterGroup) { const strokeState = this.textStrokeState_; @@ -466,7 +466,7 @@ CanvasTextReplay.prototype.setTextStyle = function(textStyle, declutterGroup) { if (!textStyle) { this.text_ = ''; } else { - this.declutterGroup_ = /** @type {ol.DeclutterGroup} */ (declutterGroup); + this.declutterGroup_ = /** @type {module:ol/render/canvas~DeclutterGroup} */ (declutterGroup); const textFillStyle = textStyle.getFill(); if (!textFillStyle) { diff --git a/src/ol/typedefs.js b/src/ol/typedefs.js index a1b4dbba2d..666a15b52d 100644 --- a/src/ol/typedefs.js +++ b/src/ol/typedefs.js @@ -21,20 +21,6 @@ const ol = {}; */ -/** - * Container for decluttered replay instructions that need to be rendered or - * omitted together, i.e. when styles render both an image and text, or for the - * characters that form text along lines. The basic elements of this array are - * `[minX, minY, maxX, maxY, count]`, where the first four entries are the - * rendered extent of the group in pixel space. `count` is the number of styles - * in the group, i.e. 2 when an image and a text are grouped, or 1 otherwise. - * In addition to these four elements, declutter instruction arrays (i.e. the - * arguments to @{link ol.render.canvas.drawImage} are appended to the array. - * @typedef {Array.<*>} - */ -ol.DeclutterGroup; - - /** * A function that takes an {@link module:ol/extent~Extent} and a resolution as arguments, and * returns an array of {@link module:ol/extent~Extent} with the extents to load. Usually this