Merge pull request #8081 from pfirpfel/move-olx.render-to-ol/render
Move olx.render.* and related typedefs to ol/render/*
This commit is contained in:
@@ -4,49 +4,3 @@
|
||||
*/
|
||||
let olx;
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{context: CanvasRenderingContext2D,
|
||||
* feature: (module:ol/Feature~Feature|ol.render.Feature),
|
||||
* geometry: module:ol/geom/SimpleGeometry~SimpleGeometry,
|
||||
* pixelRatio: number,
|
||||
* resolution: number,
|
||||
* rotation: number}}
|
||||
*/
|
||||
olx.render.State;
|
||||
|
||||
|
||||
/**
|
||||
* Canvas context that the layer is being rendered to.
|
||||
* @type {CanvasRenderingContext2D}
|
||||
* @api
|
||||
*/
|
||||
olx.render.State.prototype.context;
|
||||
|
||||
|
||||
/**
|
||||
* Pixel ratio used by the layer renderer.
|
||||
* @type {number}
|
||||
* @api
|
||||
*/
|
||||
olx.render.State.prototype.pixelRatio;
|
||||
|
||||
|
||||
/**
|
||||
* Resolution that the render batch was created and optimized for. This is
|
||||
* not the view's resolution that is being rendered.
|
||||
* @type {number}
|
||||
* @api
|
||||
*/
|
||||
olx.render.State.prototype.resolution;
|
||||
|
||||
|
||||
/**
|
||||
* Rotation of the rendered layer in radians.
|
||||
* @type {number}
|
||||
* @api
|
||||
*/
|
||||
olx.render.State.prototype.rotation;
|
||||
|
||||
|
||||
/**
|
||||
@@ -6,6 +6,18 @@ import {create as createTransform, scale as scaleTransform} from './transform.js
|
||||
import CanvasImmediateRenderer from './render/canvas/Immediate.js';
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} State
|
||||
* @property {CanvasRenderingContext2D} context Canvas context that the layer is being rendered to.
|
||||
* @property {module:ol/Feature~Feature|module:ol/render/Feature~Feature} feature
|
||||
* @property {module:ol/geom/SimpleGeometry~SimpleGeometry} geometry
|
||||
* @property {number} pixelRatio Pixel ratio used by the layer renderer.
|
||||
* @property {number} resolution Resolution that the render batch was created and optimized for.
|
||||
* This is not the view's resolution that is being rendered.
|
||||
* @property {number} rotation Rotation of the rendered layer in radians.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* A function to be used when sorting features before rendering.
|
||||
* It takes two instances of {@link module:ol/Feature} or
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -8,6 +8,67 @@ import LRUCache from '../structs/LRUCache.js';
|
||||
import {create as createTransform} from '../transform.js';
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} FillState
|
||||
* @property {module:ol/colorlike~ColorLike} fillStyle
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} FillStrokeState
|
||||
* @property {module:ol/colorlike~ColorLike} [currentFillStyle]
|
||||
* @property {module:ol/colorlike~ColorLike} [currentStrokeStyle]
|
||||
* @property {string} [currentLineCap]
|
||||
* @property {Array.<number>} currentLineDash
|
||||
* @property {number} [currentLineDashOffset]
|
||||
* @property {string} [currentLineJoin]
|
||||
* @property {number} [currentLineWidth]
|
||||
* @property {number} [currentMiterLimit]
|
||||
* @property {number} [lastStroke]
|
||||
* @property {module:ol/colorlike~ColorLike} [fillStyle]
|
||||
* @property {module:ol/colorlike~ColorLike} [strokeStyle]
|
||||
* @property {string} [lineCap]
|
||||
* @property {Array.<number>} lineDash
|
||||
* @property {number} [lineDashOffset]
|
||||
* @property {string} [lineJoin]
|
||||
* @property {number} [lineWidth]
|
||||
* @property {number} [miterLimit]
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} StrokeState
|
||||
* @property {string} lineCap
|
||||
* @property {Array.<number>} lineDash
|
||||
* @property {number} lineDashOffset
|
||||
* @property {string} lineJoin
|
||||
* @property {number} lineWidth
|
||||
* @property {number} miterLimit
|
||||
* @property {module:ol/colorlike~ColorLike} strokeStyle
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} TextState
|
||||
* @property {string} font
|
||||
* @property {string} [textAlign]
|
||||
* @property {string} textBaseline
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 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}
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -70,31 +70,31 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform,
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?ol.CanvasFillState}
|
||||
* @type {?module:ol/render/canvas~FillState}
|
||||
*/
|
||||
this.contextFillState_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?ol.CanvasStrokeState}
|
||||
* @type {?module:ol/render/canvas~StrokeState}
|
||||
*/
|
||||
this.contextStrokeState_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?ol.CanvasTextState}
|
||||
* @type {?module:ol/render/canvas~TextState}
|
||||
*/
|
||||
this.contextTextState_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?ol.CanvasFillState}
|
||||
* @type {?module:ol/render/canvas~FillState}
|
||||
*/
|
||||
this.fillState_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?ol.CanvasStrokeState}
|
||||
* @type {?module:ol/render/canvas~StrokeState}
|
||||
*/
|
||||
this.strokeState_ = null;
|
||||
|
||||
@@ -208,19 +208,19 @@ const CanvasImmediateRenderer = function(context, pixelRatio, extent, transform,
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?ol.CanvasFillState}
|
||||
* @type {?module:ol/render/canvas~FillState}
|
||||
*/
|
||||
this.textFillState_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?ol.CanvasStrokeState}
|
||||
* @type {?module:ol/render/canvas~StrokeState}
|
||||
*/
|
||||
this.textStrokeState_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?ol.CanvasTextState}
|
||||
* @type {?module:ol/render/canvas~TextState}
|
||||
*/
|
||||
this.textState_ = null;
|
||||
|
||||
@@ -698,7 +698,7 @@ CanvasImmediateRenderer.prototype.drawMultiPolygon = function(geometry) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.CanvasFillState} fillState Fill state.
|
||||
* @param {module:ol/render/canvas~FillState} fillState Fill state.
|
||||
* @private
|
||||
*/
|
||||
CanvasImmediateRenderer.prototype.setContextFillState_ = function(fillState) {
|
||||
@@ -718,7 +718,7 @@ CanvasImmediateRenderer.prototype.setContextFillState_ = function(fillState) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.CanvasStrokeState} strokeState Stroke state.
|
||||
* @param {module:ol/render/canvas~StrokeState} strokeState Stroke state.
|
||||
* @private
|
||||
*/
|
||||
CanvasImmediateRenderer.prototype.setContextStrokeState_ = function(strokeState) {
|
||||
@@ -775,7 +775,7 @@ CanvasImmediateRenderer.prototype.setContextStrokeState_ = function(strokeState)
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.CanvasTextState} textState Text state.
|
||||
* @param {module:ol/render/canvas~TextState} textState Text state.
|
||||
* @private
|
||||
*/
|
||||
CanvasImmediateRenderer.prototype.setContextTextState_ = function(textState) {
|
||||
|
||||
@@ -147,9 +147,9 @@ const CanvasReplay = function(tolerance, maxExtent, resolution, pixelRatio, over
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {ol.CanvasFillStrokeState}
|
||||
* @type {module:ol/render/canvas~FillStrokeState}
|
||||
*/
|
||||
this.state = /** @type {ol.CanvasFillStrokeState} */ ({});
|
||||
this.state = /** @type {module:ol/render/canvas~FillStrokeState} */ ({});
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -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) {
|
||||
@@ -565,7 +565,7 @@ CanvasReplay.prototype.replay_ = function(
|
||||
const coordinateCache = this.coordinateCache_;
|
||||
const viewRotation = this.viewRotation_;
|
||||
|
||||
const state = /** @type {olx.render.State} */ ({
|
||||
const state = /** @type {module:ol/render~State} */ ({
|
||||
context: context,
|
||||
pixelRatio: this.pixelRatio,
|
||||
resolution: this.resolution,
|
||||
@@ -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]);
|
||||
@@ -957,7 +957,7 @@ CanvasReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.CanvasFillStrokeState} state State.
|
||||
* @param {module:ol/render/canvas~FillStrokeState} state State.
|
||||
* @param {module:ol/geom/Geometry~Geometry|ol.render.Feature} geometry Geometry.
|
||||
* @return {Array.<*>} Fill instruction.
|
||||
*/
|
||||
@@ -973,7 +973,7 @@ CanvasReplay.prototype.createFill = function(state, geometry) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.CanvasFillStrokeState} state State.
|
||||
* @param {module:ol/render/canvas~FillStrokeState} state State.
|
||||
*/
|
||||
CanvasReplay.prototype.applyStroke = function(state) {
|
||||
this.instructions.push(this.createStroke(state));
|
||||
@@ -981,7 +981,7 @@ CanvasReplay.prototype.applyStroke = function(state) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.CanvasFillStrokeState} state State.
|
||||
* @param {module:ol/render/canvas~FillStrokeState} state State.
|
||||
* @return {Array.<*>} Stroke instruction.
|
||||
*/
|
||||
CanvasReplay.prototype.createStroke = function(state) {
|
||||
@@ -995,8 +995,8 @@ CanvasReplay.prototype.createStroke = function(state) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.CanvasFillStrokeState} state State.
|
||||
* @param {function(this:ol.render.canvas.Replay, ol.CanvasFillStrokeState, (module:ol/geom/Geometry~Geometry|ol.render.Feature)):Array.<*>} createFill Create fill.
|
||||
* @param {module:ol/render/canvas~FillStrokeState} state State.
|
||||
* @param {function(this:ol.render.canvas.Replay, module:ol/render/canvas~FillStrokeState, (module:ol/geom/Geometry~Geometry|ol.render.Feature)):Array.<*>} createFill Create fill.
|
||||
* @param {module:ol/geom/Geometry~Geometry|ol.render.Feature} geometry Geometry.
|
||||
*/
|
||||
CanvasReplay.prototype.updateFillStyle = function(state, createFill, geometry) {
|
||||
@@ -1011,8 +1011,8 @@ CanvasReplay.prototype.updateFillStyle = function(state, createFill, geometry) {
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.CanvasFillStrokeState} state State.
|
||||
* @param {function(this:ol.render.canvas.Replay, ol.CanvasFillStrokeState)} applyStroke Apply stroke.
|
||||
* @param {module:ol/render/canvas~FillStrokeState} state State.
|
||||
* @param {function(this:ol.render.canvas.Replay, module:ol/render/canvas~FillStrokeState)} applyStroke Apply stroke.
|
||||
*/
|
||||
CanvasReplay.prototype.updateStrokeStyle = function(state, applyStroke) {
|
||||
const strokeStyle = state.strokeStyle;
|
||||
|
||||
@@ -21,7 +21,7 @@ import {create as createTransform, compose as composeTransform} from '../../tran
|
||||
/**
|
||||
* @type {Object.<ol.render.ReplayType,
|
||||
* function(new: ol.render.canvas.Replay, number, module:ol/extent~Extent,
|
||||
* number, number, boolean, Array.<ol.DeclutterGroup>)>}
|
||||
* number, number, boolean, Array.<module:ol/render/canvas~DeclutterGroup>)>}
|
||||
*/
|
||||
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.<string, ol.DeclutterGroup>} declutterReplays Declutter
|
||||
* @param {Object.<string, module:ol/render/canvas~DeclutterGroup>} declutterReplays Declutter
|
||||
* replays.
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template T
|
||||
@@ -457,7 +457,7 @@ CanvasReplayGroup.prototype.isEmpty = function() {
|
||||
* to skip.
|
||||
* @param {Array.<ol.render.ReplayType>=} opt_replayTypes Ordered replay types
|
||||
* to replay. Default is {@link ol.render.replay.ORDER}
|
||||
* @param {Object.<string, ol.DeclutterGroup>=} opt_declutterReplays Declutter
|
||||
* @param {Object.<string, module:ol/render/canvas~DeclutterGroup>=} opt_declutterReplays Declutter
|
||||
* replays.
|
||||
*/
|
||||
CanvasReplayGroup.prototype.replay = function(context,
|
||||
|
||||
@@ -32,7 +32,7 @@ const CanvasTextReplay = function(
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.DeclutterGroup}
|
||||
* @type {module:ol/render/canvas~DeclutterGroup}
|
||||
*/
|
||||
this.declutterGroup_;
|
||||
|
||||
@@ -74,34 +74,34 @@ const CanvasTextReplay = function(
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?ol.CanvasFillState}
|
||||
* @type {?module:ol/render/canvas~FillState}
|
||||
*/
|
||||
this.textFillState_ = null;
|
||||
|
||||
/**
|
||||
* @type {!Object.<string, ol.CanvasFillState>}
|
||||
* @type {!Object.<string, module:ol/render/canvas~FillState>}
|
||||
*/
|
||||
this.fillStates = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?ol.CanvasStrokeState}
|
||||
* @type {?module:ol/render/canvas~StrokeState}
|
||||
*/
|
||||
this.textStrokeState_ = null;
|
||||
|
||||
/**
|
||||
* @type {!Object.<string, ol.CanvasStrokeState>}
|
||||
* @type {!Object.<string, module:ol/render/canvas~StrokeState>}
|
||||
*/
|
||||
this.strokeStates = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.CanvasTextState}
|
||||
* @type {module:ol/render/canvas~TextState}
|
||||
*/
|
||||
this.textState_ = /** @type {ol.CanvasTextState} */ ({});
|
||||
this.textState_ = /** @type {module:ol/render/canvas~TextState} */ ({});
|
||||
|
||||
/**
|
||||
* @type {!Object.<string, ol.CanvasTextState>}
|
||||
* @type {!Object.<string, module:ol/render/canvas~TextState>}
|
||||
*/
|
||||
this.textStates = {};
|
||||
|
||||
@@ -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_;
|
||||
@@ -391,7 +391,7 @@ CanvasTextReplay.prototype.drawChars_ = function(begin, end, declutterGroup) {
|
||||
const strokeKey = this.strokeKey_;
|
||||
if (strokeState) {
|
||||
if (!(strokeKey in this.strokeStates)) {
|
||||
this.strokeStates[strokeKey] = /** @type {ol.CanvasStrokeState} */ ({
|
||||
this.strokeStates[strokeKey] = /** @type {module:ol/render/canvas~StrokeState} */ ({
|
||||
strokeStyle: strokeState.strokeStyle,
|
||||
lineCap: strokeState.lineCap,
|
||||
lineDashOffset: strokeState.lineDashOffset,
|
||||
@@ -404,7 +404,7 @@ CanvasTextReplay.prototype.drawChars_ = function(begin, end, declutterGroup) {
|
||||
}
|
||||
const textKey = this.textKey_;
|
||||
if (!(this.textKey_ in this.textStates)) {
|
||||
this.textStates[this.textKey_] = /** @type {ol.CanvasTextState} */ ({
|
||||
this.textStates[this.textKey_] = /** @type {module:ol/render/canvas~TextState} */ ({
|
||||
font: textState.font,
|
||||
textAlign: textState.textAlign || defaultTextAlign,
|
||||
scale: textState.scale
|
||||
@@ -413,7 +413,7 @@ CanvasTextReplay.prototype.drawChars_ = function(begin, end, declutterGroup) {
|
||||
const fillKey = this.fillKey_;
|
||||
if (fillState) {
|
||||
if (!(fillKey in this.fillStates)) {
|
||||
this.fillStates[fillKey] = /** @type {ol.CanvasFillState} */ ({
|
||||
this.fillStates[fillKey] = /** @type {module:ol/render/canvas~FillState} */ ({
|
||||
fillStyle: fillState.fillStyle
|
||||
});
|
||||
}
|
||||
@@ -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) {
|
||||
@@ -474,7 +474,7 @@ CanvasTextReplay.prototype.setTextStyle = function(textStyle, declutterGroup) {
|
||||
} else {
|
||||
fillState = this.textFillState_;
|
||||
if (!fillState) {
|
||||
fillState = this.textFillState_ = /** @type {ol.CanvasFillState} */ ({});
|
||||
fillState = this.textFillState_ = /** @type {module:ol/render/canvas~FillState} */ ({});
|
||||
}
|
||||
fillState.fillStyle = asColorLike(
|
||||
textFillStyle.getColor() || defaultFillStyle);
|
||||
@@ -486,7 +486,7 @@ CanvasTextReplay.prototype.setTextStyle = function(textStyle, declutterGroup) {
|
||||
} else {
|
||||
strokeState = this.textStrokeState_;
|
||||
if (!strokeState) {
|
||||
strokeState = this.textStrokeState_ = /** @type {ol.CanvasStrokeState} */ ({});
|
||||
strokeState = this.textStrokeState_ = /** @type {module:ol/render/canvas~StrokeState} */ ({});
|
||||
}
|
||||
const lineDash = textStrokeStyle.getLineDash();
|
||||
const lineDashOffset = textStrokeStyle.getLineDashOffset();
|
||||
|
||||
@@ -6,10 +6,25 @@ import ImageCanvas from '../ImageCanvas.js';
|
||||
import {containsExtent, getHeight, getWidth, scaleFromCenter} from '../extent.js';
|
||||
import ImageSource from '../source/Image.js';
|
||||
|
||||
|
||||
/**
|
||||
* A function returning the canvas element (`{HTMLCanvasElement}`)
|
||||
* used by the source as an image. The arguments passed to the function are:
|
||||
* {@link module:ol/extent~Extent} the image extent, `{number}` the image resolution,
|
||||
* `{number}` the device pixel ratio, {@link module:ol/size~Size} the image size, and
|
||||
* {@link module:ol/proj/Projection~Projection} the image projection. The canvas returned by
|
||||
* this function is cached by the source. The this keyword inside the function
|
||||
* references the {@link module:ol/source/ImageCanvas}.
|
||||
*
|
||||
* @typedef {function(this:module:ol/ImageCanvas~ImageCanvas, module:ol/extent~Extent, number,
|
||||
* number, module:ol/size~Size, module:ol/proj/Projection~Projection): HTMLCanvasElement} FunctionType
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/source/Source~AttributionLike} [attributions] Attributions.
|
||||
* @property {ol.CanvasFunctionType} [canvasFunction] Canvas function.
|
||||
* @property {module:ol/source/ImageCanvas~FunctionType} [canvasFunction] Canvas function.
|
||||
* The function returning the canvas element used by the source
|
||||
* as an image. The arguments passed to the function are: `{module:ol/extent~Extent}` the
|
||||
* image extent, `{number}` the image resolution, `{number}` the device pixel
|
||||
@@ -47,7 +62,7 @@ const ImageCanvasSource = function(options) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.CanvasFunctionType}
|
||||
* @type {module:ol/source/ImageCanvas~FunctionType}
|
||||
*/
|
||||
this.canvasFunction_ = options.canvasFunction;
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ import Stroke from '../style/Stroke.js';
|
||||
* Custom renderer function. Takes two arguments:
|
||||
*
|
||||
* 1. The pixel coordinates of the geometry in GeoJSON notation.
|
||||
* 2. The {@link olx.render.State} of the layer renderer.
|
||||
* 2. The {@link module:ol/render~State} of the layer renderer.
|
||||
*
|
||||
* @typedef {function((module:ol/coordinate~Coordinate|Array<module:ol/coordinate~Coordinate>|Array.<Array.<module:ol/coordinate~Coordinate>>),olx.render.State)}
|
||||
* @typedef {function((module:ol/coordinate~Coordinate|Array<module:ol/coordinate~Coordinate>|Array.<Array.<module:ol/coordinate~Coordinate>>),module:ol/render~State)}
|
||||
* RenderFunction
|
||||
*/
|
||||
|
||||
|
||||
@@ -21,83 +21,6 @@ const ol = {};
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{fillStyle: module:ol/colorlike~ColorLike}}
|
||||
*/
|
||||
ol.CanvasFillState;
|
||||
|
||||
|
||||
/**
|
||||
* A function returning the canvas element (`{HTMLCanvasElement}`)
|
||||
* used by the source as an image. The arguments passed to the function are:
|
||||
* {@link module:ol/extent~Extent} the image extent, `{number}` the image resolution,
|
||||
* `{number}` the device pixel ratio, {@link module:ol/size~Size} the image size, and
|
||||
* {@link module:ol/proj/Projection~Projection} the image projection. The canvas returned by
|
||||
* this function is cached by the source. The this keyword inside the function
|
||||
* references the {@link ol.source.ImageCanvas}.
|
||||
*
|
||||
* @typedef {function(this:ol.source.ImageCanvas, module:ol/extent~Extent, number,
|
||||
* number, module:ol/size~Size, module:ol/proj/Projection~Projection): HTMLCanvasElement}
|
||||
*/
|
||||
ol.CanvasFunctionType;
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{currentFillStyle: (module:ol/colorlike~ColorLike|undefined),
|
||||
* currentStrokeStyle: (module:ol/colorlike~ColorLike|undefined),
|
||||
* currentLineCap: (string|undefined),
|
||||
* currentLineDash: Array.<number>,
|
||||
* currentLineDashOffset: (number|undefined),
|
||||
* currentLineJoin: (string|undefined),
|
||||
* currentLineWidth: (number|undefined),
|
||||
* currentMiterLimit: (number|undefined),
|
||||
* lastStroke: (number|undefined),
|
||||
* fillStyle: (module:ol/colorlike~ColorLike|undefined),
|
||||
* strokeStyle: (module:ol/colorlike~ColorLike|undefined),
|
||||
* lineCap: (string|undefined),
|
||||
* lineDash: Array.<number>,
|
||||
* lineDashOffset: (number|undefined),
|
||||
* lineJoin: (string|undefined),
|
||||
* lineWidth: (number|undefined),
|
||||
* miterLimit: (number|undefined)}|null}
|
||||
*/
|
||||
ol.CanvasFillStrokeState;
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{lineCap: string,
|
||||
* lineDash: Array.<number>,
|
||||
* lineDashOffset: number,
|
||||
* lineJoin: string,
|
||||
* lineWidth: number,
|
||||
* miterLimit: number,
|
||||
* strokeStyle: module:ol/colorlike~ColorLike}}
|
||||
*/
|
||||
ol.CanvasStrokeState;
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{font: string,
|
||||
* textAlign: (string|undefined),
|
||||
* textBaseline: string}}
|
||||
*/
|
||||
ol.CanvasTextState;
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
Reference in New Issue
Block a user