Transformed types
Using the [ts.js codemod](https://gist.github.com/tschaub/1ea498c9d1e5268cf36d212b3949be4e): jscodeshift --transform ts.js src
This commit is contained in:
@@ -7,7 +7,7 @@ import CanvasReplay from '../canvas/Replay.js';
|
||||
class CanvasImageReplay extends CanvasReplay {
|
||||
/**
|
||||
* @param {number} tolerance Tolerance.
|
||||
* @param {module:ol/extent~Extent} maxExtent Maximum extent.
|
||||
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {boolean} overlaps The replay can have overlapping geometries.
|
||||
@@ -18,7 +18,7 @@ class CanvasImageReplay extends CanvasReplay {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/render/canvas~DeclutterGroup}
|
||||
* @type {import("../canvas.js").DeclutterGroup}
|
||||
*/
|
||||
this.declutterGroup_ = null;
|
||||
|
||||
@@ -198,7 +198,7 @@ class CanvasImageReplay extends CanvasReplay {
|
||||
const origin = imageStyle.getOrigin();
|
||||
this.anchorX_ = anchor[0];
|
||||
this.anchorY_ = anchor[1];
|
||||
this.declutterGroup_ = /** @type {module:ol/render/canvas~DeclutterGroup} */ (declutterGroup);
|
||||
this.declutterGroup_ = /** @type {import("../canvas.js").DeclutterGroup} */ (declutterGroup);
|
||||
this.hitDetectionImage_ = hitDetectionImage;
|
||||
this.image_ = image;
|
||||
this.height_ = size[1];
|
||||
|
||||
@@ -29,8 +29,8 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
/**
|
||||
* @param {CanvasRenderingContext2D} context Context.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {module:ol/extent~Extent} extent Extent.
|
||||
* @param {module:ol/transform~Transform} transform Transform.
|
||||
* @param {import("../../extent.js").Extent} extent Extent.
|
||||
* @param {import("../../transform.js").Transform} transform Transform.
|
||||
* @param {number} viewRotation View rotation.
|
||||
*/
|
||||
constructor(context, pixelRatio, extent, transform, viewRotation) {
|
||||
@@ -50,13 +50,13 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../../extent.js").Extent}
|
||||
*/
|
||||
this.extent_ = extent;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/transform~Transform}
|
||||
* @type {import("../../transform.js").Transform}
|
||||
*/
|
||||
this.transform_ = transform;
|
||||
|
||||
@@ -68,31 +68,31 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?module:ol/render/canvas~FillState}
|
||||
* @type {?import("../canvas.js").FillState}
|
||||
*/
|
||||
this.contextFillState_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?module:ol/render/canvas~StrokeState}
|
||||
* @type {?import("../canvas.js").StrokeState}
|
||||
*/
|
||||
this.contextStrokeState_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?module:ol/render/canvas~TextState}
|
||||
* @type {?import("../canvas.js").TextState}
|
||||
*/
|
||||
this.contextTextState_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?module:ol/render/canvas~FillState}
|
||||
* @type {?import("../canvas.js").FillState}
|
||||
*/
|
||||
this.fillState_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?module:ol/render/canvas~StrokeState}
|
||||
* @type {?import("../canvas.js").StrokeState}
|
||||
*/
|
||||
this.strokeState_ = null;
|
||||
|
||||
@@ -200,19 +200,19 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?module:ol/render/canvas~FillState}
|
||||
* @type {?import("../canvas.js").FillState}
|
||||
*/
|
||||
this.textFillState_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?module:ol/render/canvas~StrokeState}
|
||||
* @type {?import("../canvas.js").StrokeState}
|
||||
*/
|
||||
this.textStrokeState_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?module:ol/render/canvas~TextState}
|
||||
* @type {?import("../canvas.js").TextState}
|
||||
*/
|
||||
this.textState_ = null;
|
||||
|
||||
@@ -224,7 +224,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/transform~Transform}
|
||||
* @type {import("../../transform.js").Transform}
|
||||
*/
|
||||
this.tmpLocalTransform_ = createTransform();
|
||||
|
||||
@@ -375,7 +375,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* Render a circle geometry into the canvas. Rendering is immediate and uses
|
||||
* the current fill and stroke styles.
|
||||
*
|
||||
* @param {module:ol/geom/Circle} geometry Circle geometry.
|
||||
* @param {import("../../geom/Circle.js").default} geometry Circle geometry.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
@@ -415,7 +415,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* Set the rendering style. Note that since this is an immediate rendering API,
|
||||
* any `zIndex` on the provided style will be ignored.
|
||||
*
|
||||
* @param {module:ol/style/Style} style The rendering style.
|
||||
* @param {import("../../style/Style.js").default} style The rendering style.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
@@ -429,7 +429,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* Render a geometry into the canvas. Call
|
||||
* {@link module:ol/render/canvas/Immediate#setStyle} first to set the rendering style.
|
||||
*
|
||||
* @param {module:ol/geom/Geometry|module:ol/render/Feature} geometry The geometry to render.
|
||||
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry The geometry to render.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
@@ -437,28 +437,28 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
const type = geometry.getType();
|
||||
switch (type) {
|
||||
case GeometryType.POINT:
|
||||
this.drawPoint(/** @type {module:ol/geom/Point} */ (geometry));
|
||||
this.drawPoint(/** @type {import("../../geom/Point.js").default} */ (geometry));
|
||||
break;
|
||||
case GeometryType.LINE_STRING:
|
||||
this.drawLineString(/** @type {module:ol/geom/LineString} */ (geometry));
|
||||
this.drawLineString(/** @type {import("../../geom/LineString.js").default} */ (geometry));
|
||||
break;
|
||||
case GeometryType.POLYGON:
|
||||
this.drawPolygon(/** @type {module:ol/geom/Polygon} */ (geometry));
|
||||
this.drawPolygon(/** @type {import("../../geom/Polygon.js").default} */ (geometry));
|
||||
break;
|
||||
case GeometryType.MULTI_POINT:
|
||||
this.drawMultiPoint(/** @type {module:ol/geom/MultiPoint} */ (geometry));
|
||||
this.drawMultiPoint(/** @type {import("../../geom/MultiPoint.js").default} */ (geometry));
|
||||
break;
|
||||
case GeometryType.MULTI_LINE_STRING:
|
||||
this.drawMultiLineString(/** @type {module:ol/geom/MultiLineString} */ (geometry));
|
||||
this.drawMultiLineString(/** @type {import("../../geom/MultiLineString.js").default} */ (geometry));
|
||||
break;
|
||||
case GeometryType.MULTI_POLYGON:
|
||||
this.drawMultiPolygon(/** @type {module:ol/geom/MultiPolygon} */ (geometry));
|
||||
this.drawMultiPolygon(/** @type {import("../../geom/MultiPolygon.js").default} */ (geometry));
|
||||
break;
|
||||
case GeometryType.GEOMETRY_COLLECTION:
|
||||
this.drawGeometryCollection(/** @type {module:ol/geom/GeometryCollection} */ (geometry));
|
||||
this.drawGeometryCollection(/** @type {import("../../geom/GeometryCollection.js").default} */ (geometry));
|
||||
break;
|
||||
case GeometryType.CIRCLE:
|
||||
this.drawCircle(/** @type {module:ol/geom/Circle} */ (geometry));
|
||||
this.drawCircle(/** @type {import("../../geom/Circle.js").default} */ (geometry));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
@@ -470,8 +470,8 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* this method is called. If you need `zIndex` support, you should be using an
|
||||
* {@link module:ol/layer/Vector~VectorLayer} instead.
|
||||
*
|
||||
* @param {module:ol/Feature} feature Feature.
|
||||
* @param {module:ol/style/Style} style Style.
|
||||
* @param {import("../../Feature.js").default} feature Feature.
|
||||
* @param {import("../../style/Style.js").default} style Style.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
@@ -488,7 +488,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* Render a GeometryCollection to the canvas. Rendering is immediate and
|
||||
* uses the current styles appropriate for each geometry in the collection.
|
||||
*
|
||||
* @param {module:ol/geom/GeometryCollection} geometry Geometry collection.
|
||||
* @param {import("../../geom/GeometryCollection.js").default} geometry Geometry collection.
|
||||
* @override
|
||||
*/
|
||||
drawGeometryCollection(geometry) {
|
||||
@@ -502,7 +502,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* Render a Point geometry into the canvas. Rendering is immediate and uses
|
||||
* the current style.
|
||||
*
|
||||
* @param {module:ol/geom/Point|module:ol/render/Feature} geometry Point geometry.
|
||||
* @param {import("../../geom/Point.js").default|import("../Feature.js").default} geometry Point geometry.
|
||||
* @override
|
||||
*/
|
||||
drawPoint(geometry) {
|
||||
@@ -520,7 +520,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* Render a MultiPoint geometry into the canvas. Rendering is immediate and
|
||||
* uses the current style.
|
||||
*
|
||||
* @param {module:ol/geom/MultiPoint|module:ol/render/Feature} geometry MultiPoint geometry.
|
||||
* @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} geometry MultiPoint geometry.
|
||||
* @override
|
||||
*/
|
||||
drawMultiPoint(geometry) {
|
||||
@@ -538,7 +538,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* Render a LineString into the canvas. Rendering is immediate and uses
|
||||
* the current style.
|
||||
*
|
||||
* @param {module:ol/geom/LineString|module:ol/render/Feature} geometry LineString geometry.
|
||||
* @param {import("../../geom/LineString.js").default|import("../Feature.js").default} geometry LineString geometry.
|
||||
* @override
|
||||
*/
|
||||
drawLineString(geometry) {
|
||||
@@ -564,7 +564,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* Render a MultiLineString geometry into the canvas. Rendering is immediate
|
||||
* and uses the current style.
|
||||
*
|
||||
* @param {module:ol/geom/MultiLineString|module:ol/render/Feature} geometry MultiLineString geometry.
|
||||
* @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} geometry MultiLineString geometry.
|
||||
* @override
|
||||
*/
|
||||
drawMultiLineString(geometry) {
|
||||
@@ -595,7 +595,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* Render a Polygon geometry into the canvas. Rendering is immediate and uses
|
||||
* the current style.
|
||||
*
|
||||
* @param {module:ol/geom/Polygon|module:ol/render/Feature} geometry Polygon geometry.
|
||||
* @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} geometry Polygon geometry.
|
||||
* @override
|
||||
*/
|
||||
drawPolygon(geometry) {
|
||||
@@ -629,7 +629,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
/**
|
||||
* Render MultiPolygon geometry into the canvas. Rendering is immediate and
|
||||
* uses the current style.
|
||||
* @param {module:ol/geom/MultiPolygon} geometry MultiPolygon geometry.
|
||||
* @param {import("../../geom/MultiPolygon.js").default} geometry MultiPolygon geometry.
|
||||
* @override
|
||||
*/
|
||||
drawMultiPolygon(geometry) {
|
||||
@@ -667,7 +667,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/render/canvas~FillState} fillState Fill state.
|
||||
* @param {import("../canvas.js").FillState} fillState Fill state.
|
||||
* @private
|
||||
*/
|
||||
setContextFillState_(fillState) {
|
||||
@@ -686,7 +686,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/render/canvas~StrokeState} strokeState Stroke state.
|
||||
* @param {import("../canvas.js").StrokeState} strokeState Stroke state.
|
||||
* @private
|
||||
*/
|
||||
setContextStrokeState_(strokeState) {
|
||||
@@ -742,7 +742,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/render/canvas~TextState} textState Text state.
|
||||
* @param {import("../canvas.js").TextState} textState Text state.
|
||||
* @private
|
||||
*/
|
||||
setContextTextState_(textState) {
|
||||
@@ -777,8 +777,8 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* Set the fill and stroke style for subsequent draw operations. To clear
|
||||
* either fill or stroke styles, pass null for the appropriate parameter.
|
||||
*
|
||||
* @param {module:ol/style/Fill} fillStyle Fill style.
|
||||
* @param {module:ol/style/Stroke} strokeStyle Stroke style.
|
||||
* @param {import("../../style/Fill.js").default} fillStyle Fill style.
|
||||
* @param {import("../../style/Stroke.js").default} strokeStyle Stroke style.
|
||||
* @override
|
||||
*/
|
||||
setFillStrokeStyle(fillStyle, strokeStyle) {
|
||||
@@ -824,7 +824,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* Set the image style for subsequent draw operations. Pass null to remove
|
||||
* the image style.
|
||||
*
|
||||
* @param {module:ol/style/Image} imageStyle Image style.
|
||||
* @param {import("../../style/Image.js").default} imageStyle Image style.
|
||||
* @override
|
||||
*/
|
||||
setImageStyle(imageStyle) {
|
||||
@@ -854,7 +854,7 @@ class CanvasImmediateRenderer extends VectorContext {
|
||||
* Set the text style for subsequent draw operations. Pass null to
|
||||
* remove the text style.
|
||||
*
|
||||
* @param {module:ol/style/Text} textStyle Text style.
|
||||
* @param {import("../../style/Text.js").default} textStyle Text style.
|
||||
* @override
|
||||
*/
|
||||
setTextStyle(textStyle) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import CanvasReplay from '../canvas/Replay.js';
|
||||
class CanvasLineStringReplay extends CanvasReplay {
|
||||
/**
|
||||
* @param {number} tolerance Tolerance.
|
||||
* @param {module:ol/extent~Extent} maxExtent Maximum extent.
|
||||
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {boolean} overlaps The replay can have overlapping geometries.
|
||||
|
||||
@@ -13,7 +13,7 @@ import CanvasReplay from '../canvas/Replay.js';
|
||||
class CanvasPolygonReplay extends CanvasReplay {
|
||||
/**
|
||||
* @param {number} tolerance Tolerance.
|
||||
* @param {module:ol/extent~Extent} maxExtent Maximum extent.
|
||||
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {boolean} overlaps The replay can have overlapping geometries.
|
||||
@@ -196,7 +196,7 @@ class CanvasPolygonReplay extends CanvasReplay {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {module:ol/geom/Geometry|module:ol/render/Feature} geometry Geometry.
|
||||
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
|
||||
*/
|
||||
setFillStrokeStyles_(geometry) {
|
||||
const state = this.state;
|
||||
|
||||
@@ -30,13 +30,13 @@ import {
|
||||
|
||||
|
||||
/**
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../../extent.js").Extent}
|
||||
*/
|
||||
const tmpExtent = createEmpty();
|
||||
|
||||
|
||||
/**
|
||||
* @type {!module:ol/transform~Transform}
|
||||
* @type {!import("../../transform.js").Transform}
|
||||
*/
|
||||
const tmpTransform = createTransform();
|
||||
|
||||
@@ -44,7 +44,7 @@ const tmpTransform = createTransform();
|
||||
class CanvasReplay extends VectorContext {
|
||||
/**
|
||||
* @param {number} tolerance Tolerance.
|
||||
* @param {module:ol/extent~Extent} maxExtent Maximum extent.
|
||||
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {boolean} overlaps The replay can have overlapping geometries.
|
||||
@@ -67,7 +67,7 @@ class CanvasReplay extends VectorContext {
|
||||
/**
|
||||
* @protected
|
||||
* @const
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../../extent.js").Extent}
|
||||
*/
|
||||
this.maxExtent = maxExtent;
|
||||
|
||||
@@ -116,7 +116,7 @@ class CanvasReplay extends VectorContext {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../../extent.js").Extent}
|
||||
*/
|
||||
this.bufferedMaxExtent_ = null;
|
||||
|
||||
@@ -134,13 +134,13 @@ class CanvasReplay extends VectorContext {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!Object<number,module:ol/coordinate~Coordinate|Array<module:ol/coordinate~Coordinate>|Array<Array<module:ol/coordinate~Coordinate>>>}
|
||||
* @type {!Object<number,import("../../coordinate.js").Coordinate|Array<import("../../coordinate.js").Coordinate>|Array<Array<import("../../coordinate.js").Coordinate>>>}
|
||||
*/
|
||||
this.coordinateCache_ = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!module:ol/transform~Transform}
|
||||
* @type {!import("../../transform.js").Transform}
|
||||
*/
|
||||
this.renderedTransform_ = createTransform();
|
||||
|
||||
@@ -158,9 +158,9 @@ class CanvasReplay extends VectorContext {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {module:ol/render/canvas~FillStrokeState}
|
||||
* @type {import("../canvas.js").FillStrokeState}
|
||||
*/
|
||||
this.state = /** @type {module:ol/render/canvas~FillStrokeState} */ ({});
|
||||
this.state = /** @type {import("../canvas.js").FillStrokeState} */ ({});
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -172,10 +172,10 @@ class CanvasReplay extends VectorContext {
|
||||
|
||||
/**
|
||||
* @param {CanvasRenderingContext2D} context Context.
|
||||
* @param {module:ol/coordinate~Coordinate} p1 1st point of the background box.
|
||||
* @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 {import("../../coordinate.js").Coordinate} p1 1st point of the background box.
|
||||
* @param {import("../../coordinate.js").Coordinate} p2 2nd point of the background box.
|
||||
* @param {import("../../coordinate.js").Coordinate} p3 3rd point of the background box.
|
||||
* @param {import("../../coordinate.js").Coordinate} p4 4th point of the background box.
|
||||
* @param {Array<*>} fillInstruction Fill instruction.
|
||||
* @param {Array<*>} strokeInstruction Stroke instruction.
|
||||
*/
|
||||
@@ -203,7 +203,7 @@ class CanvasReplay extends VectorContext {
|
||||
* @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} image Image.
|
||||
* @param {number} anchorX Anchor X.
|
||||
* @param {number} anchorY Anchor Y.
|
||||
* @param {module:ol/render/canvas~DeclutterGroup} declutterGroup Declutter group.
|
||||
* @param {import("../canvas.js").DeclutterGroup} declutterGroup Declutter group.
|
||||
* @param {number} height Height.
|
||||
* @param {number} opacity Opacity.
|
||||
* @param {number} originX Origin X.
|
||||
@@ -249,13 +249,13 @@ class CanvasReplay extends VectorContext {
|
||||
const boxX = x - padding[3];
|
||||
const boxY = y - padding[0];
|
||||
|
||||
/** @type {module:ol/coordinate~Coordinate} */
|
||||
/** @type {import("../../coordinate.js").Coordinate} */
|
||||
let p1;
|
||||
/** @type {module:ol/coordinate~Coordinate} */
|
||||
/** @type {import("../../coordinate.js").Coordinate} */
|
||||
let p2;
|
||||
/** @type {module:ol/coordinate~Coordinate} */
|
||||
/** @type {import("../../coordinate.js").Coordinate} */
|
||||
let p3;
|
||||
/** @type {module:ol/coordinate~Coordinate} */
|
||||
/** @type {import("../../coordinate.js").Coordinate} */
|
||||
let p4;
|
||||
if (fillStroke || rotation !== 0) {
|
||||
p1 = [boxX, boxY];
|
||||
@@ -406,7 +406,7 @@ class CanvasReplay extends VectorContext {
|
||||
let flatCoordinates, replayEnd, replayEnds, replayEndss;
|
||||
let offset;
|
||||
if (type == GeometryType.MULTI_POLYGON) {
|
||||
geometry = /** @type {module:ol/geom/MultiPolygon} */ (geometry);
|
||||
geometry = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry);
|
||||
flatCoordinates = geometry.getOrientedFlatCoordinates();
|
||||
replayEndss = [];
|
||||
const endss = geometry.getEndss();
|
||||
@@ -421,10 +421,10 @@ class CanvasReplay extends VectorContext {
|
||||
} else if (type == GeometryType.POLYGON || type == GeometryType.MULTI_LINE_STRING) {
|
||||
replayEnds = [];
|
||||
flatCoordinates = (type == GeometryType.POLYGON) ?
|
||||
/** @type {module:ol/geom/Polygon} */ (geometry).getOrientedFlatCoordinates() :
|
||||
/** @type {import("../../geom/Polygon.js").default} */ (geometry).getOrientedFlatCoordinates() :
|
||||
geometry.getFlatCoordinates();
|
||||
offset = this.drawCustomCoordinates_(flatCoordinates, 0,
|
||||
/** @type {module:ol/geom/Polygon|module:ol/geom/MultiLineString} */ (geometry).getEnds(),
|
||||
/** @type {import("../../geom/Polygon.js").default|import("../../geom/MultiLineString.js").default} */ (geometry).getEnds(),
|
||||
stride, replayEnds);
|
||||
this.instructions.push([CanvasInstruction.CUSTOM,
|
||||
replayBegin, replayEnds, geometry, renderer, inflateCoordinatesArray]);
|
||||
@@ -446,8 +446,8 @@ class CanvasReplay extends VectorContext {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @param {module:ol/geom/Geometry|module:ol/render/Feature} geometry Geometry.
|
||||
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature.
|
||||
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
|
||||
* @param {import("../../Feature.js").default|import("../Feature.js").default} feature Feature.
|
||||
*/
|
||||
beginGeometry(geometry, feature) {
|
||||
this.beginGeometryInstruction1_ = [CanvasInstruction.BEGIN_GEOMETRY, feature, 0];
|
||||
@@ -479,7 +479,7 @@ class CanvasReplay extends VectorContext {
|
||||
* @param {Array<*>} instruction Instruction.
|
||||
*/
|
||||
setStrokeStyle_(context, instruction) {
|
||||
context.strokeStyle = /** @type {module:ol/colorlike~ColorLike} */ (instruction[1]);
|
||||
context.strokeStyle = /** @type {import("../../colorlike.js").ColorLike} */ (instruction[1]);
|
||||
context.lineWidth = /** @type {number} */ (instruction[2]);
|
||||
context.lineCap = /** @type {string} */ (instruction[3]);
|
||||
context.lineJoin = /** @type {string} */ (instruction[4]);
|
||||
@@ -491,14 +491,14 @@ class CanvasReplay extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/render/canvas~DeclutterGroup} declutterGroup Declutter group.
|
||||
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature.
|
||||
* @param {import("../canvas.js").DeclutterGroup} declutterGroup Declutter group.
|
||||
* @param {import("../../Feature.js").default|import("../Feature.js").default} feature Feature.
|
||||
*/
|
||||
renderDeclutter_(declutterGroup, feature) {
|
||||
if (declutterGroup && declutterGroup.length > 5) {
|
||||
const groupCount = declutterGroup[4];
|
||||
if (groupCount == 1 || groupCount == declutterGroup.length - 5) {
|
||||
/** @type {module:ol/structs/RBush~Entry} */
|
||||
/** @type {import("../../structs/RBush.js").Entry} */
|
||||
const box = {
|
||||
minX: /** @type {number} */ (declutterGroup[0]),
|
||||
minY: /** @type {number} */ (declutterGroup[1]),
|
||||
@@ -529,13 +529,13 @@ class CanvasReplay extends VectorContext {
|
||||
/**
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} context Context.
|
||||
* @param {module:ol/transform~Transform} transform Transform.
|
||||
* @param {import("../../transform.js").Transform} transform Transform.
|
||||
* @param {Object<string, boolean>} skippedFeaturesHash Ids of features
|
||||
* to skip.
|
||||
* @param {Array<*>} instructions Instructions array.
|
||||
* @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
|
||||
* @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
|
||||
* @param {function((import("../../Feature.js").default|import("../Feature.js").default)): T|undefined} featureCallback Feature callback.
|
||||
* @param {import("../../extent.js").Extent=} opt_hitExtent Only check features that intersect this
|
||||
* extent.
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template T
|
||||
@@ -575,7 +575,7 @@ class CanvasReplay extends VectorContext {
|
||||
const coordinateCache = this.coordinateCache_;
|
||||
const viewRotation = this.viewRotation_;
|
||||
|
||||
const state = /** @type {module:ol/render~State} */ ({
|
||||
const state = /** @type {import("../../render.js").State} */ ({
|
||||
context: context,
|
||||
pixelRatio: this.pixelRatio,
|
||||
resolution: this.resolution,
|
||||
@@ -585,14 +585,14 @@ class CanvasReplay extends VectorContext {
|
||||
// When the batch size gets too big, performance decreases. 200 is a good
|
||||
// balance between batch size and number of fill/stroke instructions.
|
||||
const batchSize = this.instructions != instructions || this.overlaps ? 0 : 200;
|
||||
let /** @type {module:ol/Feature|module:ol/render/Feature} */ feature;
|
||||
let /** @type {import("../../Feature.js").default|import("../Feature.js").default} */ feature;
|
||||
let x, y;
|
||||
while (i < ii) {
|
||||
const instruction = instructions[i];
|
||||
const type = /** @type {module:ol/render/canvas/Instruction} */ (instruction[0]);
|
||||
const type = /** @type {import("./Instruction.js").default} */ (instruction[0]);
|
||||
switch (type) {
|
||||
case CanvasInstruction.BEGIN_GEOMETRY:
|
||||
feature = /** @type {module:ol/Feature|module:ol/render/Feature} */ (instruction[1]);
|
||||
feature = /** @type {import("../../Feature.js").default|import("../Feature.js").default} */ (instruction[1]);
|
||||
if ((skipFeatures &&
|
||||
skippedFeaturesHash[getUid(feature).toString()]) ||
|
||||
!feature.getGeometry()) {
|
||||
@@ -639,7 +639,7 @@ class CanvasReplay extends VectorContext {
|
||||
case CanvasInstruction.CUSTOM:
|
||||
d = /** @type {number} */ (instruction[1]);
|
||||
dd = instruction[2];
|
||||
const geometry = /** @type {module:ol/geom/SimpleGeometry} */ (instruction[3]);
|
||||
const geometry = /** @type {import("../../geom/SimpleGeometry.js").default} */ (instruction[3]);
|
||||
const renderer = instruction[4];
|
||||
const fn = instruction.length == 6 ? instruction[5] : undefined;
|
||||
state.geometry = geometry;
|
||||
@@ -666,7 +666,7 @@ class CanvasReplay extends VectorContext {
|
||||
// Remaining arguments in DRAW_IMAGE are in alphabetical order
|
||||
anchorX = /** @type {number} */ (instruction[4]);
|
||||
anchorY = /** @type {number} */ (instruction[5]);
|
||||
declutterGroup = featureCallback ? null : /** @type {module:ol/render/canvas~DeclutterGroup} */ (instruction[6]);
|
||||
declutterGroup = featureCallback ? null : /** @type {import("../canvas.js").DeclutterGroup} */ (instruction[6]);
|
||||
const height = /** @type {number} */ (instruction[7]);
|
||||
const opacity = /** @type {number} */ (instruction[8]);
|
||||
const originX = /** @type {number} */ (instruction[9]);
|
||||
@@ -704,7 +704,7 @@ class CanvasReplay extends VectorContext {
|
||||
const begin = /** @type {number} */ (instruction[1]);
|
||||
const end = /** @type {number} */ (instruction[2]);
|
||||
const baseline = /** @type {number} */ (instruction[3]);
|
||||
declutterGroup = featureCallback ? null : /** @type {module:ol/render/canvas~DeclutterGroup} */ (instruction[4]);
|
||||
declutterGroup = featureCallback ? null : /** @type {import("../canvas.js").DeclutterGroup} */ (instruction[4]);
|
||||
const overflow = /** @type {number} */ (instruction[5]);
|
||||
const fillKey = /** @type {string} */ (instruction[6]);
|
||||
const maxAngle = /** @type {number} */ (instruction[7]);
|
||||
@@ -760,7 +760,7 @@ class CanvasReplay extends VectorContext {
|
||||
break;
|
||||
case CanvasInstruction.END_GEOMETRY:
|
||||
if (featureCallback !== undefined) {
|
||||
feature = /** @type {module:ol/Feature|module:ol/render/Feature} */ (instruction[1]);
|
||||
feature = /** @type {import("../../Feature.js").default|import("../Feature.js").default} */ (instruction[1]);
|
||||
const result = featureCallback(feature);
|
||||
if (result) {
|
||||
return result;
|
||||
@@ -814,7 +814,7 @@ class CanvasReplay extends VectorContext {
|
||||
}
|
||||
}
|
||||
|
||||
context.fillStyle = /** @type {module:ol/colorlike~ColorLike} */ (instruction[1]);
|
||||
context.fillStyle = /** @type {import("../../colorlike.js").ColorLike} */ (instruction[1]);
|
||||
++i;
|
||||
break;
|
||||
case CanvasInstruction.SET_STROKE_STYLE:
|
||||
@@ -850,7 +850,7 @@ class CanvasReplay extends VectorContext {
|
||||
|
||||
/**
|
||||
* @param {CanvasRenderingContext2D} context Context.
|
||||
* @param {module:ol/transform~Transform} transform Transform.
|
||||
* @param {import("../../transform.js").Transform} transform Transform.
|
||||
* @param {number} viewRotation View rotation.
|
||||
* @param {Object<string, boolean>} skippedFeaturesHash Ids of features
|
||||
* to skip.
|
||||
@@ -864,13 +864,13 @@ class CanvasReplay extends VectorContext {
|
||||
|
||||
/**
|
||||
* @param {CanvasRenderingContext2D} context Context.
|
||||
* @param {module:ol/transform~Transform} transform Transform.
|
||||
* @param {import("../../transform.js").Transform} transform Transform.
|
||||
* @param {number} viewRotation View rotation.
|
||||
* @param {Object<string, boolean>} skippedFeaturesHash Ids of features
|
||||
* to skip.
|
||||
* @param {function((module:ol/Feature|module:ol/render/Feature)): T=} opt_featureCallback
|
||||
* @param {function((import("../../Feature.js").default|import("../Feature.js").default)): T=} opt_featureCallback
|
||||
* Feature callback.
|
||||
* @param {module:ol/extent~Extent=} opt_hitExtent Only check features that intersect this
|
||||
* @param {import("../../extent.js").Extent=} opt_hitExtent Only check features that intersect this
|
||||
* extent.
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template T
|
||||
@@ -903,7 +903,7 @@ class CanvasReplay extends VectorContext {
|
||||
let begin = -1;
|
||||
for (i = 0; i < n; ++i) {
|
||||
instruction = hitDetectionInstructions[i];
|
||||
type = /** @type {module:ol/render/canvas/Instruction} */ (instruction[0]);
|
||||
type = /** @type {import("./Instruction.js").default} */ (instruction[0]);
|
||||
if (type == CanvasInstruction.END_GEOMETRY) {
|
||||
begin = i;
|
||||
} else if (type == CanvasInstruction.BEGIN_GEOMETRY) {
|
||||
@@ -966,8 +966,8 @@ class CanvasReplay extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/render/canvas~FillStrokeState} state State.
|
||||
* @param {module:ol/geom/Geometry|module:ol/render/Feature} geometry Geometry.
|
||||
* @param {import("../canvas.js").FillStrokeState} state State.
|
||||
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
|
||||
* @return {Array<*>} Fill instruction.
|
||||
*/
|
||||
createFill(state, geometry) {
|
||||
@@ -981,14 +981,14 @@ class CanvasReplay extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/render/canvas~FillStrokeState} state State.
|
||||
* @param {import("../canvas.js").FillStrokeState} state State.
|
||||
*/
|
||||
applyStroke(state) {
|
||||
this.instructions.push(this.createStroke(state));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/render/canvas~FillStrokeState} state State.
|
||||
* @param {import("../canvas.js").FillStrokeState} state State.
|
||||
* @return {Array<*>} Stroke instruction.
|
||||
*/
|
||||
createStroke(state) {
|
||||
@@ -1001,9 +1001,9 @@ 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 {module:ol/geom/Geometry|module:ol/render/Feature} geometry Geometry.
|
||||
* @param {import("../canvas.js").FillStrokeState} state State.
|
||||
* @param {function(this:import("./Replay.js").default, import("../canvas.js").FillStrokeState, (import("../../geom/Geometry.js").default|import("../Feature.js").default)):Array<*>} createFill Create fill.
|
||||
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
|
||||
*/
|
||||
updateFillStyle(state, createFill, geometry) {
|
||||
const fillStyle = state.fillStyle;
|
||||
@@ -1016,8 +1016,8 @@ 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)} applyStroke Apply stroke.
|
||||
* @param {import("../canvas.js").FillStrokeState} state State.
|
||||
* @param {function(this:import("./Replay.js").default, import("../canvas.js").FillStrokeState)} applyStroke Apply stroke.
|
||||
*/
|
||||
updateStrokeStyle(state, applyStroke) {
|
||||
const strokeStyle = state.strokeStyle;
|
||||
@@ -1048,8 +1048,8 @@ class CanvasReplay extends VectorContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/geom/Geometry|module:ol/render/Feature} geometry Geometry.
|
||||
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature.
|
||||
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry Geometry.
|
||||
* @param {import("../../Feature.js").default|import("../Feature.js").default} feature Feature.
|
||||
*/
|
||||
endGeometry(geometry, feature) {
|
||||
this.beginGeometryInstruction1_[2] = this.instructions.length;
|
||||
@@ -1065,7 +1065,7 @@ class CanvasReplay extends VectorContext {
|
||||
* Get the buffered rendering extent. Rendering will be clipped to the extent
|
||||
* provided to the constructor. To account for symbolizers that may intersect
|
||||
* this extent, we calculate a buffered extent (e.g. based on stroke width).
|
||||
* @return {module:ol/extent~Extent} The buffered rendering extent.
|
||||
* @return {import("../../extent.js").Extent} The buffered rendering extent.
|
||||
* @protected
|
||||
*/
|
||||
getBufferedMaxExtent() {
|
||||
|
||||
@@ -19,9 +19,9 @@ 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>)>}
|
||||
* @type {Object<import("../ReplayType.js").default,
|
||||
* function(new: import("./Replay.js").default, number, import("../../extent.js").Extent,
|
||||
* number, number, boolean, Array<import("../canvas.js").DeclutterGroup>)>}
|
||||
*/
|
||||
const BATCH_CONSTRUCTORS = {
|
||||
'Circle': CanvasPolygonReplay,
|
||||
@@ -36,7 +36,7 @@ const BATCH_CONSTRUCTORS = {
|
||||
class CanvasReplayGroup extends ReplayGroup {
|
||||
/**
|
||||
* @param {number} tolerance Tolerance.
|
||||
* @param {module:ol/extent~Extent} maxExtent Max extent.
|
||||
* @param {import("../../extent.js").Extent} maxExtent Max extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {boolean} overlaps The replay group can have overlapping geometries.
|
||||
@@ -61,7 +61,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
this.declutterTree_ = declutterTree;
|
||||
|
||||
/**
|
||||
* @type {module:ol/render/canvas~DeclutterGroup}
|
||||
* @type {import("../canvas.js").DeclutterGroup}
|
||||
* @private
|
||||
*/
|
||||
this.declutterGroup_ = null;
|
||||
@@ -74,7 +74,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../../extent.js").Extent}
|
||||
*/
|
||||
this.maxExtent_ = maxExtent;
|
||||
|
||||
@@ -104,7 +104,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!Object<string, !Object<module:ol/render/ReplayType, module:ol/render/canvas/Replay>>}
|
||||
* @type {!Object<string, !Object<import("../ReplayType.js").default, import("./Replay.js").default>>}
|
||||
*/
|
||||
this.replaysByZIndex_ = {};
|
||||
|
||||
@@ -116,14 +116,14 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/transform~Transform}
|
||||
* @type {import("../../transform.js").Transform}
|
||||
*/
|
||||
this.hitDetectionTransform_ = createTransform();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} group Group with previous replay.
|
||||
* @return {module:ol/render/canvas~DeclutterGroup} Declutter instruction group.
|
||||
* @return {import("../canvas.js").DeclutterGroup} Declutter instruction group.
|
||||
*/
|
||||
addDeclutter(group) {
|
||||
let declutter = null;
|
||||
@@ -141,7 +141,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
|
||||
/**
|
||||
* @param {CanvasRenderingContext2D} context Context.
|
||||
* @param {module:ol/transform~Transform} transform Transform.
|
||||
* @param {import("../../transform.js").Transform} transform Transform.
|
||||
*/
|
||||
clip(context, transform) {
|
||||
const flatClipCoords = this.getClipCoords(transform);
|
||||
@@ -154,7 +154,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array<module:ol/render/ReplayType>} replays Replays.
|
||||
* @param {Array<import("../ReplayType.js").default>} replays Replays.
|
||||
* @return {boolean} Has replays of the provided types.
|
||||
*/
|
||||
hasReplays(replays) {
|
||||
@@ -182,13 +182,13 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/coordinate~Coordinate} coordinate Coordinate.
|
||||
* @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} rotation Rotation.
|
||||
* @param {number} hitTolerance Hit tolerance in pixels.
|
||||
* @param {Object<string, boolean>} skippedFeaturesHash Ids of features to skip.
|
||||
* @param {function((module:ol/Feature|module:ol/render/Feature)): T} callback Feature callback.
|
||||
* @param {Object<string, module:ol/render/canvas~DeclutterGroup>} declutterReplays Declutter replays.
|
||||
* @param {function((import("../../Feature.js").default|import("../Feature.js").default)): T} callback Feature callback.
|
||||
* @param {Object<string, import("../canvas.js").DeclutterGroup>} declutterReplays Declutter replays.
|
||||
* @return {T|undefined} Callback result.
|
||||
* @template T
|
||||
*/
|
||||
@@ -219,7 +219,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {module:ol/extent~Extent}
|
||||
* @type {import("../../extent.js").Extent}
|
||||
*/
|
||||
let hitExtent;
|
||||
if (this.renderBuffer_ !== undefined) {
|
||||
@@ -239,7 +239,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
let replayType;
|
||||
|
||||
/**
|
||||
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature.
|
||||
* @param {import("../../Feature.js").default|import("../Feature.js").default} feature Feature.
|
||||
* @return {?} Callback result.
|
||||
*/
|
||||
function featureCallback(feature) {
|
||||
@@ -299,7 +299,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {module:ol/transform~Transform} transform Transform.
|
||||
* @param {import("../../transform.js").Transform} transform Transform.
|
||||
* @return {Array<number>} Clip coordinates.
|
||||
*/
|
||||
getClipCoords(transform) {
|
||||
@@ -335,7 +335,7 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {Object<string, Object<module:ol/render/ReplayType, module:ol/render/canvas/Replay>>} Replays.
|
||||
* @return {Object<string, Object<import("../ReplayType.js").default, import("./Replay.js").default>>} Replays.
|
||||
*/
|
||||
getReplays() {
|
||||
return this.replaysByZIndex_;
|
||||
@@ -350,13 +350,13 @@ class CanvasReplayGroup extends ReplayGroup {
|
||||
|
||||
/**
|
||||
* @param {CanvasRenderingContext2D} context Context.
|
||||
* @param {module:ol/transform~Transform} transform Transform.
|
||||
* @param {import("../../transform.js").Transform} transform Transform.
|
||||
* @param {number} viewRotation View rotation.
|
||||
* @param {Object<string, boolean>} skippedFeaturesHash Ids of features to skip.
|
||||
* @param {boolean} snapToPixel Snap point symbols and test to integer pixel.
|
||||
* @param {Array<module:ol/render/ReplayType>=} opt_replayTypes Ordered replay types to replay.
|
||||
* @param {Array<import("../ReplayType.js").default>=} 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.
|
||||
* @param {Object<string, import("../canvas.js").DeclutterGroup>=} opt_declutterReplays Declutter replays.
|
||||
*/
|
||||
replay(
|
||||
context,
|
||||
|
||||
@@ -17,7 +17,7 @@ import TextPlacement from '../../style/TextPlacement.js';
|
||||
class CanvasTextReplay extends CanvasReplay {
|
||||
/**
|
||||
* @param {number} tolerance Tolerance.
|
||||
* @param {module:ol/extent~Extent} maxExtent Maximum extent.
|
||||
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {boolean} overlaps The replay can have overlapping geometries.
|
||||
@@ -28,7 +28,7 @@ class CanvasTextReplay extends CanvasReplay {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/render/canvas~DeclutterGroup}
|
||||
* @type {import("../canvas.js").DeclutterGroup}
|
||||
*/
|
||||
this.declutterGroup_;
|
||||
|
||||
@@ -70,34 +70,34 @@ class CanvasTextReplay extends CanvasReplay {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?module:ol/render/canvas~FillState}
|
||||
* @type {?import("../canvas.js").FillState}
|
||||
*/
|
||||
this.textFillState_ = null;
|
||||
|
||||
/**
|
||||
* @type {!Object<string, module:ol/render/canvas~FillState>}
|
||||
* @type {!Object<string, import("../canvas.js").FillState>}
|
||||
*/
|
||||
this.fillStates = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {?module:ol/render/canvas~StrokeState}
|
||||
* @type {?import("../canvas.js").StrokeState}
|
||||
*/
|
||||
this.textStrokeState_ = null;
|
||||
|
||||
/**
|
||||
* @type {!Object<string, module:ol/render/canvas~StrokeState>}
|
||||
* @type {!Object<string, import("../canvas.js").StrokeState>}
|
||||
*/
|
||||
this.strokeStates = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/render/canvas~TextState}
|
||||
* @type {import("../canvas.js").TextState}
|
||||
*/
|
||||
this.textState_ = /** @type {module:ol/render/canvas~TextState} */ ({});
|
||||
this.textState_ = /** @type {import("../canvas.js").TextState} */ ({});
|
||||
|
||||
/**
|
||||
* @type {!Object<string, module:ol/render/canvas~TextState>}
|
||||
* @type {!Object<string, import("../canvas.js").TextState>}
|
||||
*/
|
||||
this.textStates = {};
|
||||
|
||||
@@ -200,24 +200,24 @@ class CanvasTextReplay extends CanvasReplay {
|
||||
end = flatCoordinates.length;
|
||||
break;
|
||||
case GeometryType.LINE_STRING:
|
||||
flatCoordinates = /** @type {module:ol/geom/LineString} */ (geometry).getFlatMidpoint();
|
||||
flatCoordinates = /** @type {import("../../geom/LineString.js").default} */ (geometry).getFlatMidpoint();
|
||||
break;
|
||||
case GeometryType.CIRCLE:
|
||||
flatCoordinates = /** @type {module:ol/geom/Circle} */ (geometry).getCenter();
|
||||
flatCoordinates = /** @type {import("../../geom/Circle.js").default} */ (geometry).getCenter();
|
||||
break;
|
||||
case GeometryType.MULTI_LINE_STRING:
|
||||
flatCoordinates = /** @type {module:ol/geom/MultiLineString} */ (geometry).getFlatMidpoints();
|
||||
flatCoordinates = /** @type {import("../../geom/MultiLineString.js").default} */ (geometry).getFlatMidpoints();
|
||||
end = flatCoordinates.length;
|
||||
break;
|
||||
case GeometryType.POLYGON:
|
||||
flatCoordinates = /** @type {module:ol/geom/Polygon} */ (geometry).getFlatInteriorPoint();
|
||||
flatCoordinates = /** @type {import("../../geom/Polygon.js").default} */ (geometry).getFlatInteriorPoint();
|
||||
if (!textState.overflow && flatCoordinates[2] / this.resolution < width) {
|
||||
return;
|
||||
}
|
||||
stride = 3;
|
||||
break;
|
||||
case GeometryType.MULTI_POLYGON:
|
||||
const interiorPoints = /** @type {module:ol/geom/MultiPolygon} */ (geometry).getFlatInteriorPoints();
|
||||
const interiorPoints = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getFlatInteriorPoints();
|
||||
flatCoordinates = [];
|
||||
for (i = 0, ii = interiorPoints.length; i < ii; i += 3) {
|
||||
if (textState.overflow || interiorPoints[i + 2] / this.resolution >= width) {
|
||||
@@ -356,7 +356,7 @@ class CanvasTextReplay extends CanvasReplay {
|
||||
* @private
|
||||
* @param {number} begin Begin.
|
||||
* @param {number} end End.
|
||||
* @param {module:ol/render/canvas~DeclutterGroup} declutterGroup Declutter group.
|
||||
* @param {import("../canvas.js").DeclutterGroup} declutterGroup Declutter group.
|
||||
*/
|
||||
drawChars_(begin, end, declutterGroup) {
|
||||
const strokeState = this.textStrokeState_;
|
||||
@@ -366,7 +366,7 @@ class CanvasTextReplay extends CanvasReplay {
|
||||
const strokeKey = this.strokeKey_;
|
||||
if (strokeState) {
|
||||
if (!(strokeKey in this.strokeStates)) {
|
||||
this.strokeStates[strokeKey] = /** @type {module:ol/render/canvas~StrokeState} */ ({
|
||||
this.strokeStates[strokeKey] = /** @type {import("../canvas.js").StrokeState} */ ({
|
||||
strokeStyle: strokeState.strokeStyle,
|
||||
lineCap: strokeState.lineCap,
|
||||
lineDashOffset: strokeState.lineDashOffset,
|
||||
@@ -379,7 +379,7 @@ class CanvasTextReplay extends CanvasReplay {
|
||||
}
|
||||
const textKey = this.textKey_;
|
||||
if (!(this.textKey_ in this.textStates)) {
|
||||
this.textStates[this.textKey_] = /** @type {module:ol/render/canvas~TextState} */ ({
|
||||
this.textStates[this.textKey_] = /** @type {import("../canvas.js").TextState} */ ({
|
||||
font: textState.font,
|
||||
textAlign: textState.textAlign || defaultTextAlign,
|
||||
scale: textState.scale
|
||||
@@ -388,7 +388,7 @@ class CanvasTextReplay extends CanvasReplay {
|
||||
const fillKey = this.fillKey_;
|
||||
if (fillState) {
|
||||
if (!(fillKey in this.fillStates)) {
|
||||
this.fillStates[fillKey] = /** @type {module:ol/render/canvas~FillState} */ ({
|
||||
this.fillStates[fillKey] = /** @type {import("../canvas.js").FillState} */ ({
|
||||
fillStyle: fillState.fillStyle
|
||||
});
|
||||
}
|
||||
@@ -440,7 +440,7 @@ class CanvasTextReplay extends CanvasReplay {
|
||||
if (!textStyle) {
|
||||
this.text_ = '';
|
||||
} else {
|
||||
this.declutterGroup_ = /** @type {module:ol/render/canvas~DeclutterGroup} */ (declutterGroup);
|
||||
this.declutterGroup_ = /** @type {import("../canvas.js").DeclutterGroup} */ (declutterGroup);
|
||||
|
||||
const textFillStyle = textStyle.getFill();
|
||||
if (!textFillStyle) {
|
||||
@@ -448,7 +448,7 @@ class CanvasTextReplay extends CanvasReplay {
|
||||
} else {
|
||||
fillState = this.textFillState_;
|
||||
if (!fillState) {
|
||||
fillState = this.textFillState_ = /** @type {module:ol/render/canvas~FillState} */ ({});
|
||||
fillState = this.textFillState_ = /** @type {import("../canvas.js").FillState} */ ({});
|
||||
}
|
||||
fillState.fillStyle = asColorLike(
|
||||
textFillStyle.getColor() || defaultFillStyle);
|
||||
@@ -460,7 +460,7 @@ class CanvasTextReplay extends CanvasReplay {
|
||||
} else {
|
||||
strokeState = this.textStrokeState_;
|
||||
if (!strokeState) {
|
||||
strokeState = this.textStrokeState_ = /** @type {module:ol/render/canvas~StrokeState} */ ({});
|
||||
strokeState = this.textStrokeState_ = /** @type {import("../canvas.js").StrokeState} */ ({});
|
||||
}
|
||||
const lineDash = textStrokeStyle.getLineDash();
|
||||
const lineDashOffset = textStrokeStyle.getLineDashOffset();
|
||||
|
||||
Reference in New Issue
Block a user