Transformed types
Using the [ts.js codemod](https://gist.github.com/tschaub/1ea498c9d1e5268cf36d212b3949be4e): jscodeshift --transform ts.js src
This commit is contained in:
@@ -58,13 +58,13 @@ class Atlas {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<module:ol/style/Atlas~AtlasBlock>}
|
||||
* @type {Array<AtlasBlock>}
|
||||
*/
|
||||
this.emptyBlocks_ = [{x: 0, y: 0, width: size, height: size}];
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Object<string, module:ol/style/Atlas~AtlasInfo>}
|
||||
* @type {Object<string, AtlasInfo>}
|
||||
*/
|
||||
this.entries_ = {};
|
||||
|
||||
@@ -83,7 +83,7 @@ class Atlas {
|
||||
|
||||
/**
|
||||
* @param {string} id The identifier of the entry to check.
|
||||
* @return {?module:ol/style/Atlas~AtlasInfo} The atlas info.
|
||||
* @return {?AtlasInfo} The atlas info.
|
||||
*/
|
||||
get(id) {
|
||||
return this.entries_[id] || null;
|
||||
@@ -97,7 +97,7 @@ class Atlas {
|
||||
* Called to render the new image onto an atlas image.
|
||||
* @param {Object=} opt_this Value to use as `this` when executing
|
||||
* `renderCallback`.
|
||||
* @return {?module:ol/style/Atlas~AtlasInfo} The position and atlas image for the entry.
|
||||
* @return {?AtlasInfo} The position and atlas image for the entry.
|
||||
*/
|
||||
add(id, width, height, renderCallback, opt_this) {
|
||||
for (let i = 0, ii = this.emptyBlocks_.length; i < ii; ++i) {
|
||||
@@ -130,7 +130,7 @@ class Atlas {
|
||||
/**
|
||||
* @private
|
||||
* @param {number} index The index of the block.
|
||||
* @param {module:ol/style/Atlas~AtlasBlock} block The block to split.
|
||||
* @param {AtlasBlock} block The block to split.
|
||||
* @param {number} width The width of the entry to insert.
|
||||
* @param {number} height The height of the entry to insert.
|
||||
*/
|
||||
@@ -138,9 +138,9 @@ class Atlas {
|
||||
const deltaWidth = block.width - width;
|
||||
const deltaHeight = block.height - height;
|
||||
|
||||
/** @type {module:ol/style/Atlas~AtlasBlock} */
|
||||
/** @type {AtlasBlock} */
|
||||
let newBlock1;
|
||||
/** @type {module:ol/style/Atlas~AtlasBlock} */
|
||||
/** @type {AtlasBlock} */
|
||||
let newBlock2;
|
||||
|
||||
if (deltaWidth > deltaHeight) {
|
||||
@@ -188,8 +188,8 @@ class Atlas {
|
||||
* blocks (that are potentially smaller) are filled first.
|
||||
* @private
|
||||
* @param {number} index The index of the block to remove.
|
||||
* @param {module:ol/style/Atlas~AtlasBlock} newBlock1 The 1st block to add.
|
||||
* @param {module:ol/style/Atlas~AtlasBlock} newBlock2 The 2nd block to add.
|
||||
* @param {AtlasBlock} newBlock1 The 1st block to add.
|
||||
* @param {AtlasBlock} newBlock2 The 2nd block to add.
|
||||
*/
|
||||
updateBlocks_(index, newBlock1, newBlock2) {
|
||||
const args = [index, 1];
|
||||
|
||||
@@ -57,7 +57,7 @@ const MAX_ATLAS_SIZE = -1;
|
||||
*/
|
||||
class AtlasManager {
|
||||
/**
|
||||
* @param {module:ol/style/AtlasManager~Options=} opt_options Options.
|
||||
* @param {Options=} opt_options Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
@@ -90,7 +90,7 @@ class AtlasManager {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<module:ol/style/Atlas>}
|
||||
* @type {Array<import("./Atlas.js").default>}
|
||||
*/
|
||||
this.atlases_ = [new Atlas(this.currentSize_, this.space_)];
|
||||
|
||||
@@ -103,33 +103,33 @@ class AtlasManager {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<module:ol/style/Atlas>}
|
||||
* @type {Array<import("./Atlas.js").default>}
|
||||
*/
|
||||
this.hitAtlases_ = [new Atlas(this.currentHitSize_, this.space_)];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} id The identifier of the entry to check.
|
||||
* @return {?module:ol/style/AtlasManager~AtlasManagerInfo} The position and atlas image for the
|
||||
* @return {?AtlasManagerInfo} The position and atlas image for the
|
||||
* entry, or `null` if the entry is not part of the atlas manager.
|
||||
*/
|
||||
getInfo(id) {
|
||||
/** @type {?module:ol/style/Atlas~AtlasInfo} */
|
||||
/** @type {?import("./Atlas.js").AtlasInfo} */
|
||||
const info = this.getInfo_(this.atlases_, id);
|
||||
|
||||
if (!info) {
|
||||
return null;
|
||||
}
|
||||
const hitInfo = /** @type {module:ol/style/Atlas~AtlasInfo} */ (this.getInfo_(this.hitAtlases_, id));
|
||||
const hitInfo = /** @type {import("./Atlas.js").AtlasInfo} */ (this.getInfo_(this.hitAtlases_, id));
|
||||
|
||||
return this.mergeInfos_(info, hitInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Array<module:ol/style/Atlas>} atlases The atlases to search.
|
||||
* @param {Array<import("./Atlas.js").default>} atlases The atlases to search.
|
||||
* @param {string} id The identifier of the entry to check.
|
||||
* @return {?module:ol/style/Atlas~AtlasInfo} The position and atlas image for the entry,
|
||||
* @return {?import("./Atlas.js").AtlasInfo} The position and atlas image for the entry,
|
||||
* or `null` if the entry is not part of the atlases.
|
||||
*/
|
||||
getInfo_(atlases, id) {
|
||||
@@ -145,15 +145,15 @@ class AtlasManager {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {module:ol/style/Atlas~AtlasInfo} info The info for the real image.
|
||||
* @param {module:ol/style/Atlas~AtlasInfo} hitInfo The info for the hit-detection
|
||||
* @param {import("./Atlas.js").AtlasInfo} info The info for the real image.
|
||||
* @param {import("./Atlas.js").AtlasInfo} hitInfo The info for the hit-detection
|
||||
* image.
|
||||
* @return {?module:ol/style/AtlasManager~AtlasManagerInfo} The position and atlas image for the
|
||||
* @return {?AtlasManagerInfo} The position and atlas image for the
|
||||
* entry, or `null` if the entry is not part of the atlases.
|
||||
*/
|
||||
mergeInfos_(info, hitInfo) {
|
||||
return (
|
||||
/** @type {module:ol/style/AtlasManager~AtlasManagerInfo} */ ({
|
||||
/** @type {AtlasManagerInfo} */ ({
|
||||
offsetX: info.offsetX,
|
||||
offsetY: info.offsetY,
|
||||
image: info.image,
|
||||
@@ -180,7 +180,7 @@ class AtlasManager {
|
||||
* detection atlas image.
|
||||
* @param {Object=} opt_this Value to use as `this` when executing
|
||||
* `renderCallback` and `renderHitCallback`.
|
||||
* @return {?module:ol/style/AtlasManager~AtlasManagerInfo} The position and atlas image for the
|
||||
* @return {?AtlasManagerInfo} The position and atlas image for the
|
||||
* entry, or `null` if the image is too big.
|
||||
*/
|
||||
add(id, width, height, renderCallback, opt_renderHitCallback, opt_this) {
|
||||
@@ -189,7 +189,7 @@ class AtlasManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @type {?module:ol/style/Atlas~AtlasInfo} */
|
||||
/** @type {?import("./Atlas.js").AtlasInfo} */
|
||||
const info = this.add_(false, id, width, height, renderCallback, opt_this);
|
||||
if (!info) {
|
||||
return null;
|
||||
@@ -201,7 +201,7 @@ class AtlasManager {
|
||||
const renderHitCallback = opt_renderHitCallback !== undefined ?
|
||||
opt_renderHitCallback : VOID;
|
||||
|
||||
const hitInfo = /** @type {module:ol/style/Atlas~AtlasInfo} */ (this.add_(true,
|
||||
const hitInfo = /** @type {import("./Atlas.js").AtlasInfo} */ (this.add_(true,
|
||||
id, width, height, renderHitCallback, opt_this));
|
||||
|
||||
return this.mergeInfos_(info, hitInfo);
|
||||
@@ -217,7 +217,7 @@ class AtlasManager {
|
||||
* Called to render the new image onto an atlas image.
|
||||
* @param {Object=} opt_this Value to use as `this` when executing
|
||||
* `renderCallback` and `renderHitCallback`.
|
||||
* @return {?module:ol/style/Atlas~AtlasInfo} The position and atlas image for the entry,
|
||||
* @return {?import("./Atlas.js").AtlasInfo} The position and atlas image for the entry,
|
||||
* or `null` if the image is too big.
|
||||
*/
|
||||
add_(isHitAtlas, id, width, height, renderCallback, opt_this) {
|
||||
|
||||
@@ -7,10 +7,10 @@ import RegularShape from '../style/RegularShape.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/style/Fill} [fill] Fill style.
|
||||
* @property {import("./Fill.js").default} [fill] Fill style.
|
||||
* @property {number} radius Circle radius.
|
||||
* @property {module:ol/style/Stroke} [stroke] Stroke style.
|
||||
* @property {module:ol/style/AtlasManager} [atlasManager] The atlas manager to use for this circle.
|
||||
* @property {import("./Stroke.js").default} [stroke] Stroke style.
|
||||
* @property {import("./AtlasManager.js").default} [atlasManager] The atlas manager to use for this circle.
|
||||
* When using WebGL it is recommended to use an atlas manager to avoid texture switching. If an atlas manager is given,
|
||||
* the circle is added to an atlas. By default no atlas manager is used.
|
||||
*/
|
||||
@@ -23,11 +23,11 @@ import RegularShape from '../style/RegularShape.js';
|
||||
*/
|
||||
class CircleStyle extends RegularShape {
|
||||
/**
|
||||
* @param {module:ol/style/Circle~Options=} opt_options Options.
|
||||
* @param {Options=} opt_options Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
const options = opt_options || /** @type {module:ol/style/Circle~Options} */ ({});
|
||||
const options = opt_options || /** @type {Options} */ ({});
|
||||
|
||||
super({
|
||||
points: Infinity,
|
||||
@@ -41,7 +41,7 @@ class CircleStyle extends RegularShape {
|
||||
|
||||
/**
|
||||
* Clones the style. If an atlasmanager was provided to the original style it will be used in the cloned style, too.
|
||||
* @return {module:ol/style/Circle} The cloned style.
|
||||
* @return {import("./Circle.js").default} The cloned style.
|
||||
* @override
|
||||
* @api
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@ import {asString} from '../color.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/color~Color|module:ol/colorlike~ColorLike} [color] A color, gradient or pattern.
|
||||
* @property {import("../color.js").Color|import("../colorlike.js").ColorLike} [color] A color, gradient or pattern.
|
||||
* See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats.
|
||||
* Default null; if null, the Canvas/renderer default black will be used.
|
||||
*/
|
||||
@@ -20,7 +20,7 @@ import {asString} from '../color.js';
|
||||
*/
|
||||
class Fill {
|
||||
/**
|
||||
* @param {module:ol/style/Fill~Options=} opt_options Options.
|
||||
* @param {Options=} opt_options Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
@@ -28,7 +28,7 @@ class Fill {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/color~Color|module:ol/colorlike~ColorLike}
|
||||
* @type {import("../color.js").Color|import("../colorlike.js").ColorLike}
|
||||
*/
|
||||
this.color_ = options.color !== undefined ? options.color : null;
|
||||
|
||||
@@ -41,7 +41,7 @@ class Fill {
|
||||
|
||||
/**
|
||||
* Clones the style. The color is not cloned if it is an {@link module:ol/colorlike~ColorLike}.
|
||||
* @return {module:ol/style/Fill} The cloned style.
|
||||
* @return {import("./Fill.js").default} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -53,7 +53,7 @@ class Fill {
|
||||
|
||||
/**
|
||||
* Get the fill color.
|
||||
* @return {module:ol/color~Color|module:ol/colorlike~ColorLike} Color.
|
||||
* @return {import("../color.js").Color|import("../colorlike.js").ColorLike} Color.
|
||||
* @api
|
||||
*/
|
||||
getColor() {
|
||||
@@ -63,7 +63,7 @@ class Fill {
|
||||
/**
|
||||
* Set the color.
|
||||
*
|
||||
* @param {module:ol/color~Color|module:ol/colorlike~ColorLike} color Color.
|
||||
* @param {import("../color.js").Color|import("../colorlike.js").ColorLike} color Color.
|
||||
* @api
|
||||
*/
|
||||
setColor(color) {
|
||||
|
||||
+19
-19
@@ -16,15 +16,15 @@ import ImageStyle from '../style/Image.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {Array<number>} [anchor=[0.5, 0.5]] Anchor. Default value is the icon center.
|
||||
* @property {module:ol/style/IconOrigin} [anchorOrigin] Origin of the anchor: `bottom-left`, `bottom-right`,
|
||||
* @property {import("./IconOrigin.js").default} [anchorOrigin] Origin of the anchor: `bottom-left`, `bottom-right`,
|
||||
* `top-left` or `top-right`. Default is `top-left`.
|
||||
* @property {module:ol/style/IconAnchorUnits} [anchorXUnits] Units in which the anchor x value is
|
||||
* @property {import("./IconAnchorUnits.js").default} [anchorXUnits] Units in which the anchor x value is
|
||||
* specified. A value of `'fraction'` indicates the x value is a fraction of the icon. A value of `'pixels'` indicates
|
||||
* the x value in pixels. Default is `'fraction'`.
|
||||
* @property {module:ol/style/IconAnchorUnits} [anchorYUnits] Units in which the anchor y value is
|
||||
* @property {import("./IconAnchorUnits.js").default} [anchorYUnits] Units in which the anchor y value is
|
||||
* specified. A value of `'fraction'` indicates the y value is a fraction of the icon. A value of `'pixels'` indicates
|
||||
* the y value in pixels. Default is `'fraction'`.
|
||||
* @property {module:ol/color~Color|string} [color] Color to tint the icon. If not specified,
|
||||
* @property {import("../color.js").Color|string} [color] Color to tint the icon. If not specified,
|
||||
* the icon will be left as is.
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that you must provide a
|
||||
* `crossOrigin` value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer.
|
||||
@@ -34,15 +34,15 @@ import ImageStyle from '../style/Image.js';
|
||||
* to provide the size of the image, with the `imgSize` option.
|
||||
* @property {Array<number>} [offset=[0, 0]] Offset, which, together with the size and the offset origin, define the
|
||||
* sub-rectangle to use from the original icon image.
|
||||
* @property {module:ol/style/IconOrigin} [offsetOrigin] Origin of the offset: `bottom-left`, `bottom-right`,
|
||||
* @property {import("./IconOrigin.js").default} [offsetOrigin] Origin of the offset: `bottom-left`, `bottom-right`,
|
||||
* `top-left` or `top-right`. Default is `top-left`.
|
||||
* @property {number} [opacity=1] Opacity of the icon.
|
||||
* @property {number} [scale=1] Scale.
|
||||
* @property {boolean} [rotateWithView=false] Whether to rotate the icon with the view.
|
||||
* @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).
|
||||
* @property {module:ol/size~Size} [size] Icon size in pixel. Can be used together with `offset` to define the
|
||||
* @property {import("../size.js").Size} [size] Icon size in pixel. Can be used together with `offset` to define the
|
||||
* sub-rectangle to use from the origin (sprite) icon image.
|
||||
* @property {module:ol/size~Size} [imgSize] Image size in pixels. Only required if `img` is set and `src` is not, and
|
||||
* @property {import("../size.js").Size} [imgSize] Image size in pixels. Only required if `img` is set and `src` is not, and
|
||||
* for SVG images in Internet Explorer 11. The provided `imgSize` needs to match the actual size of the image.
|
||||
* @property {string} [src] Image source URI.
|
||||
*/
|
||||
@@ -55,7 +55,7 @@ import ImageStyle from '../style/Image.js';
|
||||
*/
|
||||
class Icon extends ImageStyle {
|
||||
/**
|
||||
* @param {module:ol/style/Icon~Options=} opt_options Options.
|
||||
* @param {Options=} opt_options Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options || {};
|
||||
@@ -102,21 +102,21 @@ class Icon extends ImageStyle {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/IconOrigin}
|
||||
* @type {import("./IconOrigin.js").default}
|
||||
*/
|
||||
this.anchorOrigin_ = options.anchorOrigin !== undefined ?
|
||||
options.anchorOrigin : IconOrigin.TOP_LEFT;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/IconAnchorUnits}
|
||||
* @type {import("./IconAnchorUnits.js").default}
|
||||
*/
|
||||
this.anchorXUnits_ = options.anchorXUnits !== undefined ?
|
||||
options.anchorXUnits : IconAnchorUnits.FRACTION;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/IconAnchorUnits}
|
||||
* @type {import("./IconAnchorUnits.js").default}
|
||||
*/
|
||||
this.anchorYUnits_ = options.anchorYUnits !== undefined ?
|
||||
options.anchorYUnits : IconAnchorUnits.FRACTION;
|
||||
@@ -134,7 +134,7 @@ class Icon extends ImageStyle {
|
||||
const image = options.img !== undefined ? options.img : null;
|
||||
|
||||
/**
|
||||
* @type {module:ol/size~Size}
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
const imgSize = options.imgSize !== undefined ? options.imgSize : null;
|
||||
|
||||
@@ -155,20 +155,20 @@ class Icon extends ImageStyle {
|
||||
6); // A defined and non-empty `src` or `image` must be provided
|
||||
|
||||
/**
|
||||
* @type {module:ol/ImageState}
|
||||
* @type {import("../ImageState.js").default}
|
||||
*/
|
||||
const imageState = options.src !== undefined ?
|
||||
ImageState.IDLE : ImageState.LOADED;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/color~Color}
|
||||
* @type {import("../color.js").Color}
|
||||
*/
|
||||
this.color_ = options.color !== undefined ? asArray(options.color) : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/IconImage}
|
||||
* @type {import("./IconImage.js").default}
|
||||
*/
|
||||
this.iconImage_ = getIconImage(
|
||||
image, /** @type {string} */ (src), imgSize, this.crossOrigin_, imageState, this.color_);
|
||||
@@ -181,7 +181,7 @@ class Icon extends ImageStyle {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/IconOrigin}
|
||||
* @type {import("./IconOrigin.js").default}
|
||||
*/
|
||||
this.offsetOrigin_ = options.offsetOrigin !== undefined ?
|
||||
options.offsetOrigin : IconOrigin.TOP_LEFT;
|
||||
@@ -194,7 +194,7 @@ class Icon extends ImageStyle {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/size~Size}
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
this.size_ = options.size !== undefined ? options.size : null;
|
||||
|
||||
@@ -202,7 +202,7 @@ class Icon extends ImageStyle {
|
||||
|
||||
/**
|
||||
* Clones the style. The underlying Image/HTMLCanvasElement is not cloned.
|
||||
* @return {module:ol/style/Icon} The cloned style.
|
||||
* @return {import("./Icon.js").default} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -282,7 +282,7 @@ class Icon extends ImageStyle {
|
||||
|
||||
/**
|
||||
* Get the icon color.
|
||||
* @return {module:ol/color~Color} Color.
|
||||
* @return {import("../color.js").Color} Color.
|
||||
* @api
|
||||
*/
|
||||
getColor() {
|
||||
|
||||
+13
-13
@@ -13,10 +13,10 @@ class IconImage extends EventTarget {
|
||||
/**
|
||||
* @param {HTMLImageElement|HTMLCanvasElement} image Image.
|
||||
* @param {string|undefined} src Src.
|
||||
* @param {module:ol/size~Size} size Size.
|
||||
* @param {import("../size.js").Size} size Size.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {module:ol/ImageState} imageState Image state.
|
||||
* @param {module:ol/color~Color} color Color.
|
||||
* @param {import("../ImageState.js").default} imageState Image state.
|
||||
* @param {import("../color.js").Color} color Color.
|
||||
*/
|
||||
constructor(image, src, size, crossOrigin, imageState, color) {
|
||||
|
||||
@@ -48,25 +48,25 @@ class IconImage extends EventTarget {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/color~Color}
|
||||
* @type {import("../color.js").Color}
|
||||
*/
|
||||
this.color_ = color;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<module:ol/events~EventsKey>}
|
||||
* @type {Array<import("../events.js").EventsKey>}
|
||||
*/
|
||||
this.imageListenerKeys_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/ImageState}
|
||||
* @type {import("../ImageState.js").default}
|
||||
*/
|
||||
this.imageState_ = imageState;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/size~Size}
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
this.size_ = size;
|
||||
|
||||
@@ -141,7 +141,7 @@ class IconImage extends EventTarget {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {module:ol/ImageState} Image state.
|
||||
* @return {import("../ImageState.js").default} Image state.
|
||||
*/
|
||||
getImageState() {
|
||||
return this.imageState_;
|
||||
@@ -167,7 +167,7 @@ class IconImage extends EventTarget {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {module:ol/size~Size} Image size.
|
||||
* @return {import("../size.js").Size} Image size.
|
||||
*/
|
||||
getSize() {
|
||||
return this.size_;
|
||||
@@ -243,11 +243,11 @@ class IconImage extends EventTarget {
|
||||
/**
|
||||
* @param {HTMLImageElement|HTMLCanvasElement} image Image.
|
||||
* @param {string} src Src.
|
||||
* @param {module:ol/size~Size} size Size.
|
||||
* @param {import("../size.js").Size} size Size.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {module:ol/ImageState} imageState Image state.
|
||||
* @param {module:ol/color~Color} color Color.
|
||||
* @return {module:ol/style/IconImage} Icon image.
|
||||
* @param {import("../ImageState.js").default} imageState Image state.
|
||||
* @param {import("../color.js").Color} color Color.
|
||||
* @return {import("./IconImage.js").default} Icon image.
|
||||
*/
|
||||
export function get(image, src, size, crossOrigin, imageState, color) {
|
||||
let iconImage = iconImageCache.get(src, crossOrigin, color);
|
||||
|
||||
@@ -11,7 +11,7 @@ class IconImageCache {
|
||||
constructor() {
|
||||
|
||||
/**
|
||||
* @type {!Object<string, module:ol/style/IconImage>}
|
||||
* @type {!Object<string, import("./IconImage.js").default>}
|
||||
* @private
|
||||
*/
|
||||
this.cache_ = {};
|
||||
@@ -56,8 +56,8 @@ class IconImageCache {
|
||||
/**
|
||||
* @param {string} src Src.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {module:ol/color~Color} color Color.
|
||||
* @return {module:ol/style/IconImage} Icon image.
|
||||
* @param {import("../color.js").Color} color Color.
|
||||
* @return {import("./IconImage.js").default} Icon image.
|
||||
*/
|
||||
get(src, crossOrigin, color) {
|
||||
const key = getKey(src, crossOrigin, color);
|
||||
@@ -67,8 +67,8 @@ class IconImageCache {
|
||||
/**
|
||||
* @param {string} src Src.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {module:ol/color~Color} color Color.
|
||||
* @param {module:ol/style/IconImage} iconImage Icon image.
|
||||
* @param {import("../color.js").Color} color Color.
|
||||
* @param {import("./IconImage.js").default} iconImage Icon image.
|
||||
*/
|
||||
set(src, crossOrigin, color, iconImage) {
|
||||
const key = getKey(src, crossOrigin, color);
|
||||
@@ -93,7 +93,7 @@ class IconImageCache {
|
||||
/**
|
||||
* @param {string} src Src.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {module:ol/color~Color} color Color.
|
||||
* @param {import("../color.js").Color} color Color.
|
||||
* @return {string} Cache key.
|
||||
*/
|
||||
function getKey(src, crossOrigin, color) {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
class ImageStyle {
|
||||
/**
|
||||
* @param {module:ol/style/Image~Options} options Options.
|
||||
* @param {Options} options Options.
|
||||
*/
|
||||
constructor(options) {
|
||||
|
||||
@@ -122,19 +122,19 @@ class ImageStyle {
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @return {module:ol/ImageState} Image state.
|
||||
* @return {import("../ImageState.js").default} Image state.
|
||||
*/
|
||||
getImageState() {}
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @return {module:ol/size~Size} Image size.
|
||||
* @return {import("../size.js").Size} Image size.
|
||||
*/
|
||||
getImageSize() {}
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @return {module:ol/size~Size} Size of the hit-detection image.
|
||||
* @return {import("../size.js").Size} Size of the hit-detection image.
|
||||
*/
|
||||
getHitDetectionImageSize() {}
|
||||
|
||||
@@ -148,7 +148,7 @@ class ImageStyle {
|
||||
/**
|
||||
* Get the size of the symbolizer (in pixels).
|
||||
* @abstract
|
||||
* @return {module:ol/size~Size} Size.
|
||||
* @return {import("../size.js").Size} Size.
|
||||
*/
|
||||
getSize() {}
|
||||
|
||||
@@ -201,9 +201,9 @@ class ImageStyle {
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @param {function(this: T, module:ol/events/Event)} listener Listener function.
|
||||
* @param {function(this: T, import("../events/Event.js").default)} listener Listener function.
|
||||
* @param {T} thisArg Value to use as `this` when executing `listener`.
|
||||
* @return {module:ol/events~EventsKey|undefined} Listener key.
|
||||
* @return {import("../events.js").EventsKey|undefined} Listener key.
|
||||
* @template T
|
||||
*/
|
||||
listenImageChange(listener, thisArg) {}
|
||||
@@ -216,7 +216,7 @@ class ImageStyle {
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @param {function(this: T, module:ol/events/Event)} listener Listener function.
|
||||
* @param {function(this: T, import("../events/Event.js").default)} listener Listener function.
|
||||
* @param {T} thisArg Value to use as `this` when executing `listener`.
|
||||
* @template T
|
||||
*/
|
||||
|
||||
@@ -13,17 +13,17 @@ import ImageStyle from '../style/Image.js';
|
||||
/**
|
||||
* Specify radius for regular polygons, or radius1 and radius2 for stars.
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/style/Fill} [fill] Fill style.
|
||||
* @property {import("./Fill.js").default} [fill] Fill style.
|
||||
* @property {number} points Number of points for stars and regular polygons. In case of a polygon, the number of points
|
||||
* is the number of sides.
|
||||
* @property {number} [radius] Radius of a regular polygon.
|
||||
* @property {number} [radius1] Outer radius of a star.
|
||||
* @property {number} [radius2] Inner radius of a star.
|
||||
* @property {number} [angle=0] Shape's angle in radians. A value of 0 will have one of the shape's point facing up.
|
||||
* @property {module:ol/style/Stroke} [stroke] Stroke style.
|
||||
* @property {import("./Stroke.js").default} [stroke] Stroke style.
|
||||
* @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).
|
||||
* @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view.
|
||||
* @property {module:ol/style/AtlasManager} [atlasManager] The atlas manager to use for this symbol. When
|
||||
* @property {import("./AtlasManager.js").default} [atlasManager] The atlas manager to use for this symbol. When
|
||||
* using WebGL it is recommended to use an atlas manager to avoid texture switching. If an atlas manager is given, the
|
||||
* symbol is added to an atlas. By default no atlas manager is used.
|
||||
*/
|
||||
@@ -31,7 +31,7 @@ import ImageStyle from '../style/Image.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} RenderOptions
|
||||
* @property {module:ol/colorlike~ColorLike} [strokeStyle]
|
||||
* @property {import("../colorlike.js").ColorLike} [strokeStyle]
|
||||
* @property {number} strokeWidth
|
||||
* @property {number} size
|
||||
* @property {string} lineCap
|
||||
@@ -51,7 +51,7 @@ import ImageStyle from '../style/Image.js';
|
||||
*/
|
||||
class RegularShape extends ImageStyle {
|
||||
/**
|
||||
* @param {module:ol/style/RegularShape~Options} options Options.
|
||||
* @param {Options} options Options.
|
||||
*/
|
||||
constructor(options) {
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ class RegularShape extends ImageStyle {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Fill}
|
||||
* @type {import("./Fill.js").default}
|
||||
*/
|
||||
this.fill_ = options.fill !== undefined ? options.fill : null;
|
||||
|
||||
@@ -124,7 +124,7 @@ class RegularShape extends ImageStyle {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Stroke}
|
||||
* @type {import("./Stroke.js").default}
|
||||
*/
|
||||
this.stroke_ = options.stroke !== undefined ? options.stroke : null;
|
||||
|
||||
@@ -136,25 +136,25 @@ class RegularShape extends ImageStyle {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/size~Size}
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
this.size_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/size~Size}
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
this.imageSize_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/size~Size}
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
this.hitDetectionImageSize_ = null;
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {module:ol/style/AtlasManager|undefined}
|
||||
* @type {import("./AtlasManager.js").default|undefined}
|
||||
*/
|
||||
this.atlasManager_ = options.atlasManager;
|
||||
|
||||
@@ -164,7 +164,7 @@ class RegularShape extends ImageStyle {
|
||||
|
||||
/**
|
||||
* Clones the style. If an atlasmanager was provided to the original style it will be used in the cloned style, too.
|
||||
* @return {module:ol/style/RegularShape} The cloned style.
|
||||
* @return {import("./RegularShape.js").default} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -203,7 +203,7 @@ class RegularShape extends ImageStyle {
|
||||
|
||||
/**
|
||||
* Get the fill style for the shape.
|
||||
* @return {module:ol/style/Fill} Fill style.
|
||||
* @return {import("./Fill.js").default} Fill style.
|
||||
* @api
|
||||
*/
|
||||
getFill() {
|
||||
@@ -291,7 +291,7 @@ class RegularShape extends ImageStyle {
|
||||
|
||||
/**
|
||||
* Get the stroke style for the shape.
|
||||
* @return {module:ol/style/Stroke} Stroke style.
|
||||
* @return {import("./Stroke.js").default} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
getStroke() {
|
||||
@@ -315,7 +315,7 @@ class RegularShape extends ImageStyle {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @param {module:ol/style/AtlasManager|undefined} atlasManager An atlas manager.
|
||||
* @param {import("./AtlasManager.js").default|undefined} atlasManager An atlas manager.
|
||||
*/
|
||||
render_(atlasManager) {
|
||||
let imageSize;
|
||||
@@ -359,7 +359,7 @@ class RegularShape extends ImageStyle {
|
||||
|
||||
let size = 2 * (this.radius_ + strokeWidth) + 1;
|
||||
|
||||
/** @type {module:ol/style/RegularShape~RenderOptions} */
|
||||
/** @type {RenderOptions} */
|
||||
const renderOptions = {
|
||||
strokeStyle: strokeStyle,
|
||||
strokeWidth: strokeWidth,
|
||||
@@ -421,7 +421,7 @@ class RegularShape extends ImageStyle {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {module:ol/style/RegularShape~RenderOptions} renderOptions Render options.
|
||||
* @param {RenderOptions} renderOptions Render options.
|
||||
* @param {CanvasRenderingContext2D} context The rendering context.
|
||||
* @param {number} x The origin for the symbol (x).
|
||||
* @param {number} y The origin for the symbol (y).
|
||||
@@ -481,7 +481,7 @@ class RegularShape extends ImageStyle {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {module:ol/style/RegularShape~RenderOptions} renderOptions Render options.
|
||||
* @param {RenderOptions} renderOptions Render options.
|
||||
*/
|
||||
createHitDetectionCanvas_(renderOptions) {
|
||||
this.hitDetectionImageSize_ = [renderOptions.size, renderOptions.size];
|
||||
@@ -500,7 +500,7 @@ class RegularShape extends ImageStyle {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {module:ol/style/RegularShape~RenderOptions} renderOptions Render options.
|
||||
* @param {RenderOptions} renderOptions Render options.
|
||||
* @param {CanvasRenderingContext2D} context The context.
|
||||
* @param {number} x The origin for the symbol (x).
|
||||
* @param {number} y The origin for the symbol (y).
|
||||
|
||||
@@ -6,7 +6,7 @@ import {getUid} from '../util.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {module:ol/color~Color|module:ol/colorlike~ColorLike} [color] A color, gradient or pattern.
|
||||
* @property {import("../color.js").Color|import("../colorlike.js").ColorLike} [color] A color, gradient or pattern.
|
||||
* See {@link module:ol/color~Color} and {@link module:ol/colorlike~ColorLike} for possible formats.
|
||||
* Default null; if null, the Canvas/renderer default black will be used.
|
||||
* @property {string} [lineCap='round'] Line cap style: `butt`, `round`, or `square`.
|
||||
@@ -30,7 +30,7 @@ import {getUid} from '../util.js';
|
||||
*/
|
||||
class Stroke {
|
||||
/**
|
||||
* @param {module:ol/style/Stroke~Options=} opt_options Options.
|
||||
* @param {Options=} opt_options Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
@@ -38,7 +38,7 @@ class Stroke {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/color~Color|module:ol/colorlike~ColorLike}
|
||||
* @type {import("../color.js").Color|import("../colorlike.js").ColorLike}
|
||||
*/
|
||||
this.color_ = options.color !== undefined ? options.color : null;
|
||||
|
||||
@@ -87,7 +87,7 @@ class Stroke {
|
||||
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {module:ol/style/Stroke} The cloned style.
|
||||
* @return {import("./Stroke.js").default} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -105,7 +105,7 @@ class Stroke {
|
||||
|
||||
/**
|
||||
* Get the stroke color.
|
||||
* @return {module:ol/color~Color|module:ol/colorlike~ColorLike} Color.
|
||||
* @return {import("../color.js").Color|import("../colorlike.js").ColorLike} Color.
|
||||
* @api
|
||||
*/
|
||||
getColor() {
|
||||
@@ -169,7 +169,7 @@ class Stroke {
|
||||
/**
|
||||
* Set the color.
|
||||
*
|
||||
* @param {module:ol/color~Color|module:ol/colorlike~ColorLike} color Color.
|
||||
* @param {import("../color.js").Color|import("../colorlike.js").ColorLike} color Color.
|
||||
* @api
|
||||
*/
|
||||
setColor(color) {
|
||||
|
||||
+48
-48
@@ -99,8 +99,8 @@ import Stroke from '../style/Stroke.js';
|
||||
* {@link module:ol/style/Style} or an array of them. This way e.g. a
|
||||
* vector layer can be styled.
|
||||
*
|
||||
* @typedef {function((module:ol/Feature|module:ol/render/Feature), number):
|
||||
* (module:ol/style/Style|Array<module:ol/style/Style>)} StyleFunction
|
||||
* @typedef {function((import("../Feature.js").default|import("../render/Feature.js").default), number):
|
||||
* (import("./Style.js").default|Array<import("./Style.js").default>)} StyleFunction
|
||||
*/
|
||||
|
||||
|
||||
@@ -108,8 +108,8 @@ import Stroke from '../style/Stroke.js';
|
||||
* A function that takes an {@link module:ol/Feature} as argument and returns an
|
||||
* {@link module:ol/geom/Geometry} that will be rendered and styled for the feature.
|
||||
*
|
||||
* @typedef {function((module:ol/Feature|module:ol/render/Feature)):
|
||||
* (module:ol/geom/Geometry|module:ol/render/Feature|undefined)} GeometryFunction
|
||||
* @typedef {function((import("../Feature.js").default|import("../render/Feature.js").default)):
|
||||
* (import("../geom/Geometry.js").default|import("../render/Feature.js").default|undefined)} GeometryFunction
|
||||
*/
|
||||
|
||||
|
||||
@@ -119,21 +119,21 @@ import Stroke from '../style/Stroke.js';
|
||||
* 1. The pixel coordinates of the geometry in GeoJSON notation.
|
||||
* 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>>),module:ol/render~State)}
|
||||
* @typedef {function((import("../coordinate.js").Coordinate|Array<import("../coordinate.js").Coordinate>|Array<Array<import("../coordinate.js").Coordinate>>),import("../render.js").State)}
|
||||
* RenderFunction
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string|module:ol/geom/Geometry|module:ol/style/Style~GeometryFunction} [geometry] Feature property or geometry
|
||||
* @property {string|import("../geom/Geometry.js").default|GeometryFunction} [geometry] Feature property or geometry
|
||||
* or function returning a geometry to render for this style.
|
||||
* @property {module:ol/style/Fill} [fill] Fill style.
|
||||
* @property {module:ol/style/Image} [image] Image style.
|
||||
* @property {module:ol/style/Style~RenderFunction} [renderer] Custom renderer. When configured, `fill`, `stroke` and `image` will be
|
||||
* @property {import("./Fill.js").default} [fill] Fill style.
|
||||
* @property {import("./Image.js").default} [image] Image style.
|
||||
* @property {RenderFunction} [renderer] Custom renderer. When configured, `fill`, `stroke` and `image` will be
|
||||
* ignored, and the provided function will be called with each render frame for each geometry.
|
||||
* @property {module:ol/style/Stroke} [stroke] Stroke style.
|
||||
* @property {module:ol/style/Text} [text] Text style.
|
||||
* @property {import("./Stroke.js").default} [stroke] Stroke style.
|
||||
* @property {import("./Text.js").default} [text] Text style.
|
||||
* @property {number} [zIndex] Z index.
|
||||
*/
|
||||
|
||||
@@ -147,7 +147,7 @@ import Stroke from '../style/Stroke.js';
|
||||
*/
|
||||
class Style {
|
||||
/**
|
||||
* @param {module:ol/style/Style~Options=} opt_options Style options.
|
||||
* @param {Options=} opt_options Style options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
@@ -155,13 +155,13 @@ class Style {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {string|module:ol/geom/Geometry|module:ol/style/Style~GeometryFunction}
|
||||
* @type {string|import("../geom/Geometry.js").default|GeometryFunction}
|
||||
*/
|
||||
this.geometry_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!module:ol/style/Style~GeometryFunction}
|
||||
* @type {!GeometryFunction}
|
||||
*/
|
||||
this.geometryFunction_ = defaultGeometryFunction;
|
||||
|
||||
@@ -171,31 +171,31 @@ class Style {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Fill}
|
||||
* @type {import("./Fill.js").default}
|
||||
*/
|
||||
this.fill_ = options.fill !== undefined ? options.fill : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Image}
|
||||
* @type {import("./Image.js").default}
|
||||
*/
|
||||
this.image_ = options.image !== undefined ? options.image : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Style~RenderFunction|null}
|
||||
* @type {RenderFunction|null}
|
||||
*/
|
||||
this.renderer_ = options.renderer !== undefined ? options.renderer : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Stroke}
|
||||
* @type {import("./Stroke.js").default}
|
||||
*/
|
||||
this.stroke_ = options.stroke !== undefined ? options.stroke : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Text}
|
||||
* @type {import("./Text.js").default}
|
||||
*/
|
||||
this.text_ = options.text !== undefined ? options.text : null;
|
||||
|
||||
@@ -209,7 +209,7 @@ class Style {
|
||||
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {module:ol/style/Style} The cloned style.
|
||||
* @return {import("./Style.js").default} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -230,7 +230,7 @@ class Style {
|
||||
/**
|
||||
* Get the custom renderer function that was configured with
|
||||
* {@link #setRenderer} or the `renderer` constructor option.
|
||||
* @return {module:ol/style/Style~RenderFunction|null} Custom renderer function.
|
||||
* @return {RenderFunction|null} Custom renderer function.
|
||||
* @api
|
||||
*/
|
||||
getRenderer() {
|
||||
@@ -240,7 +240,7 @@ class Style {
|
||||
/**
|
||||
* Sets a custom renderer function for this style. When set, `fill`, `stroke`
|
||||
* and `image` options of the style will be ignored.
|
||||
* @param {module:ol/style/Style~RenderFunction|null} renderer Custom renderer function.
|
||||
* @param {RenderFunction|null} renderer Custom renderer function.
|
||||
* @api
|
||||
*/
|
||||
setRenderer(renderer) {
|
||||
@@ -249,7 +249,7 @@ class Style {
|
||||
|
||||
/**
|
||||
* Get the geometry to be rendered.
|
||||
* @return {string|module:ol/geom/Geometry|module:ol/style/Style~GeometryFunction}
|
||||
* @return {string|import("../geom/Geometry.js").default|GeometryFunction}
|
||||
* Feature property or geometry or function that returns the geometry that will
|
||||
* be rendered with this style.
|
||||
* @api
|
||||
@@ -260,7 +260,7 @@ class Style {
|
||||
|
||||
/**
|
||||
* Get the function used to generate a geometry for rendering.
|
||||
* @return {!module:ol/style/Style~GeometryFunction} Function that is called with a feature
|
||||
* @return {!GeometryFunction} Function that is called with a feature
|
||||
* and returns the geometry to render instead of the feature's geometry.
|
||||
* @api
|
||||
*/
|
||||
@@ -270,7 +270,7 @@ class Style {
|
||||
|
||||
/**
|
||||
* Get the fill style.
|
||||
* @return {module:ol/style/Fill} Fill style.
|
||||
* @return {import("./Fill.js").default} Fill style.
|
||||
* @api
|
||||
*/
|
||||
getFill() {
|
||||
@@ -279,7 +279,7 @@ class Style {
|
||||
|
||||
/**
|
||||
* Set the fill style.
|
||||
* @param {module:ol/style/Fill} fill Fill style.
|
||||
* @param {import("./Fill.js").default} fill Fill style.
|
||||
* @api
|
||||
*/
|
||||
setFill(fill) {
|
||||
@@ -288,7 +288,7 @@ class Style {
|
||||
|
||||
/**
|
||||
* Get the image style.
|
||||
* @return {module:ol/style/Image} Image style.
|
||||
* @return {import("./Image.js").default} Image style.
|
||||
* @api
|
||||
*/
|
||||
getImage() {
|
||||
@@ -297,7 +297,7 @@ class Style {
|
||||
|
||||
/**
|
||||
* Set the image style.
|
||||
* @param {module:ol/style/Image} image Image style.
|
||||
* @param {import("./Image.js").default} image Image style.
|
||||
* @api
|
||||
*/
|
||||
setImage(image) {
|
||||
@@ -306,7 +306,7 @@ class Style {
|
||||
|
||||
/**
|
||||
* Get the stroke style.
|
||||
* @return {module:ol/style/Stroke} Stroke style.
|
||||
* @return {import("./Stroke.js").default} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
getStroke() {
|
||||
@@ -315,7 +315,7 @@ class Style {
|
||||
|
||||
/**
|
||||
* Set the stroke style.
|
||||
* @param {module:ol/style/Stroke} stroke Stroke style.
|
||||
* @param {import("./Stroke.js").default} stroke Stroke style.
|
||||
* @api
|
||||
*/
|
||||
setStroke(stroke) {
|
||||
@@ -324,7 +324,7 @@ class Style {
|
||||
|
||||
/**
|
||||
* Get the text style.
|
||||
* @return {module:ol/style/Text} Text style.
|
||||
* @return {import("./Text.js").default} Text style.
|
||||
* @api
|
||||
*/
|
||||
getText() {
|
||||
@@ -333,7 +333,7 @@ class Style {
|
||||
|
||||
/**
|
||||
* Set the text style.
|
||||
* @param {module:ol/style/Text} text Text style.
|
||||
* @param {import("./Text.js").default} text Text style.
|
||||
* @api
|
||||
*/
|
||||
setText(text) {
|
||||
@@ -352,7 +352,7 @@ class Style {
|
||||
/**
|
||||
* Set a geometry that is rendered instead of the feature's geometry.
|
||||
*
|
||||
* @param {string|module:ol/geom/Geometry|module:ol/style/Style~GeometryFunction} geometry
|
||||
* @param {string|import("../geom/Geometry.js").default|GeometryFunction} geometry
|
||||
* Feature property or geometry or function returning a geometry to render
|
||||
* for this style.
|
||||
* @api
|
||||
@@ -363,7 +363,7 @@ class Style {
|
||||
} else if (typeof geometry === 'string') {
|
||||
this.geometryFunction_ = function(feature) {
|
||||
return (
|
||||
/** @type {module:ol/geom/Geometry} */ (feature.get(geometry))
|
||||
/** @type {import("../geom/Geometry.js").default} */ (feature.get(geometry))
|
||||
);
|
||||
};
|
||||
} else if (!geometry) {
|
||||
@@ -371,7 +371,7 @@ class Style {
|
||||
} else if (geometry !== undefined) {
|
||||
this.geometryFunction_ = function() {
|
||||
return (
|
||||
/** @type {module:ol/geom/Geometry} */ (geometry)
|
||||
/** @type {import("../geom/Geometry.js").default} */ (geometry)
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -392,11 +392,11 @@ class Style {
|
||||
|
||||
/**
|
||||
* Convert the provided object into a style function. Functions passed through
|
||||
* unchanged. Arrays of module:ol/style/Style or single style objects wrapped in a
|
||||
* unchanged. Arrays of import("./Style.js").default or single style objects wrapped in a
|
||||
* new style function.
|
||||
* @param {module:ol/style/Style~StyleFunction|Array<module:ol/style/Style>|module:ol/style/Style} obj
|
||||
* @param {StyleFunction|Array<import("./Style.js").default>|import("./Style.js").default} obj
|
||||
* A style function, a single style, or an array of styles.
|
||||
* @return {module:ol/style/Style~StyleFunction} A style function.
|
||||
* @return {StyleFunction} A style function.
|
||||
*/
|
||||
export function toFunction(obj) {
|
||||
let styleFunction;
|
||||
@@ -405,14 +405,14 @@ export function toFunction(obj) {
|
||||
styleFunction = obj;
|
||||
} else {
|
||||
/**
|
||||
* @type {Array<module:ol/style/Style>}
|
||||
* @type {Array<import("./Style.js").default>}
|
||||
*/
|
||||
let styles;
|
||||
if (Array.isArray(obj)) {
|
||||
styles = obj;
|
||||
} else {
|
||||
assert(obj instanceof Style,
|
||||
41); // Expected an `module:ol/style/Style~Style` or an array of `module:ol/style/Style~Style`
|
||||
41); // Expected an `Style` or an array of `Style`
|
||||
styles = [obj];
|
||||
}
|
||||
styleFunction = function() {
|
||||
@@ -424,20 +424,20 @@ export function toFunction(obj) {
|
||||
|
||||
|
||||
/**
|
||||
* @type {Array<module:ol/style/Style>}
|
||||
* @type {Array<import("./Style.js").default>}
|
||||
*/
|
||||
let defaultStyles = null;
|
||||
|
||||
|
||||
/**
|
||||
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature.
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature.
|
||||
* @param {number} resolution Resolution.
|
||||
* @return {Array<module:ol/style/Style>} Style.
|
||||
* @return {Array<import("./Style.js").default>} Style.
|
||||
*/
|
||||
export function createDefaultStyle(feature, resolution) {
|
||||
// We don't use an immediately-invoked function
|
||||
// and a closure so we don't get an error at script evaluation time in
|
||||
// browsers that do not support Canvas. (module:ol/style/Circle~CircleStyle does
|
||||
// browsers that do not support Canvas. (import("./Circle.js").CircleStyle does
|
||||
// canvas.getContext('2d') at construction time, which will cause an.error
|
||||
// in such browsers.)
|
||||
if (!defaultStyles) {
|
||||
@@ -466,10 +466,10 @@ export function createDefaultStyle(feature, resolution) {
|
||||
|
||||
/**
|
||||
* Default styles for editing features.
|
||||
* @return {Object<module:ol/geom/GeometryType, Array<module:ol/style/Style>>} Styles
|
||||
* @return {Object<import("../geom/GeometryType.js").default, Array<import("./Style.js").default>>} Styles
|
||||
*/
|
||||
export function createEditingStyle() {
|
||||
/** @type {Object<module:ol/geom/GeometryType, Array<module:ol/style/Style>>} */
|
||||
/** @type {Object<import("../geom/GeometryType.js").default, Array<import("./Style.js").default>>} */
|
||||
const styles = {};
|
||||
const white = [255, 255, 255, 1];
|
||||
const blue = [0, 153, 255, 1];
|
||||
@@ -537,8 +537,8 @@ export function createEditingStyle() {
|
||||
|
||||
/**
|
||||
* Function that is called with a feature and returns its default geometry.
|
||||
* @param {module:ol/Feature|module:ol/render/Feature} feature Feature to get the geometry for.
|
||||
* @return {module:ol/geom/Geometry|module:ol/render/Feature|undefined} Geometry to render.
|
||||
* @param {import("../Feature.js").default|import("../render/Feature.js").default} feature Feature to get the geometry for.
|
||||
* @return {import("../geom/Geometry.js").default|import("../render/Feature.js").default|undefined} Geometry to render.
|
||||
*/
|
||||
function defaultGeometryFunction(feature) {
|
||||
return feature.getGeometry();
|
||||
|
||||
+22
-22
@@ -24,7 +24,7 @@ const DEFAULT_FILL_COLOR = '#333';
|
||||
* @property {number} [offsetY=0] Vertical text offset in pixels. A positive will shift the text down.
|
||||
* @property {boolean} [overflow=false] For polygon labels or when `placement` is set to `'line'`, allow text to exceed
|
||||
* the width of the polygon at the label position or the length of the path that it follows.
|
||||
* @property {module:ol/style/TextPlacement|string} [placement] Text placement.
|
||||
* @property {import("./TextPlacement.js").default|string} [placement] Text placement.
|
||||
* @property {number} [scale] Scale.
|
||||
* @property {boolean} [rotateWithView=false] Whether to rotate the text with the view.
|
||||
* @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).
|
||||
@@ -34,11 +34,11 @@ const DEFAULT_FILL_COLOR = '#333';
|
||||
* placement where `maxAngle` is not exceeded.
|
||||
* @property {string} [textBaseline='middle'] Text base line. Possible values: 'bottom', 'top', 'middle', 'alphabetic',
|
||||
* 'hanging', 'ideographic'.
|
||||
* @property {module:ol/style/Fill} [fill] Fill style. If none is provided, we'll use a dark fill-style (#333).
|
||||
* @property {module:ol/style/Stroke} [stroke] Stroke style.
|
||||
* @property {module:ol/style/Fill} [backgroundFill] Fill style for the text background when `placement` is
|
||||
* @property {import("./Fill.js").default} [fill] Fill style. If none is provided, we'll use a dark fill-style (#333).
|
||||
* @property {import("./Stroke.js").default} [stroke] Stroke style.
|
||||
* @property {import("./Fill.js").default} [backgroundFill] Fill style for the text background when `placement` is
|
||||
* `'point'`. Default is no fill.
|
||||
* @property {module:ol/style/Stroke} [backgroundStroke] Stroke style for the text background when `placement`
|
||||
* @property {import("./Stroke.js").default} [backgroundStroke] Stroke style for the text background when `placement`
|
||||
* is `'point'`. Default is no stroke.
|
||||
* @property {Array<number>} [padding=[0, 0, 0, 0]] Padding in pixels around the text for decluttering and background. The order of
|
||||
* values in the array is `[top, right, bottom, left]`.
|
||||
@@ -52,7 +52,7 @@ const DEFAULT_FILL_COLOR = '#333';
|
||||
*/
|
||||
class Text {
|
||||
/**
|
||||
* @param {module:ol/style/Text~Options=} opt_options Options.
|
||||
* @param {Options=} opt_options Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
|
||||
@@ -102,7 +102,7 @@ class Text {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Fill}
|
||||
* @type {import("./Fill.js").default}
|
||||
*/
|
||||
this.fill_ = options.fill !== undefined ? options.fill :
|
||||
new Fill({color: DEFAULT_FILL_COLOR});
|
||||
@@ -115,7 +115,7 @@ class Text {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/TextPlacement|string}
|
||||
* @type {import("./TextPlacement.js").default|string}
|
||||
*/
|
||||
this.placement_ = options.placement !== undefined ? options.placement : TextPlacement.POINT;
|
||||
|
||||
@@ -127,7 +127,7 @@ class Text {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Stroke}
|
||||
* @type {import("./Stroke.js").default}
|
||||
*/
|
||||
this.stroke_ = options.stroke !== undefined ? options.stroke : null;
|
||||
|
||||
@@ -145,13 +145,13 @@ class Text {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Fill}
|
||||
* @type {import("./Fill.js").default}
|
||||
*/
|
||||
this.backgroundFill_ = options.backgroundFill ? options.backgroundFill : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {module:ol/style/Stroke}
|
||||
* @type {import("./Stroke.js").default}
|
||||
*/
|
||||
this.backgroundStroke_ = options.backgroundStroke ? options.backgroundStroke : null;
|
||||
|
||||
@@ -164,7 +164,7 @@ class Text {
|
||||
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {module:ol/style/Text} The cloned style.
|
||||
* @return {import("./Text.js").default} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
clone() {
|
||||
@@ -217,7 +217,7 @@ class Text {
|
||||
|
||||
/**
|
||||
* Get the label placement.
|
||||
* @return {module:ol/style/TextPlacement|string} Text placement.
|
||||
* @return {import("./TextPlacement.js").default|string} Text placement.
|
||||
* @api
|
||||
*/
|
||||
getPlacement() {
|
||||
@@ -244,7 +244,7 @@ class Text {
|
||||
|
||||
/**
|
||||
* Get the fill style for the text.
|
||||
* @return {module:ol/style/Fill} Fill style.
|
||||
* @return {import("./Fill.js").default} Fill style.
|
||||
* @api
|
||||
*/
|
||||
getFill() {
|
||||
@@ -280,7 +280,7 @@ class Text {
|
||||
|
||||
/**
|
||||
* Get the stroke style for the text.
|
||||
* @return {module:ol/style/Stroke} Stroke style.
|
||||
* @return {import("./Stroke.js").default} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
getStroke() {
|
||||
@@ -316,7 +316,7 @@ class Text {
|
||||
|
||||
/**
|
||||
* Get the background fill style for the text.
|
||||
* @return {module:ol/style/Fill} Fill style.
|
||||
* @return {import("./Fill.js").default} Fill style.
|
||||
* @api
|
||||
*/
|
||||
getBackgroundFill() {
|
||||
@@ -325,7 +325,7 @@ class Text {
|
||||
|
||||
/**
|
||||
* Get the background stroke style for the text.
|
||||
* @return {module:ol/style/Stroke} Stroke style.
|
||||
* @return {import("./Stroke.js").default} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
getBackgroundStroke() {
|
||||
@@ -394,7 +394,7 @@ class Text {
|
||||
/**
|
||||
* Set the text placement.
|
||||
*
|
||||
* @param {module:ol/style/TextPlacement|string} placement Placement.
|
||||
* @param {import("./TextPlacement.js").default|string} placement Placement.
|
||||
* @api
|
||||
*/
|
||||
setPlacement(placement) {
|
||||
@@ -404,7 +404,7 @@ class Text {
|
||||
/**
|
||||
* Set the fill.
|
||||
*
|
||||
* @param {module:ol/style/Fill} fill Fill style.
|
||||
* @param {import("./Fill.js").default} fill Fill style.
|
||||
* @api
|
||||
*/
|
||||
setFill(fill) {
|
||||
@@ -434,7 +434,7 @@ class Text {
|
||||
/**
|
||||
* Set the stroke.
|
||||
*
|
||||
* @param {module:ol/style/Stroke} stroke Stroke style.
|
||||
* @param {import("./Stroke.js").default} stroke Stroke style.
|
||||
* @api
|
||||
*/
|
||||
setStroke(stroke) {
|
||||
@@ -474,7 +474,7 @@ class Text {
|
||||
/**
|
||||
* Set the background fill.
|
||||
*
|
||||
* @param {module:ol/style/Fill} fill Fill style.
|
||||
* @param {import("./Fill.js").default} fill Fill style.
|
||||
* @api
|
||||
*/
|
||||
setBackgroundFill(fill) {
|
||||
@@ -484,7 +484,7 @@ class Text {
|
||||
/**
|
||||
* Set the background stroke.
|
||||
*
|
||||
* @param {module:ol/style/Stroke} stroke Stroke style.
|
||||
* @param {import("./Stroke.js").default} stroke Stroke style.
|
||||
* @api
|
||||
*/
|
||||
setBackgroundStroke(stroke) {
|
||||
|
||||
Reference in New Issue
Block a user