Use Array<Foo> instead of Array.<Foo>
This commit is contained in:
@@ -103,7 +103,7 @@ class CanvasImageReplay extends CanvasReplay {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {Array<number>} flatCoordinates Flat coordinates.
|
||||
* @param {number} offset Offset.
|
||||
* @param {number} end End.
|
||||
* @param {number} stride Stride.
|
||||
|
||||
@@ -224,7 +224,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<number>}
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
this.pixelCoordinates_ = [];
|
||||
|
||||
@@ -237,7 +237,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {Array<number>} flatCoordinates Flat coordinates.
|
||||
* @param {number} offset Offset.
|
||||
* @param {number} end End.
|
||||
* @param {number} stride Stride.
|
||||
@@ -290,7 +290,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {Array<number>} flatCoordinates Flat coordinates.
|
||||
* @param {number} offset Offset.
|
||||
* @param {number} end End.
|
||||
* @param {number} stride Stride.
|
||||
@@ -339,7 +339,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {Array<number>} flatCoordinates Flat coordinates.
|
||||
* @param {number} offset Offset.
|
||||
* @param {number} end End.
|
||||
* @param {number} stride Stride.
|
||||
@@ -367,9 +367,9 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {Array<number>} flatCoordinates Flat coordinates.
|
||||
* @param {number} offset Offset.
|
||||
* @param {Array.<number>} ends Ends.
|
||||
* @param {Array<number>} ends Ends.
|
||||
* @param {number} stride Stride.
|
||||
* @private
|
||||
* @return {number} End.
|
||||
|
||||
@@ -23,25 +23,25 @@ const Instruction = {
|
||||
|
||||
|
||||
/**
|
||||
* @type {Array.<Instruction>}
|
||||
* @type {Array<Instruction>}
|
||||
*/
|
||||
export const fillInstruction = [Instruction.FILL];
|
||||
|
||||
|
||||
/**
|
||||
* @type {Array.<Instruction>}
|
||||
* @type {Array<Instruction>}
|
||||
*/
|
||||
export const strokeInstruction = [Instruction.STROKE];
|
||||
|
||||
|
||||
/**
|
||||
* @type {Array.<Instruction>}
|
||||
* @type {Array<Instruction>}
|
||||
*/
|
||||
export const beginPathInstruction = [Instruction.BEGIN_PATH];
|
||||
|
||||
|
||||
/**
|
||||
* @type {Array.<Instruction>}
|
||||
* @type {Array<Instruction>}
|
||||
*/
|
||||
export const closePathInstruction = [Instruction.CLOSE_PATH];
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class CanvasLineStringReplay extends CanvasReplay {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {Array<number>} flatCoordinates Flat coordinates.
|
||||
* @param {number} offset Offset.
|
||||
* @param {number} end End.
|
||||
* @param {number} stride Stride.
|
||||
|
||||
@@ -24,9 +24,9 @@ class CanvasPolygonReplay extends CanvasReplay {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {Array<number>} flatCoordinates Flat coordinates.
|
||||
* @param {number} offset Offset.
|
||||
* @param {Array.<number>} ends Ends.
|
||||
* @param {Array<number>} ends Ends.
|
||||
* @param {number} stride Stride.
|
||||
* @private
|
||||
* @return {number} End.
|
||||
|
||||
@@ -104,13 +104,13 @@ class CanvasReplay extends VectorContext {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<*>}
|
||||
* @type {Array<*>}
|
||||
*/
|
||||
this.beginGeometryInstruction1_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<*>}
|
||||
* @type {Array<*>}
|
||||
*/
|
||||
this.beginGeometryInstruction2_ = null;
|
||||
|
||||
@@ -122,19 +122,19 @@ class CanvasReplay extends VectorContext {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {Array.<*>}
|
||||
* @type {Array<*>}
|
||||
*/
|
||||
this.instructions = [];
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {Array.<number>}
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
this.coordinates = [];
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!Object.<number,module:ol/coordinate~Coordinate|Array.<module:ol/coordinate~Coordinate>|Array.<Array.<module:ol/coordinate~Coordinate>>>}
|
||||
* @type {!Object.<number,module:ol/coordinate~Coordinate|Array<module:ol/coordinate~Coordinate>|Array<Array<module:ol/coordinate~Coordinate>>>}
|
||||
*/
|
||||
this.coordinateCache_ = {};
|
||||
|
||||
@@ -146,13 +146,13 @@ class CanvasReplay extends VectorContext {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {Array.<*>}
|
||||
* @type {Array<*>}
|
||||
*/
|
||||
this.hitDetectionInstructions = [];
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<number>}
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
this.pixelCoordinates_ = null;
|
||||
|
||||
@@ -176,8 +176,8 @@ class CanvasReplay extends VectorContext {
|
||||
* @param {module:ol/coordinate~Coordinate} p2 2nd point of the background box.
|
||||
* @param {module:ol/coordinate~Coordinate} p3 3rd point of the background box.
|
||||
* @param {module:ol/coordinate~Coordinate} p4 4th point of the background box.
|
||||
* @param {Array.<*>} fillInstruction Fill instruction.
|
||||
* @param {Array.<*>} strokeInstruction Stroke instruction.
|
||||
* @param {Array<*>} fillInstruction Fill instruction.
|
||||
* @param {Array<*>} strokeInstruction Stroke instruction.
|
||||
*/
|
||||
replayTextBackground_(context, p1, p2, p3, p4, fillInstruction, strokeInstruction) {
|
||||
context.beginPath();
|
||||
@@ -191,7 +191,7 @@ class CanvasReplay extends VectorContext {
|
||||
this.fill_(context);
|
||||
}
|
||||
if (strokeInstruction) {
|
||||
this.setStrokeStyle_(context, /** @type {Array.<*>} */ (strokeInstruction));
|
||||
this.setStrokeStyle_(context, /** @type {Array<*>} */ (strokeInstruction));
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
@@ -212,9 +212,9 @@ class CanvasReplay extends VectorContext {
|
||||
* @param {number} scale Scale.
|
||||
* @param {boolean} snapToPixel Snap to pixel.
|
||||
* @param {number} width Width.
|
||||
* @param {Array.<number>} padding Padding.
|
||||
* @param {Array.<*>} fillInstruction Fill instruction.
|
||||
* @param {Array.<*>} strokeInstruction Stroke instruction.
|
||||
* @param {Array<number>} padding Padding.
|
||||
* @param {Array<*>} fillInstruction Fill instruction.
|
||||
* @param {Array<*>} strokeInstruction Stroke instruction.
|
||||
*/
|
||||
replayImage_(
|
||||
context,
|
||||
@@ -304,8 +304,8 @@ class CanvasReplay extends VectorContext {
|
||||
} else if (intersects) {
|
||||
if (fillStroke) {
|
||||
this.replayTextBackground_(context, p1, p2, p3, p4,
|
||||
/** @type {Array.<*>} */ (fillInstruction),
|
||||
/** @type {Array.<*>} */ (strokeInstruction));
|
||||
/** @type {Array<*>} */ (fillInstruction),
|
||||
/** @type {Array<*>} */ (strokeInstruction));
|
||||
}
|
||||
drawImage(context, transform, opacity, image, originX, originY, w, h, x, y, scale);
|
||||
}
|
||||
@@ -313,8 +313,8 @@ class CanvasReplay extends VectorContext {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @param {Array.<number>} dashArray Dash array.
|
||||
* @return {Array.<number>} Dash array with pixel ratio applied
|
||||
* @param {Array<number>} dashArray Dash array.
|
||||
* @return {Array<number>} Dash array with pixel ratio applied
|
||||
*/
|
||||
applyPixelRatio(dashArray) {
|
||||
const pixelRatio = this.pixelRatio;
|
||||
@@ -324,7 +324,7 @@ class CanvasReplay extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {Array<number>} flatCoordinates Flat coordinates.
|
||||
* @param {number} offset Offset.
|
||||
* @param {number} end End.
|
||||
* @param {number} stride Stride.
|
||||
@@ -378,11 +378,11 @@ class CanvasReplay extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||
* @param {Array<number>} flatCoordinates Flat coordinates.
|
||||
* @param {number} offset Offset.
|
||||
* @param {Array.<number>} ends Ends.
|
||||
* @param {Array<number>} ends Ends.
|
||||
* @param {number} stride Stride.
|
||||
* @param {Array.<number>} replayEnds Replay ends.
|
||||
* @param {Array<number>} replayEnds Replay ends.
|
||||
* @return {number} Offset.
|
||||
*/
|
||||
drawCustomCoordinates_(flatCoordinates, offset, ends, stride, replayEnds) {
|
||||
@@ -476,7 +476,7 @@ class CanvasReplay extends VectorContext {
|
||||
/**
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} context Context.
|
||||
* @param {Array.<*>} instruction Instruction.
|
||||
* @param {Array<*>} instruction Instruction.
|
||||
*/
|
||||
setStrokeStyle_(context, instruction) {
|
||||
context.strokeStyle = /** @type {module:ol/colorlike~ColorLike} */ (instruction[1]);
|
||||
@@ -486,7 +486,7 @@ class CanvasReplay extends VectorContext {
|
||||
context.miterLimit = /** @type {number} */ (instruction[5]);
|
||||
if (CANVAS_LINE_DASH) {
|
||||
context.lineDashOffset = /** @type {number} */ (instruction[7]);
|
||||
context.setLineDash(/** @type {Array.<number>} */ (instruction[6]));
|
||||
context.setLineDash(/** @type {Array<number>} */ (instruction[6]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -532,7 +532,7 @@ class CanvasReplay extends VectorContext {
|
||||
* @param {module:ol/transform~Transform} transform Transform.
|
||||
* @param {Object.<string, boolean>} skippedFeaturesHash Ids of features
|
||||
* to skip.
|
||||
* @param {Array.<*>} instructions Instructions array.
|
||||
* @param {Array<*>} instructions Instructions array.
|
||||
* @param {function((module:ol/Feature|module:ol/render/Feature)): T|undefined} featureCallback Feature callback.
|
||||
* @param {module:ol/extent~Extent=} opt_hitExtent Only check features that intersect this
|
||||
* extent.
|
||||
@@ -547,7 +547,7 @@ class CanvasReplay extends VectorContext {
|
||||
featureCallback,
|
||||
opt_hitExtent
|
||||
) {
|
||||
/** @type {Array.<number>} */
|
||||
/** @type {Array<number>} */
|
||||
let pixelCoordinates;
|
||||
if (this.pixelCoordinates_ && equals(transform, this.renderedTransform_)) {
|
||||
pixelCoordinates = this.pixelCoordinates_;
|
||||
@@ -677,7 +677,7 @@ class CanvasReplay extends VectorContext {
|
||||
|
||||
let padding, backgroundFill, backgroundStroke;
|
||||
if (instruction.length > 16) {
|
||||
padding = /** @type {Array.<number>} */ (instruction[16]);
|
||||
padding = /** @type {Array<number>} */ (instruction[16]);
|
||||
backgroundFill = /** @type {boolean} */ (instruction[17]);
|
||||
backgroundStroke = /** @type {boolean} */ (instruction[18]);
|
||||
} else {
|
||||
@@ -693,8 +693,8 @@ class CanvasReplay extends VectorContext {
|
||||
pixelCoordinates[d], pixelCoordinates[d + 1], image, anchorX, anchorY,
|
||||
declutterGroup, height, opacity, originX, originY, rotation, scale,
|
||||
snapToPixel, width, padding,
|
||||
backgroundFill ? /** @type {Array.<*>} */ (lastFillInstruction) : null,
|
||||
backgroundStroke ? /** @type {Array.<*>} */ (lastStrokeInstruction) : null);
|
||||
backgroundFill ? /** @type {Array<*>} */ (lastFillInstruction) : null,
|
||||
backgroundStroke ? /** @type {Array<*>} */ (lastStrokeInstruction) : null);
|
||||
}
|
||||
this.renderDeclutter_(declutterGroup, feature);
|
||||
++i;
|
||||
@@ -822,7 +822,7 @@ class CanvasReplay extends VectorContext {
|
||||
context.stroke();
|
||||
pendingStroke = 0;
|
||||
}
|
||||
this.setStrokeStyle_(context, /** @type {Array.<*>} */ (instruction));
|
||||
this.setStrokeStyle_(context, /** @type {Array<*>} */ (instruction));
|
||||
++i;
|
||||
break;
|
||||
case CanvasInstruction.STROKE:
|
||||
@@ -966,7 +966,7 @@ class CanvasReplay extends VectorContext {
|
||||
/**
|
||||
* @param {module:ol/render/canvas~FillStrokeState} state State.
|
||||
* @param {module:ol/geom/Geometry|module:ol/render/Feature} geometry Geometry.
|
||||
* @return {Array.<*>} Fill instruction.
|
||||
* @return {Array<*>} Fill instruction.
|
||||
*/
|
||||
createFill(state, geometry) {
|
||||
const fillStyle = state.fillStyle;
|
||||
@@ -987,7 +987,7 @@ class CanvasReplay extends VectorContext {
|
||||
|
||||
/**
|
||||
* @param {module:ol/render/canvas~FillStrokeState} state State.
|
||||
* @return {Array.<*>} Stroke instruction.
|
||||
* @return {Array<*>} Stroke instruction.
|
||||
*/
|
||||
createStroke(state) {
|
||||
return [
|
||||
@@ -1000,7 +1000,7 @@ class CanvasReplay extends VectorContext {
|
||||
|
||||
/**
|
||||
* @param {module:ol/render/canvas~FillStrokeState} state State.
|
||||
* @param {function(this:module:ol/render/canvas/Replay, module:ol/render/canvas~FillStrokeState, (module:ol/geom/Geometry|module:ol/render/Feature)):Array.<*>} createFill Create fill.
|
||||
* @param {function(this:module:ol/render/canvas/Replay, module:ol/render/canvas~FillStrokeState, (module:ol/geom/Geometry|module:ol/render/Feature)):Array<*>} createFill Create fill.
|
||||
* @param {module:ol/geom/Geometry|module:ol/render/Feature} geometry Geometry.
|
||||
*/
|
||||
updateFillStyle(state, createFill, geometry) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import {create as createTransform, compose as composeTransform} from '../../tran
|
||||
/**
|
||||
* @type {Object.<module:ol/render/ReplayType,
|
||||
* function(new: module:ol/render/canvas/Replay, number, module:ol/extent~Extent,
|
||||
* number, number, boolean, Array.<module:ol/render/canvas~DeclutterGroup>)>}
|
||||
* number, number, boolean, Array<module:ol/render/canvas~DeclutterGroup>)>}
|
||||
*/
|
||||
const BATCH_CONSTRUCTORS = {
|
||||
'Circle': CanvasPolygonReplay,
|
||||
@@ -154,7 +154,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array.<module:ol/render/ReplayType>} replays Replays.
|
||||
* @param {Array<module:ol/render/ReplayType>} replays Replays.
|
||||
* @return {boolean} Has replays of the provided types.
|
||||
*/
|
||||
hasReplays(replays) {
|
||||
@@ -265,7 +265,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
}
|
||||
}
|
||||
|
||||
/** @type {Array.<number>} */
|
||||
/** @type {Array<number>} */
|
||||
const zs = Object.keys(this.replaysByZIndex_).map(Number);
|
||||
zs.sort(numberSafeCompareFunction);
|
||||
|
||||
@@ -300,7 +300,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
|
||||
/**
|
||||
* @param {module:ol/transform~Transform} transform Transform.
|
||||
* @return {Array.<number>} Clip coordinates.
|
||||
* @return {Array<number>} Clip coordinates.
|
||||
*/
|
||||
getClipCoords(transform) {
|
||||
const maxExtent = this.maxExtent_;
|
||||
@@ -353,7 +353,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
* @param {module:ol/transform~Transform} transform Transform.
|
||||
* @param {number} viewRotation View rotation.
|
||||
* @param {Object.<string, boolean>} skippedFeaturesHash Ids of features to skip.
|
||||
* @param {Array.<module:ol/render/ReplayType>=} opt_replayTypes Ordered replay types to replay.
|
||||
* @param {Array<module:ol/render/ReplayType>=} opt_replayTypes Ordered replay types to replay.
|
||||
* Default is {@link module:ol/render/replay~ORDER}
|
||||
* @param {Object.<string, module:ol/render/canvas~DeclutterGroup>=} opt_declutterReplays Declutter replays.
|
||||
*/
|
||||
@@ -366,7 +366,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
opt_declutterReplays
|
||||
) {
|
||||
|
||||
/** @type {Array.<number>} */
|
||||
/** @type {Array<number>} */
|
||||
const zs = Object.keys(this.replaysByZIndex_).map(Number);
|
||||
zs.sort(numberSafeCompareFunction);
|
||||
|
||||
@@ -407,7 +407,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
/**
|
||||
* This cache is used for storing calculated pixel circles for increasing performance.
|
||||
* It is a static property to allow each Replaygroup to access it.
|
||||
* @type {Object.<number, Array.<Array.<(boolean|undefined)>>>}
|
||||
* @type {Object.<number, Array<Array<(boolean|undefined)>>>}
|
||||
*/
|
||||
const circleArrayCache = {
|
||||
0: [[true]]
|
||||
@@ -417,7 +417,7 @@ const circleArrayCache = {
|
||||
/**
|
||||
* This method fills a row in the array from the given coordinate to the
|
||||
* middle with `true`.
|
||||
* @param {Array.<Array.<(boolean|undefined)>>} array The array that will be altered.
|
||||
* @param {Array<Array<(boolean|undefined)>>} array The array that will be altered.
|
||||
* @param {number} x X coordinate.
|
||||
* @param {number} y Y coordinate.
|
||||
*/
|
||||
@@ -442,7 +442,7 @@ function fillCircleArrayRowToMiddle(array, x, y) {
|
||||
* It uses the midpoint circle algorithm.
|
||||
* A cache is used to increase performance.
|
||||
* @param {number} radius Radius.
|
||||
* @returns {Array.<Array.<(boolean|undefined)>>} An array with marked circle points.
|
||||
* @returns {Array<Array<(boolean|undefined)>>} An array with marked circle points.
|
||||
*/
|
||||
export function getCircleArray(radius) {
|
||||
if (circleArrayCache[radius] !== undefined) {
|
||||
@@ -483,7 +483,7 @@ export function getCircleArray(radius) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {!Object.<string, Array.<*>>} declutterReplays Declutter replays.
|
||||
* @param {!Object.<string, Array<*>>} declutterReplays Declutter replays.
|
||||
* @param {CanvasRenderingContext2D} context Context.
|
||||
* @param {number} rotation Rotation.
|
||||
*/
|
||||
|
||||
@@ -34,7 +34,7 @@ class CanvasTextReplay extends CanvasReplay {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<HTMLCanvasElement>}
|
||||
* @type {Array<HTMLCanvasElement>}
|
||||
*/
|
||||
this.labels_ = null;
|
||||
|
||||
@@ -520,8 +520,8 @@ class CanvasTextReplay extends CanvasReplay {
|
||||
|
||||
/**
|
||||
* @param {string} font Font to use for measuring.
|
||||
* @param {Array.<string>} lines Lines to measure.
|
||||
* @param {Array.<number>} widths Array will be populated with the widths of
|
||||
* @param {Array<string>} lines Lines to measure.
|
||||
* @param {Array<number>} widths Array will be populated with the widths of
|
||||
* each line.
|
||||
* @return {number} Width of the whole text.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user