This commit is contained in:
78
node_modules/ol/style/Circle.d.ts
generated
vendored
Normal file
78
node_modules/ol/style/Circle.d.ts
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
export default CircleStyle;
|
||||
export type Options = {
|
||||
/**
|
||||
* Fill style.
|
||||
*/
|
||||
fill?: import("./Fill.js").default | undefined;
|
||||
/**
|
||||
* Circle radius.
|
||||
*/
|
||||
radius: number;
|
||||
/**
|
||||
* Stroke style.
|
||||
*/
|
||||
stroke?: import("./Stroke.js").default | undefined;
|
||||
/**
|
||||
* displacement
|
||||
*/
|
||||
displacement?: number[] | undefined;
|
||||
/**
|
||||
* Scale. A two dimensional scale will produce an ellipse.
|
||||
* Unless two dimensional scaling is required a better result may be obtained with an appropriate setting for `radius`.
|
||||
*/
|
||||
scale?: number | import("../size.js").Size | undefined;
|
||||
/**
|
||||
* Rotation in radians
|
||||
* (positive rotation clockwise, meaningful only when used in conjunction with a two dimensional scale).
|
||||
*/
|
||||
rotation?: number | undefined;
|
||||
/**
|
||||
* Whether to rotate the shape with the view
|
||||
* (meaningful only when used in conjunction with a two dimensional scale).
|
||||
*/
|
||||
rotateWithView?: boolean | undefined;
|
||||
/**
|
||||
* Declutter mode
|
||||
*/
|
||||
declutterMode?: "declutter" | "obstacle" | "none" | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("./Fill.js").default} [fill] Fill style.
|
||||
* @property {number} radius Circle radius.
|
||||
* @property {import("./Stroke.js").default} [stroke] Stroke style.
|
||||
* @property {Array<number>} [displacement=[0,0]] displacement
|
||||
* @property {number|import("../size.js").Size} [scale=1] Scale. A two dimensional scale will produce an ellipse.
|
||||
* Unless two dimensional scaling is required a better result may be obtained with an appropriate setting for `radius`.
|
||||
* @property {number} [rotation=0] Rotation in radians
|
||||
* (positive rotation clockwise, meaningful only when used in conjunction with a two dimensional scale).
|
||||
* @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view
|
||||
* (meaningful only when used in conjunction with a two dimensional scale).
|
||||
* @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Set circle style for vector features.
|
||||
* @api
|
||||
*/
|
||||
declare class CircleStyle extends RegularShape {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {CircleStyle} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
clone(): CircleStyle;
|
||||
/**
|
||||
* Set the circle radius.
|
||||
*
|
||||
* @param {number} radius Circle radius.
|
||||
* @api
|
||||
*/
|
||||
setRadius(radius: number): void;
|
||||
}
|
||||
import RegularShape from "./RegularShape.js";
|
||||
//# sourceMappingURL=Circle.d.ts.map
|
||||
1
node_modules/ol/style/Circle.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/Circle.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Circle.d.ts","sourceRoot":"","sources":["../src/style/Circle.js"],"names":[],"mappings":";;;;;;;;;YASc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;oBASN,WAAW,GAAC,UAAU,GAAC,MAAM,GAAC,SAAS;;AAZrD;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,+CAgBC;IAED;;;;OAIG;IACH,SAHY,WAAW,CAiBtB;IAED;;;;;OAKG;IACH,kBAHW,MAAM,QAMhB;CACF"}
|
||||
91
node_modules/ol/style/Circle.js
generated
vendored
Normal file
91
node_modules/ol/style/Circle.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* @module ol/style/Circle
|
||||
*/
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
import RegularShape from './RegularShape.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("./Fill.js").default} [fill] Fill style.
|
||||
* @property {number} radius Circle radius.
|
||||
* @property {import("./Stroke.js").default} [stroke] Stroke style.
|
||||
* @property {Array<number>} [displacement=[0,0]] displacement
|
||||
* @property {number|import("../size.js").Size} [scale=1] Scale. A two dimensional scale will produce an ellipse.
|
||||
* Unless two dimensional scaling is required a better result may be obtained with an appropriate setting for `radius`.
|
||||
* @property {number} [rotation=0] Rotation in radians
|
||||
* (positive rotation clockwise, meaningful only when used in conjunction with a two dimensional scale).
|
||||
* @property {boolean} [rotateWithView=false] Whether to rotate the shape with the view
|
||||
* (meaningful only when used in conjunction with a two dimensional scale).
|
||||
* @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Set circle style for vector features.
|
||||
* @api
|
||||
*/
|
||||
var CircleStyle = /** @class */ (function (_super) {
|
||||
__extends(CircleStyle, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function CircleStyle(opt_options) {
|
||||
var options = opt_options ? opt_options : {};
|
||||
return _super.call(this, {
|
||||
points: Infinity,
|
||||
fill: options.fill,
|
||||
radius: options.radius,
|
||||
stroke: options.stroke,
|
||||
scale: options.scale !== undefined ? options.scale : 1,
|
||||
rotation: options.rotation !== undefined ? options.rotation : 0,
|
||||
rotateWithView: options.rotateWithView !== undefined ? options.rotateWithView : false,
|
||||
displacement: options.displacement !== undefined ? options.displacement : [0, 0],
|
||||
declutterMode: options.declutterMode,
|
||||
}) || this;
|
||||
}
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {CircleStyle} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
CircleStyle.prototype.clone = function () {
|
||||
var scale = this.getScale();
|
||||
var style = new CircleStyle({
|
||||
fill: this.getFill() ? this.getFill().clone() : undefined,
|
||||
stroke: this.getStroke() ? this.getStroke().clone() : undefined,
|
||||
radius: this.getRadius(),
|
||||
scale: Array.isArray(scale) ? scale.slice() : scale,
|
||||
rotation: this.getRotation(),
|
||||
rotateWithView: this.getRotateWithView(),
|
||||
displacement: this.getDisplacement().slice(),
|
||||
declutterMode: this.getDeclutterMode(),
|
||||
});
|
||||
style.setOpacity(this.getOpacity());
|
||||
return style;
|
||||
};
|
||||
/**
|
||||
* Set the circle radius.
|
||||
*
|
||||
* @param {number} radius Circle radius.
|
||||
* @api
|
||||
*/
|
||||
CircleStyle.prototype.setRadius = function (radius) {
|
||||
this.radius_ = radius;
|
||||
this.render();
|
||||
};
|
||||
return CircleStyle;
|
||||
}(RegularShape));
|
||||
export default CircleStyle;
|
||||
//# sourceMappingURL=Circle.js.map
|
||||
1
node_modules/ol/style/Circle.js.map
generated
vendored
Normal file
1
node_modules/ol/style/Circle.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Circle.js","sourceRoot":"","sources":["../src/style/Circle.js"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AACH;IAA0B,+BAAY;IACpC;;OAEG;IACH,qBAAY,WAAW;QACrB,IAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;eAE/C,kBAAM;YACJ,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,KAAK,EAAE,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACtD,QAAQ,EAAE,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC/D,cAAc,EACZ,OAAO,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK;YACvE,YAAY,EACV,OAAO,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACpE,aAAa,EAAE,OAAO,CAAC,aAAa;SACrC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,2BAAK,GAAL;QACE,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,IAAM,KAAK,GAAG,IAAI,WAAW,CAAC;YAC5B,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS;YACzD,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS;YAC/D,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE;YACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK;YACnD,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE;YAC5B,cAAc,EAAE,IAAI,CAAC,iBAAiB,EAAE;YACxC,YAAY,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE;YAC5C,aAAa,EAAE,IAAI,CAAC,gBAAgB,EAAE;SACvC,CAAC,CAAC;QACH,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QACpC,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACH,+BAAS,GAAT,UAAU,MAAM;QACd,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IACH,kBAAC;AAAD,CAAC,AArDD,CAA0B,YAAY,GAqDrC;AAED,eAAe,WAAW,CAAC"}
|
||||
54
node_modules/ol/style/Fill.d.ts
generated
vendored
Normal file
54
node_modules/ol/style/Fill.d.ts
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
export default Fill;
|
||||
export type Options = {
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
color?: import("../color.js").Color | import("../colorlike.js").ColorLike | null | undefined;
|
||||
};
|
||||
/**
|
||||
* @module ol/style/Fill
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../color.js").Color|import("../colorlike.js").ColorLike|null} [color=null] 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.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Set fill style for vector features.
|
||||
* @api
|
||||
*/
|
||||
declare class Fill {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../color.js").Color|import("../colorlike.js").ColorLike|null}
|
||||
*/
|
||||
private color_;
|
||||
/**
|
||||
* Clones the style. The color is not cloned if it is an {@link module:ol/colorlike~ColorLike}.
|
||||
* @return {Fill} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
clone(): Fill;
|
||||
/**
|
||||
* Get the fill color.
|
||||
* @return {import("../color.js").Color|import("../colorlike.js").ColorLike|null} Color.
|
||||
* @api
|
||||
*/
|
||||
getColor(): import("../color.js").Color | import("../colorlike.js").ColorLike | null;
|
||||
/**
|
||||
* Set the color.
|
||||
*
|
||||
* @param {import("../color.js").Color|import("../colorlike.js").ColorLike|null} color Color.
|
||||
* @api
|
||||
*/
|
||||
setColor(color: import("../color.js").Color | import("../colorlike.js").ColorLike | null): void;
|
||||
}
|
||||
//# sourceMappingURL=Fill.d.ts.map
|
||||
1
node_modules/ol/style/Fill.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/Fill.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Fill.d.ts","sourceRoot":"","sources":["../src/style/Fill.js"],"names":[],"mappings":";;;;;;;;;AAAA;;GAEG;AAEH;;;;;GAKG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,+CAQC;IALC;;;OAGG;IACH,eAAgE;IAGlE;;;;OAIG;IACH,SAHY,IAAI,CAQf;IAED;;;;OAIG;IACH,YAHY,OAAO,aAAa,EAAE,KAAK,GAAC,OAAO,iBAAiB,EAAE,SAAS,GAAC,IAAI,CAK/E;IAED;;;;;OAKG;IACH,gBAHW,OAAO,aAAa,EAAE,KAAK,GAAC,OAAO,iBAAiB,EAAE,SAAS,GAAC,IAAI,QAK9E;CACF"}
|
||||
58
node_modules/ol/style/Fill.js
generated
vendored
Normal file
58
node_modules/ol/style/Fill.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @module ol/style/Fill
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("../color.js").Color|import("../colorlike.js").ColorLike|null} [color=null] 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.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Set fill style for vector features.
|
||||
* @api
|
||||
*/
|
||||
var Fill = /** @class */ (function () {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function Fill(opt_options) {
|
||||
var options = opt_options || {};
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../color.js").Color|import("../colorlike.js").ColorLike|null}
|
||||
*/
|
||||
this.color_ = options.color !== undefined ? options.color : null;
|
||||
}
|
||||
/**
|
||||
* Clones the style. The color is not cloned if it is an {@link module:ol/colorlike~ColorLike}.
|
||||
* @return {Fill} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
Fill.prototype.clone = function () {
|
||||
var color = this.getColor();
|
||||
return new Fill({
|
||||
color: Array.isArray(color) ? color.slice() : color || undefined,
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Get the fill color.
|
||||
* @return {import("../color.js").Color|import("../colorlike.js").ColorLike|null} Color.
|
||||
* @api
|
||||
*/
|
||||
Fill.prototype.getColor = function () {
|
||||
return this.color_;
|
||||
};
|
||||
/**
|
||||
* Set the color.
|
||||
*
|
||||
* @param {import("../color.js").Color|import("../colorlike.js").ColorLike|null} color Color.
|
||||
* @api
|
||||
*/
|
||||
Fill.prototype.setColor = function (color) {
|
||||
this.color_ = color;
|
||||
};
|
||||
return Fill;
|
||||
}());
|
||||
export default Fill;
|
||||
//# sourceMappingURL=Fill.js.map
|
||||
1
node_modules/ol/style/Fill.js.map
generated
vendored
Normal file
1
node_modules/ol/style/Fill.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Fill.js","sourceRoot":"","sources":["../src/style/Fill.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,cAAY,WAAW;QACrB,IAAM,OAAO,GAAG,WAAW,IAAI,EAAE,CAAC;QAElC;;;WAGG;QACH,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACnE,CAAC;IAED;;;;OAIG;IACH,oBAAK,GAAL;QACE,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,IAAI,CAAC;YACd,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,SAAS;SACjE,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,uBAAQ,GAAR;QACE,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACH,uBAAQ,GAAR,UAAS,KAAK;QACZ,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IACH,WAAC;AAAD,CAAC,AA5CD,IA4CC;AAED,eAAe,IAAI,CAAC"}
|
||||
239
node_modules/ol/style/Icon.d.ts
generated
vendored
Normal file
239
node_modules/ol/style/Icon.d.ts
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
export default Icon;
|
||||
export type Options = {
|
||||
/**
|
||||
* Anchor. Default value is the icon center.
|
||||
*/
|
||||
anchor?: number[] | undefined;
|
||||
/**
|
||||
* Origin of the anchor: `bottom-left`, `bottom-right`,
|
||||
* `top-left` or `top-right`.
|
||||
*/
|
||||
anchorOrigin?: any;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
anchorXUnits?: any;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
anchorYUnits?: any;
|
||||
/**
|
||||
* Color to tint the icon. If not specified,
|
||||
* the icon will be left as is.
|
||||
*/
|
||||
color?: string | import("../color.js").Color | undefined;
|
||||
/**
|
||||
* The `crossOrigin` attribute for loaded images. Note that you must provide a
|
||||
* `crossOrigin` value if you want to access pixel data with the Canvas renderer.
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
|
||||
*/
|
||||
crossOrigin?: string | null | undefined;
|
||||
/**
|
||||
* Image object for the icon. If the `src` option is not provided then the
|
||||
* provided image must already be loaded. And in that case, it is required
|
||||
* to provide the size of the image, with the `imgSize` option.
|
||||
*/
|
||||
img?: HTMLCanvasElement | HTMLImageElement | undefined;
|
||||
/**
|
||||
* Offset, which, together with the size and the offset origin, define the
|
||||
* sub-rectangle to use from the original icon image.
|
||||
*/
|
||||
offset?: number[] | undefined;
|
||||
/**
|
||||
* Displacement of the icon.
|
||||
*/
|
||||
displacement?: number[] | undefined;
|
||||
/**
|
||||
* Origin of the offset: `bottom-left`, `bottom-right`,
|
||||
* `top-left` or `top-right`.
|
||||
*/
|
||||
offsetOrigin?: any;
|
||||
/**
|
||||
* Opacity of the icon.
|
||||
*/
|
||||
opacity?: number | undefined;
|
||||
/**
|
||||
* Scale.
|
||||
*/
|
||||
scale?: number | import("../size.js").Size | undefined;
|
||||
/**
|
||||
* Whether to rotate the icon with the view.
|
||||
*/
|
||||
rotateWithView?: boolean | undefined;
|
||||
/**
|
||||
* Rotation in radians (positive rotation clockwise).
|
||||
*/
|
||||
rotation?: number | undefined;
|
||||
/**
|
||||
* Icon size in pixel. Can be used together with `offset` to define the
|
||||
* sub-rectangle to use from the origin (sprite) icon image.
|
||||
*/
|
||||
size?: import("../size.js").Size | undefined;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
imgSize?: import("../size.js").Size | undefined;
|
||||
/**
|
||||
* Image source URI.
|
||||
*/
|
||||
src?: string | undefined;
|
||||
/**
|
||||
* Declutter mode
|
||||
*/
|
||||
declutterMode?: "declutter" | "obstacle" | "none" | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {Array<number>} [anchor=[0.5, 0.5]] Anchor. Default value is the icon center.
|
||||
* @property {import("./IconOrigin.js").default} [anchorOrigin='top-left'] Origin of the anchor: `bottom-left`, `bottom-right`,
|
||||
* `top-left` or `top-right`.
|
||||
* @property {import("./IconAnchorUnits.js").default} [anchorXUnits='fraction'] 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.
|
||||
* @property {import("./IconAnchorUnits.js").default} [anchorYUnits='fraction'] 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.
|
||||
* @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 want to access pixel data with the Canvas renderer.
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
|
||||
* @property {HTMLImageElement|HTMLCanvasElement} [img] Image object for the icon. If the `src` option is not provided then the
|
||||
* provided image must already be loaded. And in that case, it is required
|
||||
* 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 {Array<number>} [displacement=[0,0]] Displacement of the icon.
|
||||
* @property {import("./IconOrigin.js").default} [offsetOrigin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,
|
||||
* `top-left` or `top-right`.
|
||||
* @property {number} [opacity=1] Opacity of the icon.
|
||||
* @property {number|import("../size.js").Size} [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 {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 {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.
|
||||
* @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Set icon style for vector features.
|
||||
* @api
|
||||
*/
|
||||
declare class Icon extends ImageStyle {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
private anchor_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
private normalizedAnchor_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./IconOrigin.js").default}
|
||||
*/
|
||||
private anchorOrigin_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./IconAnchorUnits.js").default}
|
||||
*/
|
||||
private anchorXUnits_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./IconAnchorUnits.js").default}
|
||||
*/
|
||||
private anchorYUnits_;
|
||||
/**
|
||||
* @private
|
||||
* @type {?string}
|
||||
*/
|
||||
private crossOrigin_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../size.js").Size|undefined}
|
||||
*/
|
||||
private imgSize_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../color.js").Color}
|
||||
*/
|
||||
private color_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./IconImage.js").default}
|
||||
*/
|
||||
private iconImage_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
private offset_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./IconOrigin.js").default}
|
||||
*/
|
||||
private offsetOrigin_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
private origin_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
private size_;
|
||||
/**
|
||||
* Clones the style. The underlying Image/HTMLCanvasElement is not cloned.
|
||||
* @return {Icon} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
clone(): Icon;
|
||||
/**
|
||||
* Set the anchor point. The anchor determines the center point for the
|
||||
* symbolizer.
|
||||
*
|
||||
* @param {Array<number>} anchor Anchor.
|
||||
* @api
|
||||
*/
|
||||
setAnchor(anchor: Array<number>): void;
|
||||
/**
|
||||
* Get the icon color.
|
||||
* @return {import("../color.js").Color} Color.
|
||||
* @api
|
||||
*/
|
||||
getColor(): import("../color.js").Color;
|
||||
/**
|
||||
* Get the image icon.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
|
||||
* @api
|
||||
*/
|
||||
getImage(pixelRatio: number): HTMLImageElement | HTMLCanvasElement;
|
||||
/**
|
||||
* @return {HTMLImageElement|HTMLCanvasElement} Image element.
|
||||
*/
|
||||
getHitDetectionImage(): HTMLImageElement | HTMLCanvasElement;
|
||||
/**
|
||||
* Get the image URL.
|
||||
* @return {string|undefined} Image src.
|
||||
* @api
|
||||
*/
|
||||
getSrc(): string | undefined;
|
||||
}
|
||||
import ImageStyle from "./Image.js";
|
||||
//# sourceMappingURL=Icon.d.ts.map
|
||||
1
node_modules/ol/style/Icon.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/Icon.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../src/style/Icon.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA8Cc,WAAW,GAAC,UAAU,GAAC,MAAM,GAAC,SAAS;;AAjCrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,+CA0JC;IAxHC;;;OAGG;IACH,gBAAyE;IAEzE;;;OAGG;IACH,0BAA6B;IAE7B;;;OAGG;IACH,sBAGyB;IAEzB;;;OAGG;IACH,sBAG8B;IAE9B;;;OAGG;IACH,sBAG8B;IAE9B;;;OAGG;IACH,qBACgE;IAOhE;;;OAGG;IACH,iBAA+B;IAqB/B;;;OAGG;IACH,eAAyE;IAEzE;;;OAGG;IACH,mBAOC;IAED;;;OAGG;IACH,gBAAqE;IACrE;;;OAGG;IACH,sBAGyB;IAEzB;;;OAGG;IACH,gBAAmB;IAEnB;;;OAGG;IACH,cAA6D;IAG/D;;;;OAIG;IACH,SAHY,IAAI,CA2Bf;IAuDD;;;;;;OAMG;IACH,kBAHW,MAAM,MAAM,CAAC,QAMvB;IAED;;;;OAIG;IACH,YAHY,OAAO,aAAa,EAAE,KAAK,CAKtC;IAED;;;;;OAKG;IACH,qBAJW,MAAM,GACL,gBAAgB,GAAC,iBAAiB,CAK7C;IA0BD;;OAEG;IACH,wBAFY,gBAAgB,GAAC,iBAAiB,CAI7C;IAqCD;;;;OAIG;IACH,UAHY,MAAM,GAAC,SAAS,CAK3B;CAmCF"}
|
||||
398
node_modules/ol/style/Icon.js
generated
vendored
Normal file
398
node_modules/ol/style/Icon.js
generated
vendored
Normal file
@@ -0,0 +1,398 @@
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
/**
|
||||
* @module ol/style/Icon
|
||||
*/
|
||||
import EventType from '../events/EventType.js';
|
||||
import IconAnchorUnits from './IconAnchorUnits.js';
|
||||
import IconOrigin from './IconOrigin.js';
|
||||
import ImageState from '../ImageState.js';
|
||||
import ImageStyle from './Image.js';
|
||||
import { asArray } from '../color.js';
|
||||
import { assert } from '../asserts.js';
|
||||
import { get as getIconImage } from './IconImage.js';
|
||||
import { getUid } from '../util.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {Array<number>} [anchor=[0.5, 0.5]] Anchor. Default value is the icon center.
|
||||
* @property {import("./IconOrigin.js").default} [anchorOrigin='top-left'] Origin of the anchor: `bottom-left`, `bottom-right`,
|
||||
* `top-left` or `top-right`.
|
||||
* @property {import("./IconAnchorUnits.js").default} [anchorXUnits='fraction'] 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.
|
||||
* @property {import("./IconAnchorUnits.js").default} [anchorYUnits='fraction'] 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.
|
||||
* @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 want to access pixel data with the Canvas renderer.
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
|
||||
* @property {HTMLImageElement|HTMLCanvasElement} [img] Image object for the icon. If the `src` option is not provided then the
|
||||
* provided image must already be loaded. And in that case, it is required
|
||||
* 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 {Array<number>} [displacement=[0,0]] Displacement of the icon.
|
||||
* @property {import("./IconOrigin.js").default} [offsetOrigin='top-left'] Origin of the offset: `bottom-left`, `bottom-right`,
|
||||
* `top-left` or `top-right`.
|
||||
* @property {number} [opacity=1] Opacity of the icon.
|
||||
* @property {number|import("../size.js").Size} [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 {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 {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.
|
||||
* @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Set icon style for vector features.
|
||||
* @api
|
||||
*/
|
||||
var Icon = /** @class */ (function (_super) {
|
||||
__extends(Icon, _super);
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function Icon(opt_options) {
|
||||
var _this = this;
|
||||
var options = opt_options || {};
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
var opacity = options.opacity !== undefined ? options.opacity : 1;
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
var rotation = options.rotation !== undefined ? options.rotation : 0;
|
||||
/**
|
||||
* @type {number|import("../size.js").Size}
|
||||
*/
|
||||
var scale = options.scale !== undefined ? options.scale : 1;
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
var rotateWithView = options.rotateWithView !== undefined ? options.rotateWithView : false;
|
||||
_this = _super.call(this, {
|
||||
opacity: opacity,
|
||||
rotation: rotation,
|
||||
scale: scale,
|
||||
displacement: options.displacement !== undefined ? options.displacement : [0, 0],
|
||||
rotateWithView: rotateWithView,
|
||||
declutterMode: options.declutterMode,
|
||||
}) || this;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
_this.anchor_ = options.anchor !== undefined ? options.anchor : [0.5, 0.5];
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
_this.normalizedAnchor_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./IconOrigin.js").default}
|
||||
*/
|
||||
_this.anchorOrigin_ =
|
||||
options.anchorOrigin !== undefined
|
||||
? options.anchorOrigin
|
||||
: IconOrigin.TOP_LEFT;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./IconAnchorUnits.js").default}
|
||||
*/
|
||||
_this.anchorXUnits_ =
|
||||
options.anchorXUnits !== undefined
|
||||
? options.anchorXUnits
|
||||
: IconAnchorUnits.FRACTION;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./IconAnchorUnits.js").default}
|
||||
*/
|
||||
_this.anchorYUnits_ =
|
||||
options.anchorYUnits !== undefined
|
||||
? options.anchorYUnits
|
||||
: IconAnchorUnits.FRACTION;
|
||||
/**
|
||||
* @private
|
||||
* @type {?string}
|
||||
*/
|
||||
_this.crossOrigin_ =
|
||||
options.crossOrigin !== undefined ? options.crossOrigin : null;
|
||||
/**
|
||||
* @type {HTMLImageElement|HTMLCanvasElement}
|
||||
*/
|
||||
var image = options.img !== undefined ? options.img : null;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../size.js").Size|undefined}
|
||||
*/
|
||||
_this.imgSize_ = options.imgSize;
|
||||
/**
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
var src = options.src;
|
||||
assert(!(src !== undefined && image), 4); // `image` and `src` cannot be provided at the same time
|
||||
assert(!image || (image && _this.imgSize_), 5); // `imgSize` must be set when `image` is provided
|
||||
if ((src === undefined || src.length === 0) && image) {
|
||||
src = /** @type {HTMLImageElement} */ (image).src || getUid(image);
|
||||
}
|
||||
assert(src !== undefined && src.length > 0, 6); // A defined and non-empty `src` or `image` must be provided
|
||||
/**
|
||||
* @type {import("../ImageState.js").default}
|
||||
*/
|
||||
var imageState = options.src !== undefined ? ImageState.IDLE : ImageState.LOADED;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../color.js").Color}
|
||||
*/
|
||||
_this.color_ = options.color !== undefined ? asArray(options.color) : null;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./IconImage.js").default}
|
||||
*/
|
||||
_this.iconImage_ = getIconImage(image,
|
||||
/** @type {string} */ (src), _this.imgSize_ !== undefined ? _this.imgSize_ : null, _this.crossOrigin_, imageState, _this.color_);
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
_this.offset_ = options.offset !== undefined ? options.offset : [0, 0];
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./IconOrigin.js").default}
|
||||
*/
|
||||
_this.offsetOrigin_ =
|
||||
options.offsetOrigin !== undefined
|
||||
? options.offsetOrigin
|
||||
: IconOrigin.TOP_LEFT;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
_this.origin_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
_this.size_ = options.size !== undefined ? options.size : null;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Clones the style. The underlying Image/HTMLCanvasElement is not cloned.
|
||||
* @return {Icon} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
Icon.prototype.clone = function () {
|
||||
var scale = this.getScale();
|
||||
return new Icon({
|
||||
anchor: this.anchor_.slice(),
|
||||
anchorOrigin: this.anchorOrigin_,
|
||||
anchorXUnits: this.anchorXUnits_,
|
||||
anchorYUnits: this.anchorYUnits_,
|
||||
color: this.color_ && this.color_.slice
|
||||
? this.color_.slice()
|
||||
: this.color_ || undefined,
|
||||
crossOrigin: this.crossOrigin_,
|
||||
imgSize: this.imgSize_,
|
||||
offset: this.offset_.slice(),
|
||||
offsetOrigin: this.offsetOrigin_,
|
||||
opacity: this.getOpacity(),
|
||||
rotateWithView: this.getRotateWithView(),
|
||||
rotation: this.getRotation(),
|
||||
scale: Array.isArray(scale) ? scale.slice() : scale,
|
||||
size: this.size_ !== null ? this.size_.slice() : undefined,
|
||||
src: this.getSrc(),
|
||||
displacement: this.getDisplacement().slice(),
|
||||
declutterMode: this.getDeclutterMode(),
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Get the anchor point in pixels. The anchor determines the center point for the
|
||||
* symbolizer.
|
||||
* @return {Array<number>} Anchor.
|
||||
* @api
|
||||
*/
|
||||
Icon.prototype.getAnchor = function () {
|
||||
var anchor = this.normalizedAnchor_;
|
||||
if (!anchor) {
|
||||
anchor = this.anchor_;
|
||||
var size = this.getSize();
|
||||
if (this.anchorXUnits_ == IconAnchorUnits.FRACTION ||
|
||||
this.anchorYUnits_ == IconAnchorUnits.FRACTION) {
|
||||
if (!size) {
|
||||
return null;
|
||||
}
|
||||
anchor = this.anchor_.slice();
|
||||
if (this.anchorXUnits_ == IconAnchorUnits.FRACTION) {
|
||||
anchor[0] *= size[0];
|
||||
}
|
||||
if (this.anchorYUnits_ == IconAnchorUnits.FRACTION) {
|
||||
anchor[1] *= size[1];
|
||||
}
|
||||
}
|
||||
if (this.anchorOrigin_ != IconOrigin.TOP_LEFT) {
|
||||
if (!size) {
|
||||
return null;
|
||||
}
|
||||
if (anchor === this.anchor_) {
|
||||
anchor = this.anchor_.slice();
|
||||
}
|
||||
if (this.anchorOrigin_ == IconOrigin.TOP_RIGHT ||
|
||||
this.anchorOrigin_ == IconOrigin.BOTTOM_RIGHT) {
|
||||
anchor[0] = -anchor[0] + size[0];
|
||||
}
|
||||
if (this.anchorOrigin_ == IconOrigin.BOTTOM_LEFT ||
|
||||
this.anchorOrigin_ == IconOrigin.BOTTOM_RIGHT) {
|
||||
anchor[1] = -anchor[1] + size[1];
|
||||
}
|
||||
}
|
||||
this.normalizedAnchor_ = anchor;
|
||||
}
|
||||
var displacement = this.getDisplacement();
|
||||
return [anchor[0] - displacement[0], anchor[1] + displacement[1]];
|
||||
};
|
||||
/**
|
||||
* Set the anchor point. The anchor determines the center point for the
|
||||
* symbolizer.
|
||||
*
|
||||
* @param {Array<number>} anchor Anchor.
|
||||
* @api
|
||||
*/
|
||||
Icon.prototype.setAnchor = function (anchor) {
|
||||
this.anchor_ = anchor;
|
||||
this.normalizedAnchor_ = null;
|
||||
};
|
||||
/**
|
||||
* Get the icon color.
|
||||
* @return {import("../color.js").Color} Color.
|
||||
* @api
|
||||
*/
|
||||
Icon.prototype.getColor = function () {
|
||||
return this.color_;
|
||||
};
|
||||
/**
|
||||
* Get the image icon.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
|
||||
* @api
|
||||
*/
|
||||
Icon.prototype.getImage = function (pixelRatio) {
|
||||
return this.iconImage_.getImage(pixelRatio);
|
||||
};
|
||||
/**
|
||||
* Get the pixel ratio.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {number} The pixel ratio of the image.
|
||||
* @api
|
||||
*/
|
||||
Icon.prototype.getPixelRatio = function (pixelRatio) {
|
||||
return this.iconImage_.getPixelRatio(pixelRatio);
|
||||
};
|
||||
/**
|
||||
* @return {import("../size.js").Size} Image size.
|
||||
*/
|
||||
Icon.prototype.getImageSize = function () {
|
||||
return this.iconImage_.getSize();
|
||||
};
|
||||
/**
|
||||
* @return {import("../ImageState.js").default} Image state.
|
||||
*/
|
||||
Icon.prototype.getImageState = function () {
|
||||
return this.iconImage_.getImageState();
|
||||
};
|
||||
/**
|
||||
* @return {HTMLImageElement|HTMLCanvasElement} Image element.
|
||||
*/
|
||||
Icon.prototype.getHitDetectionImage = function () {
|
||||
return this.iconImage_.getHitDetectionImage();
|
||||
};
|
||||
/**
|
||||
* Get the origin of the symbolizer.
|
||||
* @return {Array<number>} Origin.
|
||||
* @api
|
||||
*/
|
||||
Icon.prototype.getOrigin = function () {
|
||||
if (this.origin_) {
|
||||
return this.origin_;
|
||||
}
|
||||
var offset = this.offset_;
|
||||
if (this.offsetOrigin_ != IconOrigin.TOP_LEFT) {
|
||||
var size = this.getSize();
|
||||
var iconImageSize = this.iconImage_.getSize();
|
||||
if (!size || !iconImageSize) {
|
||||
return null;
|
||||
}
|
||||
offset = offset.slice();
|
||||
if (this.offsetOrigin_ == IconOrigin.TOP_RIGHT ||
|
||||
this.offsetOrigin_ == IconOrigin.BOTTOM_RIGHT) {
|
||||
offset[0] = iconImageSize[0] - size[0] - offset[0];
|
||||
}
|
||||
if (this.offsetOrigin_ == IconOrigin.BOTTOM_LEFT ||
|
||||
this.offsetOrigin_ == IconOrigin.BOTTOM_RIGHT) {
|
||||
offset[1] = iconImageSize[1] - size[1] - offset[1];
|
||||
}
|
||||
}
|
||||
this.origin_ = offset;
|
||||
return this.origin_;
|
||||
};
|
||||
/**
|
||||
* Get the image URL.
|
||||
* @return {string|undefined} Image src.
|
||||
* @api
|
||||
*/
|
||||
Icon.prototype.getSrc = function () {
|
||||
return this.iconImage_.getSrc();
|
||||
};
|
||||
/**
|
||||
* Get the size of the icon (in pixels).
|
||||
* @return {import("../size.js").Size} Image size.
|
||||
* @api
|
||||
*/
|
||||
Icon.prototype.getSize = function () {
|
||||
return !this.size_ ? this.iconImage_.getSize() : this.size_;
|
||||
};
|
||||
/**
|
||||
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
||||
*/
|
||||
Icon.prototype.listenImageChange = function (listener) {
|
||||
this.iconImage_.addEventListener(EventType.CHANGE, listener);
|
||||
};
|
||||
/**
|
||||
* Load not yet loaded URI.
|
||||
* When rendering a feature with an icon style, the vector renderer will
|
||||
* automatically call this method. However, you might want to call this
|
||||
* method yourself for preloading or other purposes.
|
||||
* @api
|
||||
*/
|
||||
Icon.prototype.load = function () {
|
||||
this.iconImage_.load();
|
||||
};
|
||||
/**
|
||||
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
||||
*/
|
||||
Icon.prototype.unlistenImageChange = function (listener) {
|
||||
this.iconImage_.removeEventListener(EventType.CHANGE, listener);
|
||||
};
|
||||
return Icon;
|
||||
}(ImageStyle));
|
||||
export default Icon;
|
||||
//# sourceMappingURL=Icon.js.map
|
||||
1
node_modules/ol/style/Icon.js.map
generated
vendored
Normal file
1
node_modules/ol/style/Icon.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/ol/style/IconAnchorUnits.d.ts
generated
vendored
Normal file
6
node_modules/ol/style/IconAnchorUnits.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
declare namespace _default {
|
||||
const FRACTION: string;
|
||||
const PIXELS: string;
|
||||
}
|
||||
export default _default;
|
||||
//# sourceMappingURL=IconAnchorUnits.d.ts.map
|
||||
1
node_modules/ol/style/IconAnchorUnits.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/IconAnchorUnits.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IconAnchorUnits.d.ts","sourceRoot":"","sources":["../src/style/IconAnchorUnits.js"],"names":[],"mappings":""}
|
||||
20
node_modules/ol/style/IconAnchorUnits.js
generated
vendored
Normal file
20
node_modules/ol/style/IconAnchorUnits.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @module ol/style/IconAnchorUnits
|
||||
*/
|
||||
/**
|
||||
* Icon anchor units. One of 'fraction', 'pixels'.
|
||||
* @enum {string}
|
||||
*/
|
||||
export default {
|
||||
/**
|
||||
* Anchor is a fraction
|
||||
* @api
|
||||
*/
|
||||
FRACTION: 'fraction',
|
||||
/**
|
||||
* Anchor is in pixels
|
||||
* @api
|
||||
*/
|
||||
PIXELS: 'pixels',
|
||||
};
|
||||
//# sourceMappingURL=IconAnchorUnits.js.map
|
||||
1
node_modules/ol/style/IconAnchorUnits.js.map
generated
vendored
Normal file
1
node_modules/ol/style/IconAnchorUnits.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IconAnchorUnits.js","sourceRoot":"","sources":["../src/style/IconAnchorUnits.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,eAAe;IACb;;;OAGG;IACH,QAAQ,EAAE,UAAU;IACpB;;;OAGG;IACH,MAAM,EAAE,QAAQ;CACjB,CAAC"}
|
||||
124
node_modules/ol/style/IconImage.d.ts
generated
vendored
Normal file
124
node_modules/ol/style/IconImage.d.ts
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* @param {HTMLImageElement|HTMLCanvasElement} image Image.
|
||||
* @param {string} src Src.
|
||||
* @param {import("../size.js").Size} size Size.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {import("../ImageState.js").default} imageState Image state.
|
||||
* @param {import("../color.js").Color} color Color.
|
||||
* @return {IconImage} Icon image.
|
||||
*/
|
||||
export function get(image: HTMLImageElement | HTMLCanvasElement, src: string, size: import("../size.js").Size, crossOrigin: string | null, imageState: any, color: import("../color.js").Color): IconImage;
|
||||
export default IconImage;
|
||||
declare class IconImage extends EventTarget {
|
||||
/**
|
||||
* @param {HTMLImageElement|HTMLCanvasElement} image Image.
|
||||
* @param {string|undefined} src Src.
|
||||
* @param {import("../size.js").Size} size Size.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {import("../ImageState.js").default} imageState Image state.
|
||||
* @param {import("../color.js").Color} color Color.
|
||||
*/
|
||||
constructor(image: HTMLImageElement | HTMLCanvasElement, src: string | undefined, size: import("../size.js").Size, crossOrigin: string | null, imageState: any, color: import("../color.js").Color);
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLImageElement|HTMLCanvasElement}
|
||||
*/
|
||||
private hitDetectionImage_;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLImageElement|HTMLCanvasElement}
|
||||
*/
|
||||
private image_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Object<number, HTMLCanvasElement>}
|
||||
*/
|
||||
private canvas_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../color.js").Color}
|
||||
*/
|
||||
private color_;
|
||||
/**
|
||||
* @private
|
||||
* @type {?function():void}
|
||||
*/
|
||||
private unlisten_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../ImageState.js").default}
|
||||
*/
|
||||
private imageState_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
private size_;
|
||||
/**
|
||||
* @private
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
private src_;
|
||||
/**
|
||||
* @private
|
||||
* @return {boolean} The image canvas is tainted.
|
||||
*/
|
||||
private isTainted_;
|
||||
tainted_: boolean | undefined;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private dispatchChangeEvent_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private handleImageError_;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
private handleImageLoad_;
|
||||
/**
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
|
||||
*/
|
||||
getImage(pixelRatio: number): HTMLImageElement | HTMLCanvasElement;
|
||||
/**
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {number} Image or Canvas element.
|
||||
*/
|
||||
getPixelRatio(pixelRatio: number): number;
|
||||
/**
|
||||
* @return {import("../ImageState.js").default} Image state.
|
||||
*/
|
||||
getImageState(): any;
|
||||
/**
|
||||
* @return {HTMLImageElement|HTMLCanvasElement} Image element.
|
||||
*/
|
||||
getHitDetectionImage(): HTMLImageElement | HTMLCanvasElement;
|
||||
/**
|
||||
* Get the size of the icon (in pixels).
|
||||
* @return {import("../size.js").Size} Image size.
|
||||
*/
|
||||
getSize(): import("../size.js").Size;
|
||||
/**
|
||||
* @return {string|undefined} Image src.
|
||||
*/
|
||||
getSrc(): string | undefined;
|
||||
/**
|
||||
* Load not yet loaded URI.
|
||||
*/
|
||||
load(): void;
|
||||
/**
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @private
|
||||
*/
|
||||
private replaceColor_;
|
||||
/**
|
||||
* Discards event handlers which listen for load completion or errors.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
private unlistenImage_;
|
||||
}
|
||||
import EventTarget from "../events/Target.js";
|
||||
//# sourceMappingURL=IconImage.d.ts.map
|
||||
1
node_modules/ol/style/IconImage.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/IconImage.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IconImage.d.ts","sourceRoot":"","sources":["../src/style/IconImage.js"],"names":[],"mappings":"AAwRA;;;;;;;;GAQG;AACH,2BARW,gBAAgB,GAAC,iBAAiB,OAClC,MAAM,QACN,OAAO,YAAY,EAAE,IAAI,eACxB,MAAM,iCAEP,OAAO,aAAa,EAAE,KAAK,GAC1B,SAAS,CASpB;;AAvRD;IACE;;;;;;;OAOG;IACH,mBAPW,gBAAgB,GAAC,iBAAiB,OAClC,MAAM,GAAC,SAAS,QAChB,OAAO,YAAY,EAAE,IAAI,eACxB,MAAM,iCAEP,OAAO,aAAa,EAAE,KAAK,EA6DrC;IAxDC;;;OAGG;IACH,2BAA8B;IAE9B;;;OAGG;IACH,eAA0C;IAM1C;;;OAGG;IACH,gBAAiB;IAEjB;;;OAGG;IACH,eAAmB;IAEnB;;;OAGG;IACH,kBAAqB;IAErB;;;OAGG;IACH,oBAA6B;IAE7B;;;OAGG;IACH,cAAiB;IAEjB;;;OAGG;IACH,aAAe;IAQjB;;;OAGG;IACH,mBAeC;IAPK,8BAAqB;IAS3B;;OAEG;IACH,6BAEC;IAED;;OAEG;IACH,0BAIC;IAED;;OAEG;IACH,yBAUC;IAED;;;OAGG;IACH,qBAHW,MAAM,GACL,gBAAgB,GAAC,iBAAiB,CAK7C;IAED;;;OAGG;IACH,0BAHW,MAAM,GACL,MAAM,CAKjB;IAED;;OAEG;IACH,qBAEC;IAED;;OAEG;IACH,wBAFY,gBAAgB,GAAC,iBAAiB,CAe7C;IAED;;;OAGG;IACH,WAFY,OAAO,YAAY,EAAE,IAAI,CAIpC;IAED;;OAEG;IACH,UAFY,MAAM,GAAC,SAAS,CAI3B;IAED;;OAEG;IACH,aAcC;IAED;;;OAGG;IACH,sBA6CC;IAED;;;;OAIG;IACH,uBAKC;CACF"}
|
||||
283
node_modules/ol/style/IconImage.js
generated
vendored
Normal file
283
node_modules/ol/style/IconImage.js
generated
vendored
Normal file
@@ -0,0 +1,283 @@
|
||||
/**
|
||||
* @module ol/style/IconImage
|
||||
*/
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
import EventTarget from '../events/Target.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import ImageState from '../ImageState.js';
|
||||
import { asString } from '../color.js';
|
||||
import { createCanvasContext2D } from '../dom.js';
|
||||
import { shared as iconImageCache } from './IconImageCache.js';
|
||||
import { listenImage } from '../Image.js';
|
||||
/**
|
||||
* @type {CanvasRenderingContext2D}
|
||||
*/
|
||||
var taintedTestContext = null;
|
||||
var IconImage = /** @class */ (function (_super) {
|
||||
__extends(IconImage, _super);
|
||||
/**
|
||||
* @param {HTMLImageElement|HTMLCanvasElement} image Image.
|
||||
* @param {string|undefined} src Src.
|
||||
* @param {import("../size.js").Size} size Size.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {import("../ImageState.js").default} imageState Image state.
|
||||
* @param {import("../color.js").Color} color Color.
|
||||
*/
|
||||
function IconImage(image, src, size, crossOrigin, imageState, color) {
|
||||
var _this = _super.call(this) || this;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLImageElement|HTMLCanvasElement}
|
||||
*/
|
||||
_this.hitDetectionImage_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLImageElement|HTMLCanvasElement}
|
||||
*/
|
||||
_this.image_ = !image ? new Image() : image;
|
||||
if (crossOrigin !== null) {
|
||||
/** @type {HTMLImageElement} */ (_this.image_).crossOrigin = crossOrigin;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @type {Object<number, HTMLCanvasElement>}
|
||||
*/
|
||||
_this.canvas_ = {};
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../color.js").Color}
|
||||
*/
|
||||
_this.color_ = color;
|
||||
/**
|
||||
* @private
|
||||
* @type {?function():void}
|
||||
*/
|
||||
_this.unlisten_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../ImageState.js").default}
|
||||
*/
|
||||
_this.imageState_ = imageState;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
_this.size_ = size;
|
||||
/**
|
||||
* @private
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
_this.src_ = src;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_this.tainted_;
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @return {boolean} The image canvas is tainted.
|
||||
*/
|
||||
IconImage.prototype.isTainted_ = function () {
|
||||
if (this.tainted_ === undefined && this.imageState_ === ImageState.LOADED) {
|
||||
if (!taintedTestContext) {
|
||||
taintedTestContext = createCanvasContext2D(1, 1);
|
||||
}
|
||||
taintedTestContext.drawImage(this.image_, 0, 0);
|
||||
try {
|
||||
taintedTestContext.getImageData(0, 0, 1, 1);
|
||||
this.tainted_ = false;
|
||||
}
|
||||
catch (e) {
|
||||
taintedTestContext = null;
|
||||
this.tainted_ = true;
|
||||
}
|
||||
}
|
||||
return this.tainted_ === true;
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
IconImage.prototype.dispatchChangeEvent_ = function () {
|
||||
this.dispatchEvent(EventType.CHANGE);
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
IconImage.prototype.handleImageError_ = function () {
|
||||
this.imageState_ = ImageState.ERROR;
|
||||
this.unlistenImage_();
|
||||
this.dispatchChangeEvent_();
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
IconImage.prototype.handleImageLoad_ = function () {
|
||||
this.imageState_ = ImageState.LOADED;
|
||||
if (this.size_) {
|
||||
this.image_.width = this.size_[0];
|
||||
this.image_.height = this.size_[1];
|
||||
}
|
||||
else {
|
||||
this.size_ = [this.image_.width, this.image_.height];
|
||||
}
|
||||
this.unlistenImage_();
|
||||
this.dispatchChangeEvent_();
|
||||
};
|
||||
/**
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
|
||||
*/
|
||||
IconImage.prototype.getImage = function (pixelRatio) {
|
||||
this.replaceColor_(pixelRatio);
|
||||
return this.canvas_[pixelRatio] ? this.canvas_[pixelRatio] : this.image_;
|
||||
};
|
||||
/**
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {number} Image or Canvas element.
|
||||
*/
|
||||
IconImage.prototype.getPixelRatio = function (pixelRatio) {
|
||||
this.replaceColor_(pixelRatio);
|
||||
return this.canvas_[pixelRatio] ? pixelRatio : 1;
|
||||
};
|
||||
/**
|
||||
* @return {import("../ImageState.js").default} Image state.
|
||||
*/
|
||||
IconImage.prototype.getImageState = function () {
|
||||
return this.imageState_;
|
||||
};
|
||||
/**
|
||||
* @return {HTMLImageElement|HTMLCanvasElement} Image element.
|
||||
*/
|
||||
IconImage.prototype.getHitDetectionImage = function () {
|
||||
if (!this.hitDetectionImage_) {
|
||||
if (this.isTainted_()) {
|
||||
var width = this.size_[0];
|
||||
var height = this.size_[1];
|
||||
var context = createCanvasContext2D(width, height);
|
||||
context.fillRect(0, 0, width, height);
|
||||
this.hitDetectionImage_ = context.canvas;
|
||||
}
|
||||
else {
|
||||
this.hitDetectionImage_ = this.image_;
|
||||
}
|
||||
}
|
||||
return this.hitDetectionImage_;
|
||||
};
|
||||
/**
|
||||
* Get the size of the icon (in pixels).
|
||||
* @return {import("../size.js").Size} Image size.
|
||||
*/
|
||||
IconImage.prototype.getSize = function () {
|
||||
return this.size_;
|
||||
};
|
||||
/**
|
||||
* @return {string|undefined} Image src.
|
||||
*/
|
||||
IconImage.prototype.getSrc = function () {
|
||||
return this.src_;
|
||||
};
|
||||
/**
|
||||
* Load not yet loaded URI.
|
||||
*/
|
||||
IconImage.prototype.load = function () {
|
||||
if (this.imageState_ == ImageState.IDLE) {
|
||||
this.imageState_ = ImageState.LOADING;
|
||||
try {
|
||||
/** @type {HTMLImageElement} */ (this.image_).src = this.src_;
|
||||
}
|
||||
catch (e) {
|
||||
this.handleImageError_();
|
||||
}
|
||||
this.unlisten_ = listenImage(this.image_, this.handleImageLoad_.bind(this), this.handleImageError_.bind(this));
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @private
|
||||
*/
|
||||
IconImage.prototype.replaceColor_ = function (pixelRatio) {
|
||||
if (!this.color_ ||
|
||||
this.canvas_[pixelRatio] ||
|
||||
this.imageState_ !== ImageState.LOADED) {
|
||||
return;
|
||||
}
|
||||
var canvas = document.createElement('canvas');
|
||||
this.canvas_[pixelRatio] = canvas;
|
||||
canvas.width = Math.ceil(this.image_.width * pixelRatio);
|
||||
canvas.height = Math.ceil(this.image_.height * pixelRatio);
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.scale(pixelRatio, pixelRatio);
|
||||
ctx.drawImage(this.image_, 0, 0);
|
||||
ctx.globalCompositeOperation = 'multiply';
|
||||
// Internet Explorer 11 does not support the multiply operation.
|
||||
// If the canvas is tainted in Internet Explorer this still produces
|
||||
// a solid color image with the shape of the icon.
|
||||
if (ctx.globalCompositeOperation === 'multiply' || this.isTainted_()) {
|
||||
ctx.fillStyle = asString(this.color_);
|
||||
ctx.fillRect(0, 0, canvas.width / pixelRatio, canvas.height / pixelRatio);
|
||||
ctx.globalCompositeOperation = 'destination-in';
|
||||
ctx.drawImage(this.image_, 0, 0);
|
||||
}
|
||||
else {
|
||||
var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
||||
var data = imgData.data;
|
||||
var r = this.color_[0] / 255.0;
|
||||
var g = this.color_[1] / 255.0;
|
||||
var b = this.color_[2] / 255.0;
|
||||
var a = this.color_[3];
|
||||
for (var i = 0, ii = data.length; i < ii; i += 4) {
|
||||
data[i] *= r;
|
||||
data[i + 1] *= g;
|
||||
data[i + 2] *= b;
|
||||
data[i + 3] *= a;
|
||||
}
|
||||
ctx.putImageData(imgData, 0, 0);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Discards event handlers which listen for load completion or errors.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
IconImage.prototype.unlistenImage_ = function () {
|
||||
if (this.unlisten_) {
|
||||
this.unlisten_();
|
||||
this.unlisten_ = null;
|
||||
}
|
||||
};
|
||||
return IconImage;
|
||||
}(EventTarget));
|
||||
/**
|
||||
* @param {HTMLImageElement|HTMLCanvasElement} image Image.
|
||||
* @param {string} src Src.
|
||||
* @param {import("../size.js").Size} size Size.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {import("../ImageState.js").default} imageState Image state.
|
||||
* @param {import("../color.js").Color} color Color.
|
||||
* @return {IconImage} Icon image.
|
||||
*/
|
||||
export function get(image, src, size, crossOrigin, imageState, color) {
|
||||
var iconImage = iconImageCache.get(src, crossOrigin, color);
|
||||
if (!iconImage) {
|
||||
iconImage = new IconImage(image, src, size, crossOrigin, imageState, color);
|
||||
iconImageCache.set(src, crossOrigin, color, iconImage);
|
||||
}
|
||||
return iconImage;
|
||||
}
|
||||
export default IconImage;
|
||||
//# sourceMappingURL=IconImage.js.map
|
||||
1
node_modules/ol/style/IconImage.js.map
generated
vendored
Normal file
1
node_modules/ol/style/IconImage.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
63
node_modules/ol/style/IconImageCache.d.ts
generated
vendored
Normal file
63
node_modules/ol/style/IconImageCache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
export default IconImageCache;
|
||||
/**
|
||||
* The {@link module:ol/style/IconImageCache~IconImageCache} for
|
||||
* {@link module:ol/style/Icon~Icon} images.
|
||||
* @api
|
||||
*/
|
||||
export const shared: IconImageCache;
|
||||
/**
|
||||
* @classdesc
|
||||
* Singleton class. Available through {@link module:ol/style/IconImageCache.shared}.
|
||||
*/
|
||||
declare class IconImageCache {
|
||||
/**
|
||||
* @type {!Object<string, import("./IconImage.js").default>}
|
||||
* @private
|
||||
*/
|
||||
private cache_;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private cacheSize_;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
private maxCacheSize_;
|
||||
/**
|
||||
* FIXME empty description for jsdoc
|
||||
*/
|
||||
clear(): void;
|
||||
/**
|
||||
* @return {boolean} Can expire cache.
|
||||
*/
|
||||
canExpireCache(): boolean;
|
||||
/**
|
||||
* FIXME empty description for jsdoc
|
||||
*/
|
||||
expire(): void;
|
||||
/**
|
||||
* @param {string} src Src.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {import("../color.js").Color} color Color.
|
||||
* @return {import("./IconImage.js").default} Icon image.
|
||||
*/
|
||||
get(src: string, crossOrigin: string | null, color: import("../color.js").Color): import("./IconImage.js").default;
|
||||
/**
|
||||
* @param {string} src Src.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {import("../color.js").Color} color Color.
|
||||
* @param {import("./IconImage.js").default} iconImage Icon image.
|
||||
*/
|
||||
set(src: string, crossOrigin: string | null, color: import("../color.js").Color, iconImage: import("./IconImage.js").default): void;
|
||||
/**
|
||||
* Set the cache size of the icon cache. Default is `32`. Change this value when
|
||||
* your map uses more than 32 different icon images and you are not caching icon
|
||||
* styles on the application level.
|
||||
* @param {number} maxCacheSize Cache max size.
|
||||
* @api
|
||||
*/
|
||||
setSize(maxCacheSize: number): void;
|
||||
}
|
||||
//# sourceMappingURL=IconImageCache.d.ts.map
|
||||
1
node_modules/ol/style/IconImageCache.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/IconImageCache.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IconImageCache.d.ts","sourceRoot":"","sources":["../src/style/IconImageCache.js"],"names":[],"mappings":";AA8GA;;;;GAIG;AACH,oCAA2C;AA9G3C;;;GAGG;AACH;IAEI;;;OAGG;IACH,eAAgB;IAEhB;;;OAGG;IACH,mBAAmB;IAEnB;;;OAGG;IACH,sBAAuB;IAGzB;;OAEG;IACH,cAGC;IAED;;OAEG;IACH,kBAFY,OAAO,CAIlB;IAED;;OAEG;IACH,eAWC;IAED;;;;;OAKG;IACH,SALW,MAAM,eACL,MAAM,gBACP,OAAO,aAAa,EAAE,KAAK,GAC1B,OAAO,gBAAgB,EAAE,OAAO,CAK3C;IAED;;;;;OAKG;IACH,SALW,MAAM,eACL,MAAM,gBACP,OAAO,aAAa,EAAE,KAAK,aAC3B,OAAO,gBAAgB,EAAE,OAAO,QAM1C;IAED;;;;;;OAMG;IACH,sBAHW,MAAM,QAMhB;CACF"}
|
||||
106
node_modules/ol/style/IconImageCache.js
generated
vendored
Normal file
106
node_modules/ol/style/IconImageCache.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* @module ol/style/IconImageCache
|
||||
*/
|
||||
import { asString } from '../color.js';
|
||||
/**
|
||||
* @classdesc
|
||||
* Singleton class. Available through {@link module:ol/style/IconImageCache.shared}.
|
||||
*/
|
||||
var IconImageCache = /** @class */ (function () {
|
||||
function IconImageCache() {
|
||||
/**
|
||||
* @type {!Object<string, import("./IconImage.js").default>}
|
||||
* @private
|
||||
*/
|
||||
this.cache_ = {};
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
this.cacheSize_ = 0;
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
this.maxCacheSize_ = 32;
|
||||
}
|
||||
/**
|
||||
* FIXME empty description for jsdoc
|
||||
*/
|
||||
IconImageCache.prototype.clear = function () {
|
||||
this.cache_ = {};
|
||||
this.cacheSize_ = 0;
|
||||
};
|
||||
/**
|
||||
* @return {boolean} Can expire cache.
|
||||
*/
|
||||
IconImageCache.prototype.canExpireCache = function () {
|
||||
return this.cacheSize_ > this.maxCacheSize_;
|
||||
};
|
||||
/**
|
||||
* FIXME empty description for jsdoc
|
||||
*/
|
||||
IconImageCache.prototype.expire = function () {
|
||||
if (this.canExpireCache()) {
|
||||
var i = 0;
|
||||
for (var key in this.cache_) {
|
||||
var iconImage = this.cache_[key];
|
||||
if ((i++ & 3) === 0 && !iconImage.hasListener()) {
|
||||
delete this.cache_[key];
|
||||
--this.cacheSize_;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @param {string} src Src.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {import("../color.js").Color} color Color.
|
||||
* @return {import("./IconImage.js").default} Icon image.
|
||||
*/
|
||||
IconImageCache.prototype.get = function (src, crossOrigin, color) {
|
||||
var key = getKey(src, crossOrigin, color);
|
||||
return key in this.cache_ ? this.cache_[key] : null;
|
||||
};
|
||||
/**
|
||||
* @param {string} src Src.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {import("../color.js").Color} color Color.
|
||||
* @param {import("./IconImage.js").default} iconImage Icon image.
|
||||
*/
|
||||
IconImageCache.prototype.set = function (src, crossOrigin, color, iconImage) {
|
||||
var key = getKey(src, crossOrigin, color);
|
||||
this.cache_[key] = iconImage;
|
||||
++this.cacheSize_;
|
||||
};
|
||||
/**
|
||||
* Set the cache size of the icon cache. Default is `32`. Change this value when
|
||||
* your map uses more than 32 different icon images and you are not caching icon
|
||||
* styles on the application level.
|
||||
* @param {number} maxCacheSize Cache max size.
|
||||
* @api
|
||||
*/
|
||||
IconImageCache.prototype.setSize = function (maxCacheSize) {
|
||||
this.maxCacheSize_ = maxCacheSize;
|
||||
this.expire();
|
||||
};
|
||||
return IconImageCache;
|
||||
}());
|
||||
/**
|
||||
* @param {string} src Src.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {import("../color.js").Color} color Color.
|
||||
* @return {string} Cache key.
|
||||
*/
|
||||
function getKey(src, crossOrigin, color) {
|
||||
var colorString = color ? asString(color) : 'null';
|
||||
return crossOrigin + ':' + src + ':' + colorString;
|
||||
}
|
||||
export default IconImageCache;
|
||||
/**
|
||||
* The {@link module:ol/style/IconImageCache~IconImageCache} for
|
||||
* {@link module:ol/style/Icon~Icon} images.
|
||||
* @api
|
||||
*/
|
||||
export var shared = new IconImageCache();
|
||||
//# sourceMappingURL=IconImageCache.js.map
|
||||
1
node_modules/ol/style/IconImageCache.js.map
generated
vendored
Normal file
1
node_modules/ol/style/IconImageCache.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IconImageCache.js","sourceRoot":"","sources":["../src/style/IconImageCache.js"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAErC;;;GAGG;AACH;IACE;QACE;;;WAGG;QACH,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QAEjB;;;WAGG;QACH,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAEpB;;;WAGG;QACH,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,8BAAK,GAAL;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,uCAAc,GAAd;QACE,OAAO,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,+BAAM,GAAN;QACE,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE;YACzB,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,KAAK,IAAM,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE;gBAC7B,IAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACnC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE;oBAC/C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBACxB,EAAE,IAAI,CAAC,UAAU,CAAC;iBACnB;aACF;SACF;IACH,CAAC;IAED;;;;;OAKG;IACH,4BAAG,GAAH,UAAI,GAAG,EAAE,WAAW,EAAE,KAAK;QACzB,IAAM,GAAG,GAAG,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QAC5C,OAAO,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACtD,CAAC;IAED;;;;;OAKG;IACH,4BAAG,GAAH,UAAI,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS;QACpC,IAAM,GAAG,GAAG,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;QAC7B,EAAE,IAAI,CAAC,UAAU,CAAC;IACpB,CAAC;IAED;;;;;;OAMG;IACH,gCAAO,GAAP,UAAQ,YAAY;QAClB,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IACH,qBAAC;AAAD,CAAC,AAtFD,IAsFC;AAED;;;;;GAKG;AACH,SAAS,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK;IACrC,IAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACrD,OAAO,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,WAAW,CAAC;AACrD,CAAC;AAED,eAAe,cAAc,CAAC;AAE9B;;;;GAIG;AACH,MAAM,CAAC,IAAM,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC"}
|
||||
8
node_modules/ol/style/IconOrigin.d.ts
generated
vendored
Normal file
8
node_modules/ol/style/IconOrigin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
declare namespace _default {
|
||||
const BOTTOM_LEFT: string;
|
||||
const BOTTOM_RIGHT: string;
|
||||
const TOP_LEFT: string;
|
||||
const TOP_RIGHT: string;
|
||||
}
|
||||
export default _default;
|
||||
//# sourceMappingURL=IconOrigin.d.ts.map
|
||||
1
node_modules/ol/style/IconOrigin.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/IconOrigin.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IconOrigin.d.ts","sourceRoot":"","sources":["../src/style/IconOrigin.js"],"names":[],"mappings":""}
|
||||
30
node_modules/ol/style/IconOrigin.js
generated
vendored
Normal file
30
node_modules/ol/style/IconOrigin.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @module ol/style/IconOrigin
|
||||
*/
|
||||
/**
|
||||
* Icon origin. One of 'bottom-left', 'bottom-right', 'top-left', 'top-right'.
|
||||
* @enum {string}
|
||||
*/
|
||||
export default {
|
||||
/**
|
||||
* Origin is at bottom left
|
||||
* @api
|
||||
*/
|
||||
BOTTOM_LEFT: 'bottom-left',
|
||||
/**
|
||||
* Origin is at bottom right
|
||||
* @api
|
||||
*/
|
||||
BOTTOM_RIGHT: 'bottom-right',
|
||||
/**
|
||||
* Origin is at top left
|
||||
* @api
|
||||
*/
|
||||
TOP_LEFT: 'top-left',
|
||||
/**
|
||||
* Origin is at top right
|
||||
* @api
|
||||
*/
|
||||
TOP_RIGHT: 'top-right',
|
||||
};
|
||||
//# sourceMappingURL=IconOrigin.js.map
|
||||
1
node_modules/ol/style/IconOrigin.js.map
generated
vendored
Normal file
1
node_modules/ol/style/IconOrigin.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IconOrigin.js","sourceRoot":"","sources":["../src/style/IconOrigin.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,eAAe;IACb;;;OAGG;IACH,WAAW,EAAE,aAAa;IAC1B;;;OAGG;IACH,YAAY,EAAE,cAAc;IAC5B;;;OAGG;IACH,QAAQ,EAAE,UAAU;IACpB;;;OAGG;IACH,SAAS,EAAE,WAAW;CACvB,CAAC"}
|
||||
229
node_modules/ol/style/Image.d.ts
generated
vendored
Normal file
229
node_modules/ol/style/Image.d.ts
generated
vendored
Normal file
@@ -0,0 +1,229 @@
|
||||
export default ImageStyle;
|
||||
export type Options = {
|
||||
/**
|
||||
* Opacity.
|
||||
*/
|
||||
opacity: number;
|
||||
/**
|
||||
* If the image should get rotated with the view.
|
||||
*/
|
||||
rotateWithView: boolean;
|
||||
/**
|
||||
* Rotation.
|
||||
*/
|
||||
rotation: number;
|
||||
/**
|
||||
* Scale.
|
||||
*/
|
||||
scale: number | import("../size.js").Size;
|
||||
/**
|
||||
* Displacement.
|
||||
*/
|
||||
displacement: Array<number>;
|
||||
/**
|
||||
* Declutter mode: `declutter`, `obstacle`, 'none
|
||||
*/
|
||||
declutterMode: "declutter" | "obstacle" | "none" | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {number} opacity Opacity.
|
||||
* @property {boolean} rotateWithView If the image should get rotated with the view.
|
||||
* @property {number} rotation Rotation.
|
||||
* @property {number|import("../size.js").Size} scale Scale.
|
||||
* @property {Array<number>} displacement Displacement.
|
||||
* @property {"declutter"|"obstacle"|"none"|undefined} declutterMode Declutter mode: `declutter`, `obstacle`, 'none */
|
||||
/**
|
||||
* @classdesc
|
||||
* A base class used for creating subclasses and not instantiated in
|
||||
* apps. Base class for {@link module:ol/style/Icon~Icon}, {@link module:ol/style/Circle~CircleStyle} and
|
||||
* {@link module:ol/style/RegularShape~RegularShape}.
|
||||
* @abstract
|
||||
* @api
|
||||
*/
|
||||
declare class ImageStyle {
|
||||
/**
|
||||
* @param {Options} options Options.
|
||||
*/
|
||||
constructor(options: Options);
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private opacity_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private rotateWithView_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private rotation_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|import("../size.js").Size}
|
||||
*/
|
||||
private scale_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
private scaleArray_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
private displacement_;
|
||||
/**
|
||||
* @private
|
||||
* @type {"declutter"|"obstacle"|"none"|undefined}
|
||||
*/
|
||||
private declutterMode_;
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {ImageStyle} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
clone(): ImageStyle;
|
||||
/**
|
||||
* Get the symbolizer opacity.
|
||||
* @return {number} Opacity.
|
||||
* @api
|
||||
*/
|
||||
getOpacity(): number;
|
||||
/**
|
||||
* Determine whether the symbolizer rotates with the map.
|
||||
* @return {boolean} Rotate with map.
|
||||
* @api
|
||||
*/
|
||||
getRotateWithView(): boolean;
|
||||
/**
|
||||
* Get the symoblizer rotation.
|
||||
* @return {number} Rotation.
|
||||
* @api
|
||||
*/
|
||||
getRotation(): number;
|
||||
/**
|
||||
* Get the symbolizer scale.
|
||||
* @return {number|import("../size.js").Size} Scale.
|
||||
* @api
|
||||
*/
|
||||
getScale(): number | import("../size.js").Size;
|
||||
/**
|
||||
* Get the symbolizer scale array.
|
||||
* @return {import("../size.js").Size} Scale array.
|
||||
*/
|
||||
getScaleArray(): import("../size.js").Size;
|
||||
/**
|
||||
* Get the displacement of the shape
|
||||
* @return {Array<number>} Shape's center displacement
|
||||
* @api
|
||||
*/
|
||||
getDisplacement(): Array<number>;
|
||||
/**
|
||||
* Get the declutter mode of the shape
|
||||
* @return {"declutter"|"obstacle"|"none"|undefined} Shape's declutter mode
|
||||
* @api
|
||||
*/
|
||||
getDeclutterMode(): "declutter" | "obstacle" | "none" | undefined;
|
||||
/**
|
||||
* Get the anchor point in pixels. The anchor determines the center point for the
|
||||
* symbolizer.
|
||||
* @abstract
|
||||
* @return {Array<number>} Anchor.
|
||||
*/
|
||||
getAnchor(): Array<number>;
|
||||
/**
|
||||
* Get the image element for the symbolizer.
|
||||
* @abstract
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
|
||||
*/
|
||||
getImage(pixelRatio: number): HTMLCanvasElement | HTMLVideoElement | HTMLImageElement;
|
||||
/**
|
||||
* @abstract
|
||||
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
|
||||
*/
|
||||
getHitDetectionImage(): HTMLCanvasElement | HTMLVideoElement | HTMLImageElement;
|
||||
/**
|
||||
* Get the image pixel ratio.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {number} Pixel ratio.
|
||||
*/
|
||||
getPixelRatio(pixelRatio: number): number;
|
||||
/**
|
||||
* @abstract
|
||||
* @return {import("../ImageState.js").default} Image state.
|
||||
*/
|
||||
getImageState(): any;
|
||||
/**
|
||||
* @abstract
|
||||
* @return {import("../size.js").Size} Image size.
|
||||
*/
|
||||
getImageSize(): import("../size.js").Size;
|
||||
/**
|
||||
* Get the origin of the symbolizer.
|
||||
* @abstract
|
||||
* @return {Array<number>} Origin.
|
||||
*/
|
||||
getOrigin(): Array<number>;
|
||||
/**
|
||||
* Get the size of the symbolizer (in pixels).
|
||||
* @abstract
|
||||
* @return {import("../size.js").Size} Size.
|
||||
*/
|
||||
getSize(): import("../size.js").Size;
|
||||
/**
|
||||
* Set the displacement.
|
||||
*
|
||||
* @param {Array<number>} displacement Displacement.
|
||||
* @api
|
||||
*/
|
||||
setDisplacement(displacement: Array<number>): void;
|
||||
/**
|
||||
* Set the opacity.
|
||||
*
|
||||
* @param {number} opacity Opacity.
|
||||
* @api
|
||||
*/
|
||||
setOpacity(opacity: number): void;
|
||||
/**
|
||||
* Set whether to rotate the style with the view.
|
||||
*
|
||||
* @param {boolean} rotateWithView Rotate with map.
|
||||
* @api
|
||||
*/
|
||||
setRotateWithView(rotateWithView: boolean): void;
|
||||
/**
|
||||
* Set the rotation.
|
||||
*
|
||||
* @param {number} rotation Rotation.
|
||||
* @api
|
||||
*/
|
||||
setRotation(rotation: number): void;
|
||||
/**
|
||||
* Set the scale.
|
||||
*
|
||||
* @param {number|import("../size.js").Size} scale Scale.
|
||||
* @api
|
||||
*/
|
||||
setScale(scale: number | import("../size.js").Size): void;
|
||||
/**
|
||||
* @abstract
|
||||
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
||||
*/
|
||||
listenImageChange(listener: (arg0: import("../events/Event.js").default) => void): void;
|
||||
/**
|
||||
* Load not yet loaded URI.
|
||||
* @abstract
|
||||
*/
|
||||
load(): void;
|
||||
/**
|
||||
* @abstract
|
||||
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
||||
*/
|
||||
unlistenImageChange(listener: (arg0: import("../events/Event.js").default) => void): void;
|
||||
}
|
||||
//# sourceMappingURL=Image.d.ts.map
|
||||
1
node_modules/ol/style/Image.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/Image.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../src/style/Image.js"],"names":[],"mappings":";;;;;aAQc,MAAM;;;;oBACN,OAAO;;;;cACP,MAAM;;;;WACN,MAAM,GAAC,OAAO,YAAY,EAAE,IAAI;;;;kBAChC,MAAM,MAAM,CAAC;;;;mBACb,WAAW,GAAC,UAAU,GAAC,MAAM,GAAC,SAAS;;AAPrD;;;;;;;sHAOsH;AAEtH;;;;;;;GAOG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EA4CjB;IAzCC;;;OAGG;IACH,iBAA+B;IAE/B;;;OAGG;IACH,wBAA6C;IAE7C;;;OAGG;IACH,kBAAiC;IAEjC;;;OAGG;IACH,eAA2B;IAE3B;;;OAGG;IACH,oBAAwC;IAExC;;;OAGG;IACH,sBAAyC;IAEzC;;;OAGG;IACH,uBAA2C;IAG7C;;;;OAIG;IACH,SAHY,UAAU,CAarB;IAED;;;;OAIG;IACH,cAHY,MAAM,CAKjB;IAED;;;;OAIG;IACH,qBAHY,OAAO,CAKlB;IAED;;;;OAIG;IACH,eAHY,MAAM,CAKjB;IAED;;;;OAIG;IACH,YAHY,MAAM,GAAC,OAAO,YAAY,EAAE,IAAI,CAK3C;IAED;;;OAGG;IACH,iBAFY,OAAO,YAAY,EAAE,IAAI,CAIpC;IAED;;;;OAIG;IACH,mBAHY,MAAM,MAAM,CAAC,CAKxB;IAED;;;;OAIG;IACH,oBAHY,WAAW,GAAC,UAAU,GAAC,MAAM,GAAC,SAAS,CAKlD;IAED;;;;;OAKG;IACH,aAFY,MAAM,MAAM,CAAC,CAIxB;IAED;;;;;OAKG;IACH,qBAHW,MAAM,GACL,iBAAiB,GAAC,gBAAgB,GAAC,gBAAgB,CAI9D;IAED;;;OAGG;IACH,wBAFY,iBAAiB,GAAC,gBAAgB,GAAC,gBAAgB,CAI9D;IAED;;;;OAIG;IACH,0BAHW,MAAM,GACL,MAAM,CAIjB;IAED;;;OAGG;IACH,qBAEC;IAED;;;OAGG;IACH,gBAFY,OAAO,YAAY,EAAE,IAAI,CAIpC;IAED;;;;OAIG;IACH,aAFY,MAAM,MAAM,CAAC,CAIxB;IAED;;;;OAIG;IACH,WAFY,OAAO,YAAY,EAAE,IAAI,CAIpC;IAED;;;;;OAKG;IACH,8BAHW,MAAM,MAAM,CAAC,QAKvB;IAED;;;;;OAKG;IACH,oBAHW,MAAM,QAKhB;IAED;;;;;OAKG;IACH,kCAHW,OAAO,QAKjB;IAED;;;;;OAKG;IACH,sBAHW,MAAM,QAKhB;IACD;;;;;OAKG;IACH,gBAHW,MAAM,GAAC,OAAO,YAAY,EAAE,IAAI,QAM1C;IAED;;;OAGG;IACH,mCAFoB,OAAO,oBAAoB,EAAE,OAAO,KAAG,IAAI,QAI9D;IAED;;;OAGG;IACH,aAEC;IAED;;;OAGG;IACH,qCAFoB,OAAO,oBAAoB,EAAE,OAAO,KAAG,IAAI,QAI9D;CACF"}
|
||||
267
node_modules/ol/style/Image.js
generated
vendored
Normal file
267
node_modules/ol/style/Image.js
generated
vendored
Normal file
@@ -0,0 +1,267 @@
|
||||
/**
|
||||
* @module ol/style/Image
|
||||
*/
|
||||
import { abstract } from '../util.js';
|
||||
import { toSize } from '../size.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {number} opacity Opacity.
|
||||
* @property {boolean} rotateWithView If the image should get rotated with the view.
|
||||
* @property {number} rotation Rotation.
|
||||
* @property {number|import("../size.js").Size} scale Scale.
|
||||
* @property {Array<number>} displacement Displacement.
|
||||
* @property {"declutter"|"obstacle"|"none"|undefined} declutterMode Declutter mode: `declutter`, `obstacle`, 'none */
|
||||
/**
|
||||
* @classdesc
|
||||
* A base class used for creating subclasses and not instantiated in
|
||||
* apps. Base class for {@link module:ol/style/Icon~Icon}, {@link module:ol/style/Circle~CircleStyle} and
|
||||
* {@link module:ol/style/RegularShape~RegularShape}.
|
||||
* @abstract
|
||||
* @api
|
||||
*/
|
||||
var ImageStyle = /** @class */ (function () {
|
||||
/**
|
||||
* @param {Options} options Options.
|
||||
*/
|
||||
function ImageStyle(options) {
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.opacity_ = options.opacity;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.rotateWithView_ = options.rotateWithView;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.rotation_ = options.rotation;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|import("../size.js").Size}
|
||||
*/
|
||||
this.scale_ = options.scale;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
this.scaleArray_ = toSize(options.scale);
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
this.displacement_ = options.displacement;
|
||||
/**
|
||||
* @private
|
||||
* @type {"declutter"|"obstacle"|"none"|undefined}
|
||||
*/
|
||||
this.declutterMode_ = options.declutterMode;
|
||||
}
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {ImageStyle} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
ImageStyle.prototype.clone = function () {
|
||||
var scale = this.getScale();
|
||||
return new ImageStyle({
|
||||
opacity: this.getOpacity(),
|
||||
scale: Array.isArray(scale) ? scale.slice() : scale,
|
||||
rotation: this.getRotation(),
|
||||
rotateWithView: this.getRotateWithView(),
|
||||
displacement: this.getDisplacement().slice(),
|
||||
declutterMode: this.getDeclutterMode(),
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Get the symbolizer opacity.
|
||||
* @return {number} Opacity.
|
||||
* @api
|
||||
*/
|
||||
ImageStyle.prototype.getOpacity = function () {
|
||||
return this.opacity_;
|
||||
};
|
||||
/**
|
||||
* Determine whether the symbolizer rotates with the map.
|
||||
* @return {boolean} Rotate with map.
|
||||
* @api
|
||||
*/
|
||||
ImageStyle.prototype.getRotateWithView = function () {
|
||||
return this.rotateWithView_;
|
||||
};
|
||||
/**
|
||||
* Get the symoblizer rotation.
|
||||
* @return {number} Rotation.
|
||||
* @api
|
||||
*/
|
||||
ImageStyle.prototype.getRotation = function () {
|
||||
return this.rotation_;
|
||||
};
|
||||
/**
|
||||
* Get the symbolizer scale.
|
||||
* @return {number|import("../size.js").Size} Scale.
|
||||
* @api
|
||||
*/
|
||||
ImageStyle.prototype.getScale = function () {
|
||||
return this.scale_;
|
||||
};
|
||||
/**
|
||||
* Get the symbolizer scale array.
|
||||
* @return {import("../size.js").Size} Scale array.
|
||||
*/
|
||||
ImageStyle.prototype.getScaleArray = function () {
|
||||
return this.scaleArray_;
|
||||
};
|
||||
/**
|
||||
* Get the displacement of the shape
|
||||
* @return {Array<number>} Shape's center displacement
|
||||
* @api
|
||||
*/
|
||||
ImageStyle.prototype.getDisplacement = function () {
|
||||
return this.displacement_;
|
||||
};
|
||||
/**
|
||||
* Get the declutter mode of the shape
|
||||
* @return {"declutter"|"obstacle"|"none"|undefined} Shape's declutter mode
|
||||
* @api
|
||||
*/
|
||||
ImageStyle.prototype.getDeclutterMode = function () {
|
||||
return this.declutterMode_;
|
||||
};
|
||||
/**
|
||||
* Get the anchor point in pixels. The anchor determines the center point for the
|
||||
* symbolizer.
|
||||
* @abstract
|
||||
* @return {Array<number>} Anchor.
|
||||
*/
|
||||
ImageStyle.prototype.getAnchor = function () {
|
||||
return abstract();
|
||||
};
|
||||
/**
|
||||
* Get the image element for the symbolizer.
|
||||
* @abstract
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
|
||||
*/
|
||||
ImageStyle.prototype.getImage = function (pixelRatio) {
|
||||
return abstract();
|
||||
};
|
||||
/**
|
||||
* @abstract
|
||||
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
|
||||
*/
|
||||
ImageStyle.prototype.getHitDetectionImage = function () {
|
||||
return abstract();
|
||||
};
|
||||
/**
|
||||
* Get the image pixel ratio.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {number} Pixel ratio.
|
||||
*/
|
||||
ImageStyle.prototype.getPixelRatio = function (pixelRatio) {
|
||||
return 1;
|
||||
};
|
||||
/**
|
||||
* @abstract
|
||||
* @return {import("../ImageState.js").default} Image state.
|
||||
*/
|
||||
ImageStyle.prototype.getImageState = function () {
|
||||
return abstract();
|
||||
};
|
||||
/**
|
||||
* @abstract
|
||||
* @return {import("../size.js").Size} Image size.
|
||||
*/
|
||||
ImageStyle.prototype.getImageSize = function () {
|
||||
return abstract();
|
||||
};
|
||||
/**
|
||||
* Get the origin of the symbolizer.
|
||||
* @abstract
|
||||
* @return {Array<number>} Origin.
|
||||
*/
|
||||
ImageStyle.prototype.getOrigin = function () {
|
||||
return abstract();
|
||||
};
|
||||
/**
|
||||
* Get the size of the symbolizer (in pixels).
|
||||
* @abstract
|
||||
* @return {import("../size.js").Size} Size.
|
||||
*/
|
||||
ImageStyle.prototype.getSize = function () {
|
||||
return abstract();
|
||||
};
|
||||
/**
|
||||
* Set the displacement.
|
||||
*
|
||||
* @param {Array<number>} displacement Displacement.
|
||||
* @api
|
||||
*/
|
||||
ImageStyle.prototype.setDisplacement = function (displacement) {
|
||||
this.displacement_ = displacement;
|
||||
};
|
||||
/**
|
||||
* Set the opacity.
|
||||
*
|
||||
* @param {number} opacity Opacity.
|
||||
* @api
|
||||
*/
|
||||
ImageStyle.prototype.setOpacity = function (opacity) {
|
||||
this.opacity_ = opacity;
|
||||
};
|
||||
/**
|
||||
* Set whether to rotate the style with the view.
|
||||
*
|
||||
* @param {boolean} rotateWithView Rotate with map.
|
||||
* @api
|
||||
*/
|
||||
ImageStyle.prototype.setRotateWithView = function (rotateWithView) {
|
||||
this.rotateWithView_ = rotateWithView;
|
||||
};
|
||||
/**
|
||||
* Set the rotation.
|
||||
*
|
||||
* @param {number} rotation Rotation.
|
||||
* @api
|
||||
*/
|
||||
ImageStyle.prototype.setRotation = function (rotation) {
|
||||
this.rotation_ = rotation;
|
||||
};
|
||||
/**
|
||||
* Set the scale.
|
||||
*
|
||||
* @param {number|import("../size.js").Size} scale Scale.
|
||||
* @api
|
||||
*/
|
||||
ImageStyle.prototype.setScale = function (scale) {
|
||||
this.scale_ = scale;
|
||||
this.scaleArray_ = toSize(scale);
|
||||
};
|
||||
/**
|
||||
* @abstract
|
||||
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
||||
*/
|
||||
ImageStyle.prototype.listenImageChange = function (listener) {
|
||||
abstract();
|
||||
};
|
||||
/**
|
||||
* Load not yet loaded URI.
|
||||
* @abstract
|
||||
*/
|
||||
ImageStyle.prototype.load = function () {
|
||||
abstract();
|
||||
};
|
||||
/**
|
||||
* @abstract
|
||||
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
||||
*/
|
||||
ImageStyle.prototype.unlistenImageChange = function (listener) {
|
||||
abstract();
|
||||
};
|
||||
return ImageStyle;
|
||||
}());
|
||||
export default ImageStyle;
|
||||
//# sourceMappingURL=Image.js.map
|
||||
1
node_modules/ol/style/Image.js.map
generated
vendored
Normal file
1
node_modules/ol/style/Image.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../src/style/Image.js"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,YAAY,CAAC;AAElC;;;;;;;sHAOsH;AAEtH;;;;;;;GAOG;AACH;IACE;;OAEG;IACH,oBAAY,OAAO;QACjB;;;WAGG;QACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;QAEhC;;;WAGG;QACH,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;QAE9C;;;WAGG;QACH,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC;QAElC;;;WAGG;QACH,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;QAE5B;;;WAGG;QACH,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAEzC;;;WAGG;QACH,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;QAE1C;;;WAGG;QACH,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACH,0BAAK,GAAL;QACE,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,UAAU,CAAC;YACpB,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE;YAC1B,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK;YACnD,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE;YAC5B,cAAc,EAAE,IAAI,CAAC,iBAAiB,EAAE;YACxC,YAAY,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE;YAC5C,aAAa,EAAE,IAAI,CAAC,gBAAgB,EAAE;SACvC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,+BAAU,GAAV;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,sCAAiB,GAAjB;QACE,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,gCAAW,GAAX;QACE,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,6BAAQ,GAAR;QACE,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,kCAAa,GAAb;QACE,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,oCAAe,GAAf;QACE,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,qCAAgB,GAAhB;QACE,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACH,8BAAS,GAAT;QACE,OAAO,QAAQ,EAAE,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,6BAAQ,GAAR,UAAS,UAAU;QACjB,OAAO,QAAQ,EAAE,CAAC;IACpB,CAAC;IAED;;;OAGG;IACH,yCAAoB,GAApB;QACE,OAAO,QAAQ,EAAE,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,kCAAa,GAAb,UAAc,UAAU;QACtB,OAAO,CAAC,CAAC;IACX,CAAC;IAED;;;OAGG;IACH,kCAAa,GAAb;QACE,OAAO,QAAQ,EAAE,CAAC;IACpB,CAAC;IAED;;;OAGG;IACH,iCAAY,GAAZ;QACE,OAAO,QAAQ,EAAE,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,8BAAS,GAAT;QACE,OAAO,QAAQ,EAAE,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,4BAAO,GAAP;QACE,OAAO,QAAQ,EAAE,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,oCAAe,GAAf,UAAgB,YAAY;QAC1B,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IACH,+BAAU,GAAV,UAAW,OAAO;QAChB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACH,sCAAiB,GAAjB,UAAkB,cAAc;QAC9B,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACH,gCAAW,GAAX,UAAY,QAAQ;QAClB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IACD;;;;;OAKG;IACH,6BAAQ,GAAR,UAAS,KAAK;QACZ,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,sCAAiB,GAAjB,UAAkB,QAAQ;QACxB,QAAQ,EAAE,CAAC;IACb,CAAC;IAED;;;OAGG;IACH,yBAAI,GAAJ;QACE,QAAQ,EAAE,CAAC;IACb,CAAC;IAED;;;OAGG;IACH,wCAAmB,GAAnB,UAAoB,QAAQ;QAC1B,QAAQ,EAAE,CAAC;IACb,CAAC;IACH,iBAAC;AAAD,CAAC,AA/QD,IA+QC;AAED,eAAe,UAAU,CAAC"}
|
||||
290
node_modules/ol/style/RegularShape.d.ts
generated
vendored
Normal file
290
node_modules/ol/style/RegularShape.d.ts
generated
vendored
Normal file
@@ -0,0 +1,290 @@
|
||||
export default RegularShape;
|
||||
/**
|
||||
* Specify radius for regular polygons, or radius1 and radius2 for stars.
|
||||
*/
|
||||
export type Options = {
|
||||
/**
|
||||
* Fill style.
|
||||
*/
|
||||
fill?: import("./Fill.js").default | undefined;
|
||||
/**
|
||||
* Number of points for stars and regular polygons. In case of a polygon, the number of points
|
||||
* is the number of sides.
|
||||
*/
|
||||
points: number;
|
||||
/**
|
||||
* Radius of a regular polygon.
|
||||
*/
|
||||
radius?: number | undefined;
|
||||
/**
|
||||
* First radius of a star. Ignored if radius is set.
|
||||
*/
|
||||
radius1?: number | undefined;
|
||||
/**
|
||||
* Second radius of a star.
|
||||
*/
|
||||
radius2?: number | undefined;
|
||||
/**
|
||||
* Shape's angle in radians. A value of 0 will have one of the shape's point facing up.
|
||||
*/
|
||||
angle?: number | undefined;
|
||||
/**
|
||||
* Displacement of the shape
|
||||
*/
|
||||
displacement?: number[] | undefined;
|
||||
/**
|
||||
* Stroke style.
|
||||
*/
|
||||
stroke?: import("./Stroke.js").default | undefined;
|
||||
/**
|
||||
* Rotation in radians (positive rotation clockwise).
|
||||
*/
|
||||
rotation?: number | undefined;
|
||||
/**
|
||||
* Whether to rotate the shape with the view.
|
||||
*/
|
||||
rotateWithView?: boolean | undefined;
|
||||
/**
|
||||
* Scale. Unless two dimensional scaling is required a better
|
||||
* result may be obtained with appropriate settings for `radius`, `radius1` and `radius2`.
|
||||
*/
|
||||
scale?: number | import("../size.js").Size | undefined;
|
||||
/**
|
||||
* Declutter mode
|
||||
*/
|
||||
declutterMode?: "declutter" | "obstacle" | "none" | undefined;
|
||||
};
|
||||
export type RenderOptions = {
|
||||
/**
|
||||
* StrokeStyle.
|
||||
*/
|
||||
strokeStyle?: import("../colorlike.js").ColorLike | undefined;
|
||||
/**
|
||||
* StrokeWidth.
|
||||
*/
|
||||
strokeWidth: number;
|
||||
/**
|
||||
* Size.
|
||||
*/
|
||||
size: number;
|
||||
/**
|
||||
* LineDash.
|
||||
*/
|
||||
lineDash: Array<number>;
|
||||
/**
|
||||
* LineDashOffset.
|
||||
*/
|
||||
lineDashOffset: number;
|
||||
/**
|
||||
* LineJoin.
|
||||
*/
|
||||
lineJoin: CanvasLineJoin;
|
||||
/**
|
||||
* MiterLimit.
|
||||
*/
|
||||
miterLimit: number;
|
||||
};
|
||||
/**
|
||||
* Specify radius for regular polygons, or radius1 and radius2 for stars.
|
||||
* @typedef {Object} Options
|
||||
* @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] First radius of a star. Ignored if radius is set.
|
||||
* @property {number} [radius2] Second 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 {Array<number>} [displacement=[0,0]] Displacement of the shape
|
||||
* @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 {number|import("../size.js").Size} [scale=1] Scale. Unless two dimensional scaling is required a better
|
||||
* result may be obtained with appropriate settings for `radius`, `radius1` and `radius2`.
|
||||
* @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} RenderOptions
|
||||
* @property {import("../colorlike.js").ColorLike} [strokeStyle] StrokeStyle.
|
||||
* @property {number} strokeWidth StrokeWidth.
|
||||
* @property {number} size Size.
|
||||
* @property {Array<number>} lineDash LineDash.
|
||||
* @property {number} lineDashOffset LineDashOffset.
|
||||
* @property {CanvasLineJoin} lineJoin LineJoin.
|
||||
* @property {number} miterLimit MiterLimit.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Set regular shape style for vector features. The resulting shape will be
|
||||
* a regular polygon when `radius` is provided, or a star when `radius1` and
|
||||
* `radius2` are provided.
|
||||
* @api
|
||||
*/
|
||||
declare class RegularShape extends ImageStyle {
|
||||
/**
|
||||
* @param {Options} options Options.
|
||||
*/
|
||||
constructor(options: Options);
|
||||
/**
|
||||
* @private
|
||||
* @type {Object<number, HTMLCanvasElement>}
|
||||
*/
|
||||
private canvas_;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLCanvasElement}
|
||||
*/
|
||||
private hitDetectionCanvas_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Fill.js").default}
|
||||
*/
|
||||
private fill_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
private origin_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private points_;
|
||||
/**
|
||||
* @protected
|
||||
* @type {number}
|
||||
*/
|
||||
protected radius_: number;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private radius2_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private angle_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Stroke.js").default}
|
||||
*/
|
||||
private stroke_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
private size_;
|
||||
/**
|
||||
* @private
|
||||
* @type {RenderOptions}
|
||||
*/
|
||||
private renderOptions_;
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {RegularShape} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
clone(): RegularShape;
|
||||
/**
|
||||
* Get the angle used in generating the shape.
|
||||
* @return {number} Shape's rotation in radians.
|
||||
* @api
|
||||
*/
|
||||
getAngle(): number;
|
||||
/**
|
||||
* Get the fill style for the shape.
|
||||
* @return {import("./Fill.js").default} Fill style.
|
||||
* @api
|
||||
*/
|
||||
getFill(): import("./Fill.js").default;
|
||||
/**
|
||||
* Set the fill style.
|
||||
* @param {import("./Fill.js").default} fill Fill style.
|
||||
* @api
|
||||
*/
|
||||
setFill(fill: import("./Fill.js").default): void;
|
||||
/**
|
||||
* @return {HTMLCanvasElement} Image element.
|
||||
*/
|
||||
getHitDetectionImage(): HTMLCanvasElement;
|
||||
/**
|
||||
* Get the image icon.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {HTMLCanvasElement} Image or Canvas element.
|
||||
* @api
|
||||
*/
|
||||
getImage(pixelRatio: number): HTMLCanvasElement;
|
||||
/**
|
||||
* Get the number of points for generating the shape.
|
||||
* @return {number} Number of points for stars and regular polygons.
|
||||
* @api
|
||||
*/
|
||||
getPoints(): number;
|
||||
/**
|
||||
* Get the (primary) radius for the shape.
|
||||
* @return {number} Radius.
|
||||
* @api
|
||||
*/
|
||||
getRadius(): number;
|
||||
/**
|
||||
* Get the secondary radius for the shape.
|
||||
* @return {number|undefined} Radius2.
|
||||
* @api
|
||||
*/
|
||||
getRadius2(): number | undefined;
|
||||
/**
|
||||
* Get the stroke style for the shape.
|
||||
* @return {import("./Stroke.js").default} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
getStroke(): import("./Stroke.js").default;
|
||||
/**
|
||||
* Set the stroke style.
|
||||
* @param {import("./Stroke.js").default} stroke Stroke style.
|
||||
* @api
|
||||
*/
|
||||
setStroke(stroke: import("./Stroke.js").default): void;
|
||||
/**
|
||||
* Calculate additional canvas size needed for the miter.
|
||||
* @param {string} lineJoin Line join
|
||||
* @param {number} strokeWidth Stroke width
|
||||
* @param {number} miterLimit Miter limit
|
||||
* @return {number} Additional canvas size needed
|
||||
* @private
|
||||
*/
|
||||
private calculateLineJoinSize_;
|
||||
/**
|
||||
* @return {RenderOptions} The render options
|
||||
* @protected
|
||||
*/
|
||||
protected createRenderOptions(): RenderOptions;
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
protected render(): void;
|
||||
/**
|
||||
* @private
|
||||
* @param {RenderOptions} renderOptions Render options.
|
||||
* @param {CanvasRenderingContext2D} context The rendering context.
|
||||
* @param {number} pixelRatio The pixel ratio.
|
||||
*/
|
||||
private draw_;
|
||||
/**
|
||||
* @private
|
||||
* @param {RenderOptions} renderOptions Render options.
|
||||
*/
|
||||
private createHitDetectionCanvas_;
|
||||
/**
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} context The context to draw in.
|
||||
*/
|
||||
private createPath_;
|
||||
/**
|
||||
* @private
|
||||
* @param {RenderOptions} renderOptions Render options.
|
||||
* @param {CanvasRenderingContext2D} context The context.
|
||||
*/
|
||||
private drawHitDetectionCanvas_;
|
||||
}
|
||||
import ImageStyle from "./Image.js";
|
||||
//# sourceMappingURL=RegularShape.d.ts.map
|
||||
1
node_modules/ol/style/RegularShape.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/RegularShape.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"RegularShape.d.ts","sourceRoot":"","sources":["../src/style/RegularShape.js"],"names":[],"mappings":";;;;;;;;;;;;;YAqBc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAYN,WAAW,GAAC,UAAU,GAAC,MAAM,GAAC,SAAS;;;;;;;;;;iBAMvC,MAAM;;;;UACN,MAAM;;;;cACN,MAAM,MAAM,CAAC;;;;oBACb,MAAM;;;;cACN,cAAc;;;;gBACd,MAAM;;AA3BpB;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;GASG;AAEH;;;;;;GAMG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAuFjB;IApEC;;;OAGG;IACH,gBAAwB;IAExB;;;OAGG;IACH,4BAA+B;IAE/B;;;OAGG;IACH,cAA6D;IAE7D;;;OAGG;IACH,gBAAqB;IAErB;;;OAGG;IACH,gBAA6B;IAE7B;;;OAGG;IACH,mBAFU,MAAM,CAGiD;IAEjE;;;OAGG;IACH,iBAA+B;IAE/B;;;OAGG;IACH,eAA6D;IAE7D;;;OAGG;IACH,gBAAmE;IAEnE;;;OAGG;IACH,cAAiB;IAEjB;;;OAGG;IACH,uBAA0B;IAK5B;;;;OAIG;IACH,SAHY,YAAY,CAoBvB;IAiBD;;;;OAIG;IACH,YAHY,MAAM,CAKjB;IAED;;;;OAIG;IACH,WAHY,OAAO,WAAW,EAAE,OAAO,CAKtC;IAED;;;;OAIG;IACH,cAHW,OAAO,WAAW,EAAE,OAAO,QAMrC;IAED;;OAEG;IACH,wBAFY,iBAAiB,CAO5B;IAED;;;;;OAKG;IACH,qBAJW,MAAM,GACL,iBAAiB,CAiB5B;IAkCD;;;;OAIG;IACH,aAHY,MAAM,CAKjB;IAED;;;;OAIG;IACH,aAHY,MAAM,CAKjB;IAED;;;;OAIG;IACH,cAHY,MAAM,GAAC,SAAS,CAK3B;IAWD;;;;OAIG;IACH,aAHY,OAAO,aAAa,EAAE,OAAO,CAKxC;IAED;;;;OAIG;IACH,kBAHW,OAAO,aAAa,EAAE,OAAO,QAMvC;IAiBD;;;;;;;OAOG;IACH,+BAgFC;IAED;;;OAGG;IACH,iCAHY,aAAa,CA8CxB;IAED;;OAEG;IACH,yBAKC;IAED;;;;;OAKG;IACH,cA0BC;IAED;;;OAGG;IACH,kCA6BC;IAED;;;OAGG;IACH,oBAmBC;IAED;;;;OAIG;IACH,gCAmBC;CACF"}
|
||||
567
node_modules/ol/style/RegularShape.js
generated
vendored
Normal file
567
node_modules/ol/style/RegularShape.js
generated
vendored
Normal file
@@ -0,0 +1,567 @@
|
||||
/**
|
||||
* @module ol/style/RegularShape
|
||||
*/
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
import ImageState from '../ImageState.js';
|
||||
import ImageStyle from './Image.js';
|
||||
import { asArray } from '../color.js';
|
||||
import { asColorLike } from '../colorlike.js';
|
||||
import { createCanvasContext2D } from '../dom.js';
|
||||
import { defaultFillStyle, defaultLineJoin, defaultLineWidth, defaultMiterLimit, defaultStrokeStyle, } from '../render/canvas.js';
|
||||
/**
|
||||
* Specify radius for regular polygons, or radius1 and radius2 for stars.
|
||||
* @typedef {Object} Options
|
||||
* @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] First radius of a star. Ignored if radius is set.
|
||||
* @property {number} [radius2] Second 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 {Array<number>} [displacement=[0,0]] Displacement of the shape
|
||||
* @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 {number|import("../size.js").Size} [scale=1] Scale. Unless two dimensional scaling is required a better
|
||||
* result may be obtained with appropriate settings for `radius`, `radius1` and `radius2`.
|
||||
* @property {"declutter"|"obstacle"|"none"|undefined} [declutterMode] Declutter mode
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} RenderOptions
|
||||
* @property {import("../colorlike.js").ColorLike} [strokeStyle] StrokeStyle.
|
||||
* @property {number} strokeWidth StrokeWidth.
|
||||
* @property {number} size Size.
|
||||
* @property {Array<number>} lineDash LineDash.
|
||||
* @property {number} lineDashOffset LineDashOffset.
|
||||
* @property {CanvasLineJoin} lineJoin LineJoin.
|
||||
* @property {number} miterLimit MiterLimit.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Set regular shape style for vector features. The resulting shape will be
|
||||
* a regular polygon when `radius` is provided, or a star when `radius1` and
|
||||
* `radius2` are provided.
|
||||
* @api
|
||||
*/
|
||||
var RegularShape = /** @class */ (function (_super) {
|
||||
__extends(RegularShape, _super);
|
||||
/**
|
||||
* @param {Options} options Options.
|
||||
*/
|
||||
function RegularShape(options) {
|
||||
var _this = this;
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
var rotateWithView = options.rotateWithView !== undefined ? options.rotateWithView : false;
|
||||
_this = _super.call(this, {
|
||||
opacity: 1,
|
||||
rotateWithView: rotateWithView,
|
||||
rotation: options.rotation !== undefined ? options.rotation : 0,
|
||||
scale: options.scale !== undefined ? options.scale : 1,
|
||||
displacement: options.displacement !== undefined ? options.displacement : [0, 0],
|
||||
declutterMode: options.declutterMode,
|
||||
}) || this;
|
||||
/**
|
||||
* @private
|
||||
* @type {Object<number, HTMLCanvasElement>}
|
||||
*/
|
||||
_this.canvas_ = undefined;
|
||||
/**
|
||||
* @private
|
||||
* @type {HTMLCanvasElement}
|
||||
*/
|
||||
_this.hitDetectionCanvas_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Fill.js").default}
|
||||
*/
|
||||
_this.fill_ = options.fill !== undefined ? options.fill : null;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
_this.origin_ = [0, 0];
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.points_ = options.points;
|
||||
/**
|
||||
* @protected
|
||||
* @type {number}
|
||||
*/
|
||||
_this.radius_ =
|
||||
options.radius !== undefined ? options.radius : options.radius1;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
_this.radius2_ = options.radius2;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
_this.angle_ = options.angle !== undefined ? options.angle : 0;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Stroke.js").default}
|
||||
*/
|
||||
_this.stroke_ = options.stroke !== undefined ? options.stroke : null;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
_this.size_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {RenderOptions}
|
||||
*/
|
||||
_this.renderOptions_ = null;
|
||||
_this.render();
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {RegularShape} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.clone = function () {
|
||||
var scale = this.getScale();
|
||||
var style = new RegularShape({
|
||||
fill: this.getFill() ? this.getFill().clone() : undefined,
|
||||
points: this.getPoints(),
|
||||
radius: this.getRadius(),
|
||||
radius2: this.getRadius2(),
|
||||
angle: this.getAngle(),
|
||||
stroke: this.getStroke() ? this.getStroke().clone() : undefined,
|
||||
rotation: this.getRotation(),
|
||||
rotateWithView: this.getRotateWithView(),
|
||||
scale: Array.isArray(scale) ? scale.slice() : scale,
|
||||
displacement: this.getDisplacement().slice(),
|
||||
declutterMode: this.getDeclutterMode(),
|
||||
});
|
||||
style.setOpacity(this.getOpacity());
|
||||
return style;
|
||||
};
|
||||
/**
|
||||
* Get the anchor point in pixels. The anchor determines the center point for the
|
||||
* symbolizer.
|
||||
* @return {Array<number>} Anchor.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.getAnchor = function () {
|
||||
var size = this.size_;
|
||||
if (!size) {
|
||||
return null;
|
||||
}
|
||||
var displacement = this.getDisplacement();
|
||||
return [size[0] / 2 - displacement[0], size[1] / 2 + displacement[1]];
|
||||
};
|
||||
/**
|
||||
* Get the angle used in generating the shape.
|
||||
* @return {number} Shape's rotation in radians.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.getAngle = function () {
|
||||
return this.angle_;
|
||||
};
|
||||
/**
|
||||
* Get the fill style for the shape.
|
||||
* @return {import("./Fill.js").default} Fill style.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.getFill = function () {
|
||||
return this.fill_;
|
||||
};
|
||||
/**
|
||||
* Set the fill style.
|
||||
* @param {import("./Fill.js").default} fill Fill style.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.setFill = function (fill) {
|
||||
this.fill_ = fill;
|
||||
this.render();
|
||||
};
|
||||
/**
|
||||
* @return {HTMLCanvasElement} Image element.
|
||||
*/
|
||||
RegularShape.prototype.getHitDetectionImage = function () {
|
||||
if (!this.hitDetectionCanvas_) {
|
||||
this.createHitDetectionCanvas_(this.renderOptions_);
|
||||
}
|
||||
return this.hitDetectionCanvas_;
|
||||
};
|
||||
/**
|
||||
* Get the image icon.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {HTMLCanvasElement} Image or Canvas element.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.getImage = function (pixelRatio) {
|
||||
var image = this.canvas_[pixelRatio];
|
||||
if (!image) {
|
||||
var renderOptions = this.renderOptions_;
|
||||
var context = createCanvasContext2D(renderOptions.size * pixelRatio, renderOptions.size * pixelRatio);
|
||||
this.draw_(renderOptions, context, pixelRatio);
|
||||
image = context.canvas;
|
||||
this.canvas_[pixelRatio] = image;
|
||||
}
|
||||
return image;
|
||||
};
|
||||
/**
|
||||
* Get the image pixel ratio.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {number} Pixel ratio.
|
||||
*/
|
||||
RegularShape.prototype.getPixelRatio = function (pixelRatio) {
|
||||
return pixelRatio;
|
||||
};
|
||||
/**
|
||||
* @return {import("../size.js").Size} Image size.
|
||||
*/
|
||||
RegularShape.prototype.getImageSize = function () {
|
||||
return this.size_;
|
||||
};
|
||||
/**
|
||||
* @return {import("../ImageState.js").default} Image state.
|
||||
*/
|
||||
RegularShape.prototype.getImageState = function () {
|
||||
return ImageState.LOADED;
|
||||
};
|
||||
/**
|
||||
* Get the origin of the symbolizer.
|
||||
* @return {Array<number>} Origin.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.getOrigin = function () {
|
||||
return this.origin_;
|
||||
};
|
||||
/**
|
||||
* Get the number of points for generating the shape.
|
||||
* @return {number} Number of points for stars and regular polygons.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.getPoints = function () {
|
||||
return this.points_;
|
||||
};
|
||||
/**
|
||||
* Get the (primary) radius for the shape.
|
||||
* @return {number} Radius.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.getRadius = function () {
|
||||
return this.radius_;
|
||||
};
|
||||
/**
|
||||
* Get the secondary radius for the shape.
|
||||
* @return {number|undefined} Radius2.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.getRadius2 = function () {
|
||||
return this.radius2_;
|
||||
};
|
||||
/**
|
||||
* Get the size of the symbolizer (in pixels).
|
||||
* @return {import("../size.js").Size} Size.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.getSize = function () {
|
||||
return this.size_;
|
||||
};
|
||||
/**
|
||||
* Get the stroke style for the shape.
|
||||
* @return {import("./Stroke.js").default} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.getStroke = function () {
|
||||
return this.stroke_;
|
||||
};
|
||||
/**
|
||||
* Set the stroke style.
|
||||
* @param {import("./Stroke.js").default} stroke Stroke style.
|
||||
* @api
|
||||
*/
|
||||
RegularShape.prototype.setStroke = function (stroke) {
|
||||
this.stroke_ = stroke;
|
||||
this.render();
|
||||
};
|
||||
/**
|
||||
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
||||
*/
|
||||
RegularShape.prototype.listenImageChange = function (listener) { };
|
||||
/**
|
||||
* Load not yet loaded URI.
|
||||
*/
|
||||
RegularShape.prototype.load = function () { };
|
||||
/**
|
||||
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
||||
*/
|
||||
RegularShape.prototype.unlistenImageChange = function (listener) { };
|
||||
/**
|
||||
* Calculate additional canvas size needed for the miter.
|
||||
* @param {string} lineJoin Line join
|
||||
* @param {number} strokeWidth Stroke width
|
||||
* @param {number} miterLimit Miter limit
|
||||
* @return {number} Additional canvas size needed
|
||||
* @private
|
||||
*/
|
||||
RegularShape.prototype.calculateLineJoinSize_ = function (lineJoin, strokeWidth, miterLimit) {
|
||||
if (strokeWidth === 0 ||
|
||||
this.points_ === Infinity ||
|
||||
(lineJoin !== 'bevel' && lineJoin !== 'miter')) {
|
||||
return strokeWidth;
|
||||
}
|
||||
// m | ^
|
||||
// i | |\ .
|
||||
// t >| #\
|
||||
// e | |\ \ .
|
||||
// r \s\
|
||||
// | \t\ . .
|
||||
// \r\ . .
|
||||
// | \o\ . . . . .
|
||||
// e \k\ . . . .
|
||||
// | \e\ . . . . .
|
||||
// d \ \ . . . .
|
||||
// | _ _a_ _\# . . .
|
||||
// r1 / ` . .
|
||||
// | . .
|
||||
// b / . .
|
||||
// | . .
|
||||
// / r2 . .
|
||||
// | . .
|
||||
// / . .
|
||||
// |α . .
|
||||
// / . .
|
||||
// ° center
|
||||
var r1 = this.radius_;
|
||||
var r2 = this.radius2_ === undefined ? r1 : this.radius2_;
|
||||
if (r1 < r2) {
|
||||
var tmp = r1;
|
||||
r1 = r2;
|
||||
r2 = tmp;
|
||||
}
|
||||
var points = this.radius2_ === undefined ? this.points_ : this.points_ * 2;
|
||||
var alpha = (2 * Math.PI) / points;
|
||||
var a = r2 * Math.sin(alpha);
|
||||
var b = Math.sqrt(r2 * r2 - a * a);
|
||||
var d = r1 - b;
|
||||
var e = Math.sqrt(a * a + d * d);
|
||||
var miterRatio = e / a;
|
||||
if (lineJoin === 'miter' && miterRatio <= miterLimit) {
|
||||
return miterRatio * strokeWidth;
|
||||
}
|
||||
// Calculate the distnce from center to the stroke corner where
|
||||
// it was cut short because of the miter limit.
|
||||
// l
|
||||
// ----+---- <= distance from center to here is maxr
|
||||
// /####|k ##\
|
||||
// /#####^#####\
|
||||
// /#### /+\# s #\
|
||||
// /### h/+++\# t #\
|
||||
// /### t/+++++\# r #\
|
||||
// /### a/+++++++\# o #\
|
||||
// /### p/++ fill +\# k #\
|
||||
///#### /+++++^+++++\# e #\
|
||||
//#####/+++++/+\+++++\#####\
|
||||
var k = strokeWidth / 2 / miterRatio;
|
||||
var l = (strokeWidth / 2) * (d / e);
|
||||
var maxr = Math.sqrt((r1 + k) * (r1 + k) + l * l);
|
||||
var bevelAdd = maxr - r1;
|
||||
if (this.radius2_ === undefined || lineJoin === 'bevel') {
|
||||
return bevelAdd * 2;
|
||||
}
|
||||
// If outer miter is over the miter limit the inner miter may reach through the
|
||||
// center and be longer than the bevel, same calculation as above but swap r1 / r2.
|
||||
var aa = r1 * Math.sin(alpha);
|
||||
var bb = Math.sqrt(r1 * r1 - aa * aa);
|
||||
var dd = r2 - bb;
|
||||
var ee = Math.sqrt(aa * aa + dd * dd);
|
||||
var innerMiterRatio = ee / aa;
|
||||
if (innerMiterRatio <= miterLimit) {
|
||||
var innerLength = (innerMiterRatio * strokeWidth) / 2 - r2 - r1;
|
||||
return 2 * Math.max(bevelAdd, innerLength);
|
||||
}
|
||||
return bevelAdd * 2;
|
||||
};
|
||||
/**
|
||||
* @return {RenderOptions} The render options
|
||||
* @protected
|
||||
*/
|
||||
RegularShape.prototype.createRenderOptions = function () {
|
||||
var lineJoin = defaultLineJoin;
|
||||
var miterLimit = 0;
|
||||
var lineDash = null;
|
||||
var lineDashOffset = 0;
|
||||
var strokeStyle;
|
||||
var strokeWidth = 0;
|
||||
if (this.stroke_) {
|
||||
strokeStyle = this.stroke_.getColor();
|
||||
if (strokeStyle === null) {
|
||||
strokeStyle = defaultStrokeStyle;
|
||||
}
|
||||
strokeStyle = asColorLike(strokeStyle);
|
||||
strokeWidth = this.stroke_.getWidth();
|
||||
if (strokeWidth === undefined) {
|
||||
strokeWidth = defaultLineWidth;
|
||||
}
|
||||
lineDash = this.stroke_.getLineDash();
|
||||
lineDashOffset = this.stroke_.getLineDashOffset();
|
||||
lineJoin = this.stroke_.getLineJoin();
|
||||
if (lineJoin === undefined) {
|
||||
lineJoin = defaultLineJoin;
|
||||
}
|
||||
miterLimit = this.stroke_.getMiterLimit();
|
||||
if (miterLimit === undefined) {
|
||||
miterLimit = defaultMiterLimit;
|
||||
}
|
||||
}
|
||||
var add = this.calculateLineJoinSize_(lineJoin, strokeWidth, miterLimit);
|
||||
var maxRadius = Math.max(this.radius_, this.radius2_ || 0);
|
||||
var size = Math.ceil(2 * maxRadius + add);
|
||||
return {
|
||||
strokeStyle: strokeStyle,
|
||||
strokeWidth: strokeWidth,
|
||||
size: size,
|
||||
lineDash: lineDash,
|
||||
lineDashOffset: lineDashOffset,
|
||||
lineJoin: lineJoin,
|
||||
miterLimit: miterLimit,
|
||||
};
|
||||
};
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
RegularShape.prototype.render = function () {
|
||||
this.renderOptions_ = this.createRenderOptions();
|
||||
var size = this.renderOptions_.size;
|
||||
this.canvas_ = {};
|
||||
this.size_ = [size, size];
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @param {RenderOptions} renderOptions Render options.
|
||||
* @param {CanvasRenderingContext2D} context The rendering context.
|
||||
* @param {number} pixelRatio The pixel ratio.
|
||||
*/
|
||||
RegularShape.prototype.draw_ = function (renderOptions, context, pixelRatio) {
|
||||
context.scale(pixelRatio, pixelRatio);
|
||||
// set origin to canvas center
|
||||
context.translate(renderOptions.size / 2, renderOptions.size / 2);
|
||||
this.createPath_(context);
|
||||
if (this.fill_) {
|
||||
var color = this.fill_.getColor();
|
||||
if (color === null) {
|
||||
color = defaultFillStyle;
|
||||
}
|
||||
context.fillStyle = asColorLike(color);
|
||||
context.fill();
|
||||
}
|
||||
if (this.stroke_) {
|
||||
context.strokeStyle = renderOptions.strokeStyle;
|
||||
context.lineWidth = renderOptions.strokeWidth;
|
||||
if (context.setLineDash && renderOptions.lineDash) {
|
||||
context.setLineDash(renderOptions.lineDash);
|
||||
context.lineDashOffset = renderOptions.lineDashOffset;
|
||||
}
|
||||
context.lineJoin = renderOptions.lineJoin;
|
||||
context.miterLimit = renderOptions.miterLimit;
|
||||
context.stroke();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @param {RenderOptions} renderOptions Render options.
|
||||
*/
|
||||
RegularShape.prototype.createHitDetectionCanvas_ = function (renderOptions) {
|
||||
if (this.fill_) {
|
||||
var color = this.fill_.getColor();
|
||||
// determine if fill is transparent (or pattern or gradient)
|
||||
var opacity = 0;
|
||||
if (typeof color === 'string') {
|
||||
color = asArray(color);
|
||||
}
|
||||
if (color === null) {
|
||||
opacity = 1;
|
||||
}
|
||||
else if (Array.isArray(color)) {
|
||||
opacity = color.length === 4 ? color[3] : 1;
|
||||
}
|
||||
if (opacity === 0) {
|
||||
// if a transparent fill style is set, create an extra hit-detection image
|
||||
// with a default fill style
|
||||
var context = createCanvasContext2D(renderOptions.size, renderOptions.size);
|
||||
this.hitDetectionCanvas_ = context.canvas;
|
||||
this.drawHitDetectionCanvas_(renderOptions, context);
|
||||
}
|
||||
}
|
||||
if (!this.hitDetectionCanvas_) {
|
||||
this.hitDetectionCanvas_ = this.getImage(1);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @param {CanvasRenderingContext2D} context The context to draw in.
|
||||
*/
|
||||
RegularShape.prototype.createPath_ = function (context) {
|
||||
var points = this.points_;
|
||||
var radius = this.radius_;
|
||||
if (points === Infinity) {
|
||||
context.arc(0, 0, radius, 0, 2 * Math.PI);
|
||||
}
|
||||
else {
|
||||
var radius2 = this.radius2_ === undefined ? radius : this.radius2_;
|
||||
if (this.radius2_ !== undefined) {
|
||||
points *= 2;
|
||||
}
|
||||
var startAngle = this.angle_ - Math.PI / 2;
|
||||
var step = (2 * Math.PI) / points;
|
||||
for (var i = 0; i < points; i++) {
|
||||
var angle0 = startAngle + i * step;
|
||||
var radiusC = i % 2 === 0 ? radius : radius2;
|
||||
context.lineTo(radiusC * Math.cos(angle0), radiusC * Math.sin(angle0));
|
||||
}
|
||||
context.closePath();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @private
|
||||
* @param {RenderOptions} renderOptions Render options.
|
||||
* @param {CanvasRenderingContext2D} context The context.
|
||||
*/
|
||||
RegularShape.prototype.drawHitDetectionCanvas_ = function (renderOptions, context) {
|
||||
// set origin to canvas center
|
||||
context.translate(renderOptions.size / 2, renderOptions.size / 2);
|
||||
this.createPath_(context);
|
||||
context.fillStyle = defaultFillStyle;
|
||||
context.fill();
|
||||
if (this.stroke_) {
|
||||
context.strokeStyle = renderOptions.strokeStyle;
|
||||
context.lineWidth = renderOptions.strokeWidth;
|
||||
if (renderOptions.lineDash) {
|
||||
context.setLineDash(renderOptions.lineDash);
|
||||
context.lineDashOffset = renderOptions.lineDashOffset;
|
||||
}
|
||||
context.lineJoin = renderOptions.lineJoin;
|
||||
context.miterLimit = renderOptions.miterLimit;
|
||||
context.stroke();
|
||||
}
|
||||
};
|
||||
return RegularShape;
|
||||
}(ImageStyle));
|
||||
export default RegularShape;
|
||||
//# sourceMappingURL=RegularShape.js.map
|
||||
1
node_modules/ol/style/RegularShape.js.map
generated
vendored
Normal file
1
node_modules/ol/style/RegularShape.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
205
node_modules/ol/style/Stroke.d.ts
generated
vendored
Normal file
205
node_modules/ol/style/Stroke.d.ts
generated
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
export default Stroke;
|
||||
export type Options = {
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
color?: import("../color.js").Color | import("../colorlike.js").ColorLike | undefined;
|
||||
/**
|
||||
* Line cap style: `butt`, `round`, or `square`.
|
||||
*/
|
||||
lineCap?: CanvasLineCap | undefined;
|
||||
/**
|
||||
* Line join style: `bevel`, `round`, or `miter`.
|
||||
*/
|
||||
lineJoin?: CanvasLineJoin | undefined;
|
||||
/**
|
||||
* Line dash pattern. Default is `null` (no dash).
|
||||
* Please note that Internet Explorer 10 and lower do not support the `setLineDash` method on
|
||||
* the `CanvasRenderingContext2D` and therefore this option will have no visual effect in these browsers.
|
||||
*/
|
||||
lineDash?: number[] | undefined;
|
||||
/**
|
||||
* Line dash offset.
|
||||
*/
|
||||
lineDashOffset?: number | undefined;
|
||||
/**
|
||||
* Miter limit.
|
||||
*/
|
||||
miterLimit?: number | undefined;
|
||||
/**
|
||||
* Width.
|
||||
*/
|
||||
width?: number | undefined;
|
||||
};
|
||||
/**
|
||||
* @module ol/style/Stroke
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @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 {CanvasLineCap} [lineCap='round'] Line cap style: `butt`, `round`, or `square`.
|
||||
* @property {CanvasLineJoin} [lineJoin='round'] Line join style: `bevel`, `round`, or `miter`.
|
||||
* @property {Array<number>} [lineDash] Line dash pattern. Default is `null` (no dash).
|
||||
* Please note that Internet Explorer 10 and lower do not support the `setLineDash` method on
|
||||
* the `CanvasRenderingContext2D` and therefore this option will have no visual effect in these browsers.
|
||||
* @property {number} [lineDashOffset=0] Line dash offset.
|
||||
* @property {number} [miterLimit=10] Miter limit.
|
||||
* @property {number} [width] Width.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Set stroke style for vector features.
|
||||
* Note that the defaults given are the Canvas defaults, which will be used if
|
||||
* option is not defined. The `get` functions return whatever was entered in
|
||||
* the options; they will not return the default.
|
||||
* @api
|
||||
*/
|
||||
declare class Stroke {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../color.js").Color|import("../colorlike.js").ColorLike}
|
||||
*/
|
||||
private color_;
|
||||
/**
|
||||
* @private
|
||||
* @type {CanvasLineCap|undefined}
|
||||
*/
|
||||
private lineCap_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
private lineDash_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private lineDashOffset_;
|
||||
/**
|
||||
* @private
|
||||
* @type {CanvasLineJoin|undefined}
|
||||
*/
|
||||
private lineJoin_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private miterLimit_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private width_;
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {Stroke} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
clone(): Stroke;
|
||||
/**
|
||||
* Get the stroke color.
|
||||
* @return {import("../color.js").Color|import("../colorlike.js").ColorLike} Color.
|
||||
* @api
|
||||
*/
|
||||
getColor(): import("../color.js").Color | import("../colorlike.js").ColorLike;
|
||||
/**
|
||||
* Get the line cap type for the stroke.
|
||||
* @return {CanvasLineCap|undefined} Line cap.
|
||||
* @api
|
||||
*/
|
||||
getLineCap(): CanvasLineCap | undefined;
|
||||
/**
|
||||
* Get the line dash style for the stroke.
|
||||
* @return {Array<number>} Line dash.
|
||||
* @api
|
||||
*/
|
||||
getLineDash(): Array<number>;
|
||||
/**
|
||||
* Get the line dash offset for the stroke.
|
||||
* @return {number|undefined} Line dash offset.
|
||||
* @api
|
||||
*/
|
||||
getLineDashOffset(): number | undefined;
|
||||
/**
|
||||
* Get the line join type for the stroke.
|
||||
* @return {CanvasLineJoin|undefined} Line join.
|
||||
* @api
|
||||
*/
|
||||
getLineJoin(): CanvasLineJoin | undefined;
|
||||
/**
|
||||
* Get the miter limit for the stroke.
|
||||
* @return {number|undefined} Miter limit.
|
||||
* @api
|
||||
*/
|
||||
getMiterLimit(): number | undefined;
|
||||
/**
|
||||
* Get the stroke width.
|
||||
* @return {number|undefined} Width.
|
||||
* @api
|
||||
*/
|
||||
getWidth(): number | undefined;
|
||||
/**
|
||||
* Set the color.
|
||||
*
|
||||
* @param {import("../color.js").Color|import("../colorlike.js").ColorLike} color Color.
|
||||
* @api
|
||||
*/
|
||||
setColor(color: import("../color.js").Color | import("../colorlike.js").ColorLike): void;
|
||||
/**
|
||||
* Set the line cap.
|
||||
*
|
||||
* @param {CanvasLineCap|undefined} lineCap Line cap.
|
||||
* @api
|
||||
*/
|
||||
setLineCap(lineCap: CanvasLineCap | undefined): void;
|
||||
/**
|
||||
* Set the line dash.
|
||||
*
|
||||
* Please note that Internet Explorer 10 and lower [do not support][mdn] the
|
||||
* `setLineDash` method on the `CanvasRenderingContext2D` and therefore this
|
||||
* property will have no visual effect in these browsers.
|
||||
*
|
||||
* [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility
|
||||
*
|
||||
* @param {Array<number>} lineDash Line dash.
|
||||
* @api
|
||||
*/
|
||||
setLineDash(lineDash: Array<number>): void;
|
||||
/**
|
||||
* Set the line dash offset.
|
||||
*
|
||||
* @param {number|undefined} lineDashOffset Line dash offset.
|
||||
* @api
|
||||
*/
|
||||
setLineDashOffset(lineDashOffset: number | undefined): void;
|
||||
/**
|
||||
* Set the line join.
|
||||
*
|
||||
* @param {CanvasLineJoin|undefined} lineJoin Line join.
|
||||
* @api
|
||||
*/
|
||||
setLineJoin(lineJoin: CanvasLineJoin | undefined): void;
|
||||
/**
|
||||
* Set the miter limit.
|
||||
*
|
||||
* @param {number|undefined} miterLimit Miter limit.
|
||||
* @api
|
||||
*/
|
||||
setMiterLimit(miterLimit: number | undefined): void;
|
||||
/**
|
||||
* Set the width.
|
||||
*
|
||||
* @param {number|undefined} width Width.
|
||||
* @api
|
||||
*/
|
||||
setWidth(width: number | undefined): void;
|
||||
}
|
||||
//# sourceMappingURL=Stroke.d.ts.map
|
||||
1
node_modules/ol/style/Stroke.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/Stroke.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Stroke.d.ts","sourceRoot":"","sources":["../src/style/Stroke.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH;IACE;;OAEG;IACH,+CA4CC;IAzCC;;;OAGG;IACH,eAAgE;IAEhE;;;OAGG;IACH,iBAA+B;IAE/B;;;OAGG;IACH,kBAAyE;IAEzE;;;OAGG;IACH,wBAA6C;IAE7C;;;OAGG;IACH,kBAAiC;IAEjC;;;OAGG;IACH,oBAAqC;IAErC;;;OAGG;IACH,eAA2B;IAG7B;;;;OAIG;IACH,SAHY,MAAM,CAcjB;IAED;;;;OAIG;IACH,YAHY,OAAO,aAAa,EAAE,KAAK,GAAC,OAAO,iBAAiB,EAAE,SAAS,CAK1E;IAED;;;;OAIG;IACH,cAHY,aAAa,GAAC,SAAS,CAKlC;IAED;;;;OAIG;IACH,eAHY,MAAM,MAAM,CAAC,CAKxB;IAED;;;;OAIG;IACH,qBAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,eAHY,cAAc,GAAC,SAAS,CAKnC;IAED;;;;OAIG;IACH,iBAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,YAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;;OAKG;IACH,gBAHW,OAAO,aAAa,EAAE,KAAK,GAAC,OAAO,iBAAiB,EAAE,SAAS,QAKzE;IAED;;;;;OAKG;IACH,oBAHW,aAAa,GAAC,SAAS,QAKjC;IAED;;;;;;;;;;;OAWG;IACH,sBAHW,MAAM,MAAM,CAAC,QAKvB;IAED;;;;;OAKG;IACH,kCAHW,MAAM,GAAC,SAAS,QAK1B;IAED;;;;;OAKG;IACH,sBAHW,cAAc,GAAC,SAAS,QAKlC;IAED;;;;;OAKG;IACH,0BAHW,MAAM,GAAC,SAAS,QAK1B;IAED;;;;;OAKG;IACH,gBAHW,MAAM,GAAC,SAAS,QAK1B;CACF"}
|
||||
213
node_modules/ol/style/Stroke.js
generated
vendored
Normal file
213
node_modules/ol/style/Stroke.js
generated
vendored
Normal file
@@ -0,0 +1,213 @@
|
||||
/**
|
||||
* @module ol/style/Stroke
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @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 {CanvasLineCap} [lineCap='round'] Line cap style: `butt`, `round`, or `square`.
|
||||
* @property {CanvasLineJoin} [lineJoin='round'] Line join style: `bevel`, `round`, or `miter`.
|
||||
* @property {Array<number>} [lineDash] Line dash pattern. Default is `null` (no dash).
|
||||
* Please note that Internet Explorer 10 and lower do not support the `setLineDash` method on
|
||||
* the `CanvasRenderingContext2D` and therefore this option will have no visual effect in these browsers.
|
||||
* @property {number} [lineDashOffset=0] Line dash offset.
|
||||
* @property {number} [miterLimit=10] Miter limit.
|
||||
* @property {number} [width] Width.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Set stroke style for vector features.
|
||||
* Note that the defaults given are the Canvas defaults, which will be used if
|
||||
* option is not defined. The `get` functions return whatever was entered in
|
||||
* the options; they will not return the default.
|
||||
* @api
|
||||
*/
|
||||
var Stroke = /** @class */ (function () {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function Stroke(opt_options) {
|
||||
var options = opt_options || {};
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../color.js").Color|import("../colorlike.js").ColorLike}
|
||||
*/
|
||||
this.color_ = options.color !== undefined ? options.color : null;
|
||||
/**
|
||||
* @private
|
||||
* @type {CanvasLineCap|undefined}
|
||||
*/
|
||||
this.lineCap_ = options.lineCap;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>}
|
||||
*/
|
||||
this.lineDash_ = options.lineDash !== undefined ? options.lineDash : null;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.lineDashOffset_ = options.lineDashOffset;
|
||||
/**
|
||||
* @private
|
||||
* @type {CanvasLineJoin|undefined}
|
||||
*/
|
||||
this.lineJoin_ = options.lineJoin;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.miterLimit_ = options.miterLimit;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.width_ = options.width;
|
||||
}
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {Stroke} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.clone = function () {
|
||||
var color = this.getColor();
|
||||
return new Stroke({
|
||||
color: Array.isArray(color) ? color.slice() : color || undefined,
|
||||
lineCap: this.getLineCap(),
|
||||
lineDash: this.getLineDash() ? this.getLineDash().slice() : undefined,
|
||||
lineDashOffset: this.getLineDashOffset(),
|
||||
lineJoin: this.getLineJoin(),
|
||||
miterLimit: this.getMiterLimit(),
|
||||
width: this.getWidth(),
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Get the stroke color.
|
||||
* @return {import("../color.js").Color|import("../colorlike.js").ColorLike} Color.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.getColor = function () {
|
||||
return this.color_;
|
||||
};
|
||||
/**
|
||||
* Get the line cap type for the stroke.
|
||||
* @return {CanvasLineCap|undefined} Line cap.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.getLineCap = function () {
|
||||
return this.lineCap_;
|
||||
};
|
||||
/**
|
||||
* Get the line dash style for the stroke.
|
||||
* @return {Array<number>} Line dash.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.getLineDash = function () {
|
||||
return this.lineDash_;
|
||||
};
|
||||
/**
|
||||
* Get the line dash offset for the stroke.
|
||||
* @return {number|undefined} Line dash offset.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.getLineDashOffset = function () {
|
||||
return this.lineDashOffset_;
|
||||
};
|
||||
/**
|
||||
* Get the line join type for the stroke.
|
||||
* @return {CanvasLineJoin|undefined} Line join.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.getLineJoin = function () {
|
||||
return this.lineJoin_;
|
||||
};
|
||||
/**
|
||||
* Get the miter limit for the stroke.
|
||||
* @return {number|undefined} Miter limit.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.getMiterLimit = function () {
|
||||
return this.miterLimit_;
|
||||
};
|
||||
/**
|
||||
* Get the stroke width.
|
||||
* @return {number|undefined} Width.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.getWidth = function () {
|
||||
return this.width_;
|
||||
};
|
||||
/**
|
||||
* Set the color.
|
||||
*
|
||||
* @param {import("../color.js").Color|import("../colorlike.js").ColorLike} color Color.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.setColor = function (color) {
|
||||
this.color_ = color;
|
||||
};
|
||||
/**
|
||||
* Set the line cap.
|
||||
*
|
||||
* @param {CanvasLineCap|undefined} lineCap Line cap.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.setLineCap = function (lineCap) {
|
||||
this.lineCap_ = lineCap;
|
||||
};
|
||||
/**
|
||||
* Set the line dash.
|
||||
*
|
||||
* Please note that Internet Explorer 10 and lower [do not support][mdn] the
|
||||
* `setLineDash` method on the `CanvasRenderingContext2D` and therefore this
|
||||
* property will have no visual effect in these browsers.
|
||||
*
|
||||
* [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility
|
||||
*
|
||||
* @param {Array<number>} lineDash Line dash.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.setLineDash = function (lineDash) {
|
||||
this.lineDash_ = lineDash;
|
||||
};
|
||||
/**
|
||||
* Set the line dash offset.
|
||||
*
|
||||
* @param {number|undefined} lineDashOffset Line dash offset.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.setLineDashOffset = function (lineDashOffset) {
|
||||
this.lineDashOffset_ = lineDashOffset;
|
||||
};
|
||||
/**
|
||||
* Set the line join.
|
||||
*
|
||||
* @param {CanvasLineJoin|undefined} lineJoin Line join.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.setLineJoin = function (lineJoin) {
|
||||
this.lineJoin_ = lineJoin;
|
||||
};
|
||||
/**
|
||||
* Set the miter limit.
|
||||
*
|
||||
* @param {number|undefined} miterLimit Miter limit.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.setMiterLimit = function (miterLimit) {
|
||||
this.miterLimit_ = miterLimit;
|
||||
};
|
||||
/**
|
||||
* Set the width.
|
||||
*
|
||||
* @param {number|undefined} width Width.
|
||||
* @api
|
||||
*/
|
||||
Stroke.prototype.setWidth = function (width) {
|
||||
this.width_ = width;
|
||||
};
|
||||
return Stroke;
|
||||
}());
|
||||
export default Stroke;
|
||||
//# sourceMappingURL=Stroke.js.map
|
||||
1
node_modules/ol/style/Stroke.js.map
generated
vendored
Normal file
1
node_modules/ol/style/Stroke.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Stroke.js","sourceRoot":"","sources":["../src/style/Stroke.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH;IACE;;OAEG;IACH,gBAAY,WAAW;QACrB,IAAM,OAAO,GAAG,WAAW,IAAI,EAAE,CAAC;QAElC;;;WAGG;QACH,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QAEjE;;;WAGG;QACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;QAEhC;;;WAGG;QACH,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;QAE1E;;;WAGG;QACH,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;QAE9C;;;WAGG;QACH,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC;QAElC;;;WAGG;QACH,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;QAEtC;;;WAGG;QACH,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,sBAAK,GAAL;QACE,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,MAAM,CAAC;YAChB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,SAAS;YAChE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE;YAC1B,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS;YACrE,cAAc,EAAE,IAAI,CAAC,iBAAiB,EAAE;YACxC,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE;YAC5B,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE;YAChC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE;SACvB,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,yBAAQ,GAAR;QACE,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;OAIG;IACH,2BAAU,GAAV;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,4BAAW,GAAX;QACE,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,kCAAiB,GAAjB;QACE,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,4BAAW,GAAX;QACE,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,8BAAa,GAAb;QACE,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,yBAAQ,GAAR;QACE,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACH,yBAAQ,GAAR,UAAS,KAAK;QACZ,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACH,2BAAU,GAAV,UAAW,OAAO;QAChB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;;;;;;;;;OAWG;IACH,4BAAW,GAAX,UAAY,QAAQ;QAClB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,kCAAiB,GAAjB,UAAkB,cAAc;QAC9B,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACH,4BAAW,GAAX,UAAY,QAAQ;QAClB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACH,8BAAa,GAAb,UAAc,UAAU;QACtB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,yBAAQ,GAAR,UAAS,KAAK;QACZ,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IACH,aAAC;AAAD,CAAC,AA9MD,IA8MC;AAED,eAAe,MAAM,CAAC"}
|
||||
392
node_modules/ol/style/Style.d.ts
generated
vendored
Normal file
392
node_modules/ol/style/Style.d.ts
generated
vendored
Normal file
@@ -0,0 +1,392 @@
|
||||
/**
|
||||
* Convert the provided object into a style function. Functions passed through
|
||||
* unchanged. Arrays of Style or single style objects wrapped in a
|
||||
* new style function.
|
||||
* @param {StyleFunction|Array<Style>|Style} obj
|
||||
* A style function, a single style, or an array of styles.
|
||||
* @return {StyleFunction} A style function.
|
||||
*/
|
||||
export function toFunction(obj: StyleFunction | Array<Style> | Style): StyleFunction;
|
||||
/**
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {number} resolution Resolution.
|
||||
* @return {Array<Style>} Style.
|
||||
*/
|
||||
export function createDefaultStyle(feature: import("../Feature.js").FeatureLike, resolution: number): Array<Style>;
|
||||
/**
|
||||
* Default styles for editing features.
|
||||
* @return {Object<import("../geom/Geometry.js").Type, Array<Style>>} Styles
|
||||
*/
|
||||
export function createEditingStyle(): any;
|
||||
export default Style;
|
||||
/**
|
||||
* A function that takes an {@link module :ol/Feature~Feature} and a `{number}`
|
||||
* representing the view's resolution. The function should return a
|
||||
* {@link module :ol/style/Style~Style} or an array of them. This way e.g. a
|
||||
* vector layer can be styled. If the function returns `undefined`, the
|
||||
* feature will not be rendered.
|
||||
*/
|
||||
export type StyleFunction = (arg0: import("../Feature.js").FeatureLike, arg1: number) => (Style | Array<Style> | void);
|
||||
/**
|
||||
* A {@link Style }, an array of {@link Style }, or a {@link StyleFunction }.
|
||||
*/
|
||||
export type StyleLike = Style | Array<Style> | StyleFunction;
|
||||
/**
|
||||
* A function that takes an {@link module :ol/Feature~Feature} as argument and returns an
|
||||
* {@link module :ol/geom/Geometry~Geometry} that will be rendered and styled for the feature.
|
||||
*/
|
||||
export type GeometryFunction = (arg0: import("../Feature.js").FeatureLike) => (import("../geom/Geometry.js").default | import("../render/Feature.js").default | undefined);
|
||||
/**
|
||||
* Custom renderer function. Takes two arguments:
|
||||
*
|
||||
* 1. The pixel coordinates of the geometry in GeoJSON notation.
|
||||
* 2. The {@link module :ol/render~State} of the layer renderer.
|
||||
*/
|
||||
export type RenderFunction = (arg0: (import("../coordinate.js").Coordinate | Array<import("../coordinate.js").Coordinate> | Array<Array<import("../coordinate.js").Coordinate>>), arg1: import("../render.js").State) => void;
|
||||
export type Options = {
|
||||
/**
|
||||
* Feature property or geometry
|
||||
* or function returning a geometry to render for this style.
|
||||
*/
|
||||
geometry?: string | import("../geom/Geometry.js").default | GeometryFunction | undefined;
|
||||
/**
|
||||
* Fill style.
|
||||
*/
|
||||
fill?: Fill | undefined;
|
||||
/**
|
||||
* Image style.
|
||||
*/
|
||||
image?: import("./Image.js").default | undefined;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
renderer?: RenderFunction | undefined;
|
||||
/**
|
||||
* Custom renderer for hit detection. If provided will be used
|
||||
* in hit detection rendering.
|
||||
*/
|
||||
hitDetectionRenderer?: RenderFunction | undefined;
|
||||
/**
|
||||
* Stroke style.
|
||||
*/
|
||||
stroke?: Stroke | undefined;
|
||||
/**
|
||||
* Text style.
|
||||
*/
|
||||
text?: import("./Text.js").default | undefined;
|
||||
/**
|
||||
* Z index.
|
||||
*/
|
||||
zIndex?: number | undefined;
|
||||
};
|
||||
/**
|
||||
* A function that takes an {@link module:ol/Feature~Feature} and a `{number}`
|
||||
* representing the view's resolution. The function should return a
|
||||
* {@link module:ol/style/Style~Style} or an array of them. This way e.g. a
|
||||
* vector layer can be styled. If the function returns `undefined`, the
|
||||
* feature will not be rendered.
|
||||
*
|
||||
* @typedef {function(import("../Feature.js").FeatureLike, number):(Style|Array<Style>|void)} StyleFunction
|
||||
*/
|
||||
/**
|
||||
* A {@link Style}, an array of {@link Style}, or a {@link StyleFunction}.
|
||||
* @typedef {Style|Array<Style>|StyleFunction} StyleLike
|
||||
*/
|
||||
/**
|
||||
* A function that takes an {@link module:ol/Feature~Feature} as argument and returns an
|
||||
* {@link module:ol/geom/Geometry~Geometry} that will be rendered and styled for the feature.
|
||||
*
|
||||
* @typedef {function(import("../Feature.js").FeatureLike):
|
||||
* (import("../geom/Geometry.js").default|import("../render/Feature.js").default|undefined)} GeometryFunction
|
||||
*/
|
||||
/**
|
||||
* Custom renderer function. Takes two arguments:
|
||||
*
|
||||
* 1. The pixel coordinates of the geometry in GeoJSON notation.
|
||||
* 2. The {@link module:ol/render~State} of the layer renderer.
|
||||
*
|
||||
* @typedef {function((import("../coordinate.js").Coordinate|Array<import("../coordinate.js").Coordinate>|Array<Array<import("../coordinate.js").Coordinate>>),import("../render.js").State): void} RenderFunction
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string|import("../geom/Geometry.js").default|GeometryFunction} [geometry] Feature property or geometry
|
||||
* or function returning a geometry to render for this style.
|
||||
* @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 {RenderFunction} [hitDetectionRenderer] Custom renderer for hit detection. If provided will be used
|
||||
* in hit detection rendering.
|
||||
* @property {import("./Stroke.js").default} [stroke] Stroke style.
|
||||
* @property {import("./Text.js").default} [text] Text style.
|
||||
* @property {number} [zIndex] Z index.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Container for vector feature rendering styles. Any changes made to the style
|
||||
* or its children through `set*()` methods will not take effect until the
|
||||
* feature or layer that uses the style is re-rendered.
|
||||
*
|
||||
* ## Feature styles
|
||||
*
|
||||
* If no style is defined, the following default style is used:
|
||||
* ```js
|
||||
* import {Circle, Fill, Stroke, Style} from 'ol/style';
|
||||
*
|
||||
* const fill = new Fill({
|
||||
* color: 'rgba(255,255,255,0.4)',
|
||||
* });
|
||||
* const stroke = new Stroke({
|
||||
* color: '#3399CC',
|
||||
* width: 1.25,
|
||||
* });
|
||||
* const styles = [
|
||||
* new Style({
|
||||
* image: new Circle({
|
||||
* fill: fill,
|
||||
* stroke: stroke,
|
||||
* radius: 5,
|
||||
* }),
|
||||
* fill: fill,
|
||||
* stroke: stroke,
|
||||
* }),
|
||||
* ];
|
||||
* ```
|
||||
*
|
||||
* A separate editing style has the following defaults:
|
||||
* ```js
|
||||
* import {Circle, Fill, Stroke, Style} from 'ol/style';
|
||||
*
|
||||
* const styles = {};
|
||||
* const white = [255, 255, 255, 1];
|
||||
* const blue = [0, 153, 255, 1];
|
||||
* const width = 3;
|
||||
* styles['Polygon'] = [
|
||||
* new Style({
|
||||
* fill: new Fill({
|
||||
* color: [255, 255, 255, 0.5],
|
||||
* }),
|
||||
* }),
|
||||
* ];
|
||||
* styles['MultiPolygon'] =
|
||||
* styles['Polygon'];
|
||||
* styles['LineString'] = [
|
||||
* new Style({
|
||||
* stroke: new Stroke({
|
||||
* color: white,
|
||||
* width: width + 2,
|
||||
* }),
|
||||
* }),
|
||||
* new Style({
|
||||
* stroke: new Stroke({
|
||||
* color: blue,
|
||||
* width: width,
|
||||
* }),
|
||||
* }),
|
||||
* ];
|
||||
* styles['MultiLineString'] = styles['LineString'];
|
||||
*
|
||||
* styles['Circle'] = styles['Polygon'].concat(
|
||||
* styles['LineString']
|
||||
* );
|
||||
*
|
||||
* styles['Point'] = [
|
||||
* new Style({
|
||||
* image: new Circle({
|
||||
* radius: width * 2,
|
||||
* fill: new Fill({
|
||||
* color: blue,
|
||||
* }),
|
||||
* stroke: new Stroke({
|
||||
* color: white,
|
||||
* width: width / 2,
|
||||
* }),
|
||||
* }),
|
||||
* zIndex: Infinity,
|
||||
* }),
|
||||
* ];
|
||||
* styles['MultiPoint'] =
|
||||
* styles['Point'];
|
||||
* styles['GeometryCollection'] =
|
||||
* styles['Polygon'].concat(
|
||||
* styles['LineString'],
|
||||
* styles['Point']
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
declare class Style {
|
||||
/**
|
||||
* @param {Options} [opt_options] Style options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {string|import("../geom/Geometry.js").default|GeometryFunction}
|
||||
*/
|
||||
private geometry_;
|
||||
/**
|
||||
* @private
|
||||
* @type {!GeometryFunction}
|
||||
*/
|
||||
private geometryFunction_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Fill.js").default}
|
||||
*/
|
||||
private fill_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Image.js").default}
|
||||
*/
|
||||
private image_;
|
||||
/**
|
||||
* @private
|
||||
* @type {RenderFunction|null}
|
||||
*/
|
||||
private renderer_;
|
||||
/**
|
||||
* @private
|
||||
* @type {RenderFunction|null}
|
||||
*/
|
||||
private hitDetectionRenderer_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Stroke.js").default}
|
||||
*/
|
||||
private stroke_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Text.js").default}
|
||||
*/
|
||||
private text_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private zIndex_;
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {Style} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
clone(): Style;
|
||||
/**
|
||||
* Get the custom renderer function that was configured with
|
||||
* {@link #setRenderer} or the `renderer` constructor option.
|
||||
* @return {RenderFunction|null} Custom renderer function.
|
||||
* @api
|
||||
*/
|
||||
getRenderer(): RenderFunction | null;
|
||||
/**
|
||||
* Sets a custom renderer function for this style. When set, `fill`, `stroke`
|
||||
* and `image` options of the style will be ignored.
|
||||
* @param {RenderFunction|null} renderer Custom renderer function.
|
||||
* @api
|
||||
*/
|
||||
setRenderer(renderer: RenderFunction | null): void;
|
||||
/**
|
||||
* Sets a custom renderer function for this style used
|
||||
* in hit detection.
|
||||
* @param {RenderFunction|null} renderer Custom renderer function.
|
||||
* @api
|
||||
*/
|
||||
setHitDetectionRenderer(renderer: RenderFunction | null): void;
|
||||
/**
|
||||
* Get the custom renderer function that was configured with
|
||||
* {@link #setHitDetectionRenderer} or the `hitDetectionRenderer` constructor option.
|
||||
* @return {RenderFunction|null} Custom renderer function.
|
||||
* @api
|
||||
*/
|
||||
getHitDetectionRenderer(): RenderFunction | null;
|
||||
/**
|
||||
* Get the geometry to be rendered.
|
||||
* @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
|
||||
*/
|
||||
getGeometry(): string | import("../geom/Geometry.js").default | GeometryFunction;
|
||||
/**
|
||||
* Get the function used to generate a geometry for rendering.
|
||||
* @return {!GeometryFunction} Function that is called with a feature
|
||||
* and returns the geometry to render instead of the feature's geometry.
|
||||
* @api
|
||||
*/
|
||||
getGeometryFunction(): GeometryFunction;
|
||||
/**
|
||||
* Get the fill style.
|
||||
* @return {import("./Fill.js").default} Fill style.
|
||||
* @api
|
||||
*/
|
||||
getFill(): import("./Fill.js").default;
|
||||
/**
|
||||
* Set the fill style.
|
||||
* @param {import("./Fill.js").default} fill Fill style.
|
||||
* @api
|
||||
*/
|
||||
setFill(fill: import("./Fill.js").default): void;
|
||||
/**
|
||||
* Get the image style.
|
||||
* @return {import("./Image.js").default} Image style.
|
||||
* @api
|
||||
*/
|
||||
getImage(): import("./Image.js").default;
|
||||
/**
|
||||
* Set the image style.
|
||||
* @param {import("./Image.js").default} image Image style.
|
||||
* @api
|
||||
*/
|
||||
setImage(image: import("./Image.js").default): void;
|
||||
/**
|
||||
* Get the stroke style.
|
||||
* @return {import("./Stroke.js").default} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
getStroke(): import("./Stroke.js").default;
|
||||
/**
|
||||
* Set the stroke style.
|
||||
* @param {import("./Stroke.js").default} stroke Stroke style.
|
||||
* @api
|
||||
*/
|
||||
setStroke(stroke: import("./Stroke.js").default): void;
|
||||
/**
|
||||
* Get the text style.
|
||||
* @return {import("./Text.js").default} Text style.
|
||||
* @api
|
||||
*/
|
||||
getText(): import("./Text.js").default;
|
||||
/**
|
||||
* Set the text style.
|
||||
* @param {import("./Text.js").default} text Text style.
|
||||
* @api
|
||||
*/
|
||||
setText(text: import("./Text.js").default): void;
|
||||
/**
|
||||
* Get the z-index for the style.
|
||||
* @return {number|undefined} ZIndex.
|
||||
* @api
|
||||
*/
|
||||
getZIndex(): number | undefined;
|
||||
/**
|
||||
* Set a geometry that is rendered instead of the feature's 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
|
||||
*/
|
||||
setGeometry(geometry: string | import("../geom/Geometry.js").default | GeometryFunction): void;
|
||||
/**
|
||||
* Set the z-index.
|
||||
*
|
||||
* @param {number|undefined} zIndex ZIndex.
|
||||
* @api
|
||||
*/
|
||||
setZIndex(zIndex: number | undefined): void;
|
||||
}
|
||||
import Fill from "./Fill.js";
|
||||
import Stroke from "./Stroke.js";
|
||||
//# sourceMappingURL=Style.d.ts.map
|
||||
1
node_modules/ol/style/Style.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/Style.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Style.d.ts","sourceRoot":"","sources":["../src/style/Style.js"],"names":[],"mappings":"AAuaA;;;;;;;GAOG;AACH,gCAJW,aAAa,GAAC,MAAM,KAAK,CAAC,GAAC,KAAK,GAE/B,aAAa,CAwBxB;AAOD;;;;GAIG;AACH,4CAJW,OAAO,eAAe,EAAE,WAAW,cACnC,MAAM,GACL,MAAM,KAAK,CAAC,CA6BvB;AAED;;;GAGG;AACH,0CAwDC;;;;;;;;;mCA1hBqB,OAAO,eAAe,EAAE,WAAW,QAAE,MAAM,KAAE,CAAC,KAAK,GAAC,MAAM,KAAK,CAAC,GAAC,IAAI,CAAC;;;;wBAK/E,KAAK,GAAC,MAAM,KAAK,CAAC,GAAC,aAAa;;;;;sCAOvB,OAAO,eAAe,EAAE,WAAW,KACxD,CAAO,OAAO,qBAAqB,EAAE,OAAO,GAAC,OAAO,sBAAsB,EAAE,OAAO,GAAC,SAAS,CAAC;;;;;;;oCASzE,CAAC,OAAO,kBAAkB,EAAE,UAAU,GAAC,MAAM,OAAO,kBAAkB,EAAE,UAAU,CAAC,GAAC,MAAM,MAAM,OAAO,kBAAkB,EAAE,UAAU,CAAC,CAAC,CAAC,QAAC,OAAO,cAAc,EAAE,KAAK,KAAG,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA7BlM;;;;;;;;GAQG;AAEH;;;GAGG;AAEH;;;;;;GAMG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8FG;AACH;IACE;;OAEG;IACH,+CA+DC;IA5DC;;;OAGG;IACH,kBAAqB;IAErB;;;OAGG;IACH,0BAAgD;IAMhD;;;OAGG;IACH,cAA6D;IAE7D;;;OAGG;IACH,eAAgE;IAEhE;;;OAGG;IACH,kBAAyE;IAEzE;;;OAGG;IACH,8BAGU;IAEV;;;OAGG;IACH,gBAAmE;IAEnE;;;OAGG;IACH,cAA6D;IAE7D;;;OAGG;IACH,gBAA6B;IAG/B;;;;OAIG;IACH,SAHY,KAAK,CAmBhB;IAED;;;;;OAKG;IACH,eAHY,cAAc,GAAC,IAAI,CAK9B;IAED;;;;;OAKG;IACH,sBAHW,cAAc,GAAC,IAAI,QAK7B;IAED;;;;;OAKG;IACH,kCAHW,cAAc,GAAC,IAAI,QAK7B;IAED;;;;;OAKG;IACH,2BAHY,cAAc,GAAC,IAAI,CAK9B;IAED;;;;;;OAMG;IACH,eALY,MAAM,GAAC,OAAO,qBAAqB,EAAE,OAAO,GAAC,gBAAgB,CAOxE;IAED;;;;;OAKG;IACH,uBAJa,gBAAgB,CAM5B;IAED;;;;OAIG;IACH,WAHY,OAAO,WAAW,EAAE,OAAO,CAKtC;IAED;;;;OAIG;IACH,cAHW,OAAO,WAAW,EAAE,OAAO,QAKrC;IAED;;;;OAIG;IACH,YAHY,OAAO,YAAY,EAAE,OAAO,CAKvC;IAED;;;;OAIG;IACH,gBAHW,OAAO,YAAY,EAAE,OAAO,QAKtC;IAED;;;;OAIG;IACH,aAHY,OAAO,aAAa,EAAE,OAAO,CAKxC;IAED;;;;OAIG;IACH,kBAHW,OAAO,aAAa,EAAE,OAAO,QAKvC;IAED;;;;OAIG;IACH,WAHY,OAAO,WAAW,EAAE,OAAO,CAKtC;IAED;;;;OAIG;IACH,cAHW,OAAO,WAAW,EAAE,OAAO,QAKrC;IAED;;;;OAIG;IACH,aAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;;;;OAOG;IACH,sBALW,MAAM,GAAC,OAAO,qBAAqB,EAAE,OAAO,GAAC,gBAAgB,QAsBvE;IAED;;;;;OAKG;IACH,kBAHW,MAAM,GAAC,SAAS,QAK1B;CACF"}
|
||||
519
node_modules/ol/style/Style.js
generated
vendored
Normal file
519
node_modules/ol/style/Style.js
generated
vendored
Normal file
@@ -0,0 +1,519 @@
|
||||
/**
|
||||
* @module ol/style/Style
|
||||
*/
|
||||
import CircleStyle from './Circle.js';
|
||||
import Fill from './Fill.js';
|
||||
import Stroke from './Stroke.js';
|
||||
import { assert } from '../asserts.js';
|
||||
/**
|
||||
* A function that takes an {@link module:ol/Feature~Feature} and a `{number}`
|
||||
* representing the view's resolution. The function should return a
|
||||
* {@link module:ol/style/Style~Style} or an array of them. This way e.g. a
|
||||
* vector layer can be styled. If the function returns `undefined`, the
|
||||
* feature will not be rendered.
|
||||
*
|
||||
* @typedef {function(import("../Feature.js").FeatureLike, number):(Style|Array<Style>|void)} StyleFunction
|
||||
*/
|
||||
/**
|
||||
* A {@link Style}, an array of {@link Style}, or a {@link StyleFunction}.
|
||||
* @typedef {Style|Array<Style>|StyleFunction} StyleLike
|
||||
*/
|
||||
/**
|
||||
* A function that takes an {@link module:ol/Feature~Feature} as argument and returns an
|
||||
* {@link module:ol/geom/Geometry~Geometry} that will be rendered and styled for the feature.
|
||||
*
|
||||
* @typedef {function(import("../Feature.js").FeatureLike):
|
||||
* (import("../geom/Geometry.js").default|import("../render/Feature.js").default|undefined)} GeometryFunction
|
||||
*/
|
||||
/**
|
||||
* Custom renderer function. Takes two arguments:
|
||||
*
|
||||
* 1. The pixel coordinates of the geometry in GeoJSON notation.
|
||||
* 2. The {@link module:ol/render~State} of the layer renderer.
|
||||
*
|
||||
* @typedef {function((import("../coordinate.js").Coordinate|Array<import("../coordinate.js").Coordinate>|Array<Array<import("../coordinate.js").Coordinate>>),import("../render.js").State): void} RenderFunction
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string|import("../geom/Geometry.js").default|GeometryFunction} [geometry] Feature property or geometry
|
||||
* or function returning a geometry to render for this style.
|
||||
* @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 {RenderFunction} [hitDetectionRenderer] Custom renderer for hit detection. If provided will be used
|
||||
* in hit detection rendering.
|
||||
* @property {import("./Stroke.js").default} [stroke] Stroke style.
|
||||
* @property {import("./Text.js").default} [text] Text style.
|
||||
* @property {number} [zIndex] Z index.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Container for vector feature rendering styles. Any changes made to the style
|
||||
* or its children through `set*()` methods will not take effect until the
|
||||
* feature or layer that uses the style is re-rendered.
|
||||
*
|
||||
* ## Feature styles
|
||||
*
|
||||
* If no style is defined, the following default style is used:
|
||||
* ```js
|
||||
* import {Circle, Fill, Stroke, Style} from 'ol/style';
|
||||
*
|
||||
* const fill = new Fill({
|
||||
* color: 'rgba(255,255,255,0.4)',
|
||||
* });
|
||||
* const stroke = new Stroke({
|
||||
* color: '#3399CC',
|
||||
* width: 1.25,
|
||||
* });
|
||||
* const styles = [
|
||||
* new Style({
|
||||
* image: new Circle({
|
||||
* fill: fill,
|
||||
* stroke: stroke,
|
||||
* radius: 5,
|
||||
* }),
|
||||
* fill: fill,
|
||||
* stroke: stroke,
|
||||
* }),
|
||||
* ];
|
||||
* ```
|
||||
*
|
||||
* A separate editing style has the following defaults:
|
||||
* ```js
|
||||
* import {Circle, Fill, Stroke, Style} from 'ol/style';
|
||||
*
|
||||
* const styles = {};
|
||||
* const white = [255, 255, 255, 1];
|
||||
* const blue = [0, 153, 255, 1];
|
||||
* const width = 3;
|
||||
* styles['Polygon'] = [
|
||||
* new Style({
|
||||
* fill: new Fill({
|
||||
* color: [255, 255, 255, 0.5],
|
||||
* }),
|
||||
* }),
|
||||
* ];
|
||||
* styles['MultiPolygon'] =
|
||||
* styles['Polygon'];
|
||||
* styles['LineString'] = [
|
||||
* new Style({
|
||||
* stroke: new Stroke({
|
||||
* color: white,
|
||||
* width: width + 2,
|
||||
* }),
|
||||
* }),
|
||||
* new Style({
|
||||
* stroke: new Stroke({
|
||||
* color: blue,
|
||||
* width: width,
|
||||
* }),
|
||||
* }),
|
||||
* ];
|
||||
* styles['MultiLineString'] = styles['LineString'];
|
||||
*
|
||||
* styles['Circle'] = styles['Polygon'].concat(
|
||||
* styles['LineString']
|
||||
* );
|
||||
*
|
||||
* styles['Point'] = [
|
||||
* new Style({
|
||||
* image: new Circle({
|
||||
* radius: width * 2,
|
||||
* fill: new Fill({
|
||||
* color: blue,
|
||||
* }),
|
||||
* stroke: new Stroke({
|
||||
* color: white,
|
||||
* width: width / 2,
|
||||
* }),
|
||||
* }),
|
||||
* zIndex: Infinity,
|
||||
* }),
|
||||
* ];
|
||||
* styles['MultiPoint'] =
|
||||
* styles['Point'];
|
||||
* styles['GeometryCollection'] =
|
||||
* styles['Polygon'].concat(
|
||||
* styles['LineString'],
|
||||
* styles['Point']
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
var Style = /** @class */ (function () {
|
||||
/**
|
||||
* @param {Options} [opt_options] Style options.
|
||||
*/
|
||||
function Style(opt_options) {
|
||||
var options = opt_options || {};
|
||||
/**
|
||||
* @private
|
||||
* @type {string|import("../geom/Geometry.js").default|GeometryFunction}
|
||||
*/
|
||||
this.geometry_ = null;
|
||||
/**
|
||||
* @private
|
||||
* @type {!GeometryFunction}
|
||||
*/
|
||||
this.geometryFunction_ = defaultGeometryFunction;
|
||||
if (options.geometry !== undefined) {
|
||||
this.setGeometry(options.geometry);
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Fill.js").default}
|
||||
*/
|
||||
this.fill_ = options.fill !== undefined ? options.fill : null;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Image.js").default}
|
||||
*/
|
||||
this.image_ = options.image !== undefined ? options.image : null;
|
||||
/**
|
||||
* @private
|
||||
* @type {RenderFunction|null}
|
||||
*/
|
||||
this.renderer_ = options.renderer !== undefined ? options.renderer : null;
|
||||
/**
|
||||
* @private
|
||||
* @type {RenderFunction|null}
|
||||
*/
|
||||
this.hitDetectionRenderer_ =
|
||||
options.hitDetectionRenderer !== undefined
|
||||
? options.hitDetectionRenderer
|
||||
: null;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Stroke.js").default}
|
||||
*/
|
||||
this.stroke_ = options.stroke !== undefined ? options.stroke : null;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Text.js").default}
|
||||
*/
|
||||
this.text_ = options.text !== undefined ? options.text : null;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.zIndex_ = options.zIndex;
|
||||
}
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {Style} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.clone = function () {
|
||||
var geometry = this.getGeometry();
|
||||
if (geometry && typeof geometry === 'object') {
|
||||
geometry = /** @type {import("../geom/Geometry.js").default} */ (geometry).clone();
|
||||
}
|
||||
return new Style({
|
||||
geometry: geometry,
|
||||
fill: this.getFill() ? this.getFill().clone() : undefined,
|
||||
image: this.getImage() ? this.getImage().clone() : undefined,
|
||||
renderer: this.getRenderer(),
|
||||
stroke: this.getStroke() ? this.getStroke().clone() : undefined,
|
||||
text: this.getText() ? this.getText().clone() : undefined,
|
||||
zIndex: this.getZIndex(),
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Get the custom renderer function that was configured with
|
||||
* {@link #setRenderer} or the `renderer` constructor option.
|
||||
* @return {RenderFunction|null} Custom renderer function.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.getRenderer = function () {
|
||||
return this.renderer_;
|
||||
};
|
||||
/**
|
||||
* Sets a custom renderer function for this style. When set, `fill`, `stroke`
|
||||
* and `image` options of the style will be ignored.
|
||||
* @param {RenderFunction|null} renderer Custom renderer function.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.setRenderer = function (renderer) {
|
||||
this.renderer_ = renderer;
|
||||
};
|
||||
/**
|
||||
* Sets a custom renderer function for this style used
|
||||
* in hit detection.
|
||||
* @param {RenderFunction|null} renderer Custom renderer function.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.setHitDetectionRenderer = function (renderer) {
|
||||
this.hitDetectionRenderer_ = renderer;
|
||||
};
|
||||
/**
|
||||
* Get the custom renderer function that was configured with
|
||||
* {@link #setHitDetectionRenderer} or the `hitDetectionRenderer` constructor option.
|
||||
* @return {RenderFunction|null} Custom renderer function.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.getHitDetectionRenderer = function () {
|
||||
return this.hitDetectionRenderer_;
|
||||
};
|
||||
/**
|
||||
* Get the geometry to be rendered.
|
||||
* @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
|
||||
*/
|
||||
Style.prototype.getGeometry = function () {
|
||||
return this.geometry_;
|
||||
};
|
||||
/**
|
||||
* Get the function used to generate a geometry for rendering.
|
||||
* @return {!GeometryFunction} Function that is called with a feature
|
||||
* and returns the geometry to render instead of the feature's geometry.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.getGeometryFunction = function () {
|
||||
return this.geometryFunction_;
|
||||
};
|
||||
/**
|
||||
* Get the fill style.
|
||||
* @return {import("./Fill.js").default} Fill style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.getFill = function () {
|
||||
return this.fill_;
|
||||
};
|
||||
/**
|
||||
* Set the fill style.
|
||||
* @param {import("./Fill.js").default} fill Fill style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.setFill = function (fill) {
|
||||
this.fill_ = fill;
|
||||
};
|
||||
/**
|
||||
* Get the image style.
|
||||
* @return {import("./Image.js").default} Image style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.getImage = function () {
|
||||
return this.image_;
|
||||
};
|
||||
/**
|
||||
* Set the image style.
|
||||
* @param {import("./Image.js").default} image Image style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.setImage = function (image) {
|
||||
this.image_ = image;
|
||||
};
|
||||
/**
|
||||
* Get the stroke style.
|
||||
* @return {import("./Stroke.js").default} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.getStroke = function () {
|
||||
return this.stroke_;
|
||||
};
|
||||
/**
|
||||
* Set the stroke style.
|
||||
* @param {import("./Stroke.js").default} stroke Stroke style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.setStroke = function (stroke) {
|
||||
this.stroke_ = stroke;
|
||||
};
|
||||
/**
|
||||
* Get the text style.
|
||||
* @return {import("./Text.js").default} Text style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.getText = function () {
|
||||
return this.text_;
|
||||
};
|
||||
/**
|
||||
* Set the text style.
|
||||
* @param {import("./Text.js").default} text Text style.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.setText = function (text) {
|
||||
this.text_ = text;
|
||||
};
|
||||
/**
|
||||
* Get the z-index for the style.
|
||||
* @return {number|undefined} ZIndex.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.getZIndex = function () {
|
||||
return this.zIndex_;
|
||||
};
|
||||
/**
|
||||
* Set a geometry that is rendered instead of the feature's 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
|
||||
*/
|
||||
Style.prototype.setGeometry = function (geometry) {
|
||||
if (typeof geometry === 'function') {
|
||||
this.geometryFunction_ = geometry;
|
||||
}
|
||||
else if (typeof geometry === 'string') {
|
||||
this.geometryFunction_ = function (feature) {
|
||||
return /** @type {import("../geom/Geometry.js").default} */ (feature.get(geometry));
|
||||
};
|
||||
}
|
||||
else if (!geometry) {
|
||||
this.geometryFunction_ = defaultGeometryFunction;
|
||||
}
|
||||
else if (geometry !== undefined) {
|
||||
this.geometryFunction_ = function () {
|
||||
return /** @type {import("../geom/Geometry.js").default} */ (geometry);
|
||||
};
|
||||
}
|
||||
this.geometry_ = geometry;
|
||||
};
|
||||
/**
|
||||
* Set the z-index.
|
||||
*
|
||||
* @param {number|undefined} zIndex ZIndex.
|
||||
* @api
|
||||
*/
|
||||
Style.prototype.setZIndex = function (zIndex) {
|
||||
this.zIndex_ = zIndex;
|
||||
};
|
||||
return Style;
|
||||
}());
|
||||
/**
|
||||
* Convert the provided object into a style function. Functions passed through
|
||||
* unchanged. Arrays of Style or single style objects wrapped in a
|
||||
* new style function.
|
||||
* @param {StyleFunction|Array<Style>|Style} obj
|
||||
* A style function, a single style, or an array of styles.
|
||||
* @return {StyleFunction} A style function.
|
||||
*/
|
||||
export function toFunction(obj) {
|
||||
var styleFunction;
|
||||
if (typeof obj === 'function') {
|
||||
styleFunction = obj;
|
||||
}
|
||||
else {
|
||||
/**
|
||||
* @type {Array<Style>}
|
||||
*/
|
||||
var styles_1;
|
||||
if (Array.isArray(obj)) {
|
||||
styles_1 = obj;
|
||||
}
|
||||
else {
|
||||
assert(typeof ( /** @type {?} */(obj).getZIndex) === 'function', 41); // Expected an `Style` or an array of `Style`
|
||||
var style = /** @type {Style} */ (obj);
|
||||
styles_1 = [style];
|
||||
}
|
||||
styleFunction = function () {
|
||||
return styles_1;
|
||||
};
|
||||
}
|
||||
return styleFunction;
|
||||
}
|
||||
/**
|
||||
* @type {Array<Style>|null}
|
||||
*/
|
||||
var defaultStyles = null;
|
||||
/**
|
||||
* @param {import("../Feature.js").FeatureLike} feature Feature.
|
||||
* @param {number} resolution Resolution.
|
||||
* @return {Array<Style>} 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. (import("./Circle.js").CircleStyle does
|
||||
// canvas.getContext('2d') at construction time, which will cause an.error
|
||||
// in such browsers.)
|
||||
if (!defaultStyles) {
|
||||
var fill = new Fill({
|
||||
color: 'rgba(255,255,255,0.4)',
|
||||
});
|
||||
var stroke = new Stroke({
|
||||
color: '#3399CC',
|
||||
width: 1.25,
|
||||
});
|
||||
defaultStyles = [
|
||||
new Style({
|
||||
image: new CircleStyle({
|
||||
fill: fill,
|
||||
stroke: stroke,
|
||||
radius: 5,
|
||||
}),
|
||||
fill: fill,
|
||||
stroke: stroke,
|
||||
}),
|
||||
];
|
||||
}
|
||||
return defaultStyles;
|
||||
}
|
||||
/**
|
||||
* Default styles for editing features.
|
||||
* @return {Object<import("../geom/Geometry.js").Type, Array<Style>>} Styles
|
||||
*/
|
||||
export function createEditingStyle() {
|
||||
/** @type {Object<import("../geom/Geometry.js").Type, Array<Style>>} */
|
||||
var styles = {};
|
||||
var white = [255, 255, 255, 1];
|
||||
var blue = [0, 153, 255, 1];
|
||||
var width = 3;
|
||||
styles['Polygon'] = [
|
||||
new Style({
|
||||
fill: new Fill({
|
||||
color: [255, 255, 255, 0.5],
|
||||
}),
|
||||
}),
|
||||
];
|
||||
styles['MultiPolygon'] = styles['Polygon'];
|
||||
styles['LineString'] = [
|
||||
new Style({
|
||||
stroke: new Stroke({
|
||||
color: white,
|
||||
width: width + 2,
|
||||
}),
|
||||
}),
|
||||
new Style({
|
||||
stroke: new Stroke({
|
||||
color: blue,
|
||||
width: width,
|
||||
}),
|
||||
}),
|
||||
];
|
||||
styles['MultiLineString'] = styles['LineString'];
|
||||
styles['Circle'] = styles['Polygon'].concat(styles['LineString']);
|
||||
styles['Point'] = [
|
||||
new Style({
|
||||
image: new CircleStyle({
|
||||
radius: width * 2,
|
||||
fill: new Fill({
|
||||
color: blue,
|
||||
}),
|
||||
stroke: new Stroke({
|
||||
color: white,
|
||||
width: width / 2,
|
||||
}),
|
||||
}),
|
||||
zIndex: Infinity,
|
||||
}),
|
||||
];
|
||||
styles['MultiPoint'] = styles['Point'];
|
||||
styles['GeometryCollection'] = styles['Polygon'].concat(styles['LineString'], styles['Point']);
|
||||
return styles;
|
||||
}
|
||||
/**
|
||||
* Function that is called with a feature and returns its default geometry.
|
||||
* @param {import("../Feature.js").FeatureLike} 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();
|
||||
}
|
||||
export default Style;
|
||||
//# sourceMappingURL=Style.js.map
|
||||
1
node_modules/ol/style/Style.js.map
generated
vendored
Normal file
1
node_modules/ol/style/Style.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
481
node_modules/ol/style/Text.d.ts
generated
vendored
Normal file
481
node_modules/ol/style/Text.d.ts
generated
vendored
Normal file
@@ -0,0 +1,481 @@
|
||||
export default Text;
|
||||
export type Options = {
|
||||
/**
|
||||
* Font style as CSS 'font' value, see:
|
||||
* https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font. Default is '10px sans-serif'
|
||||
*/
|
||||
font?: string | undefined;
|
||||
/**
|
||||
* When `placement` is set to `'line'`, allow a maximum angle between adjacent characters.
|
||||
* The expected value is in radians, and the default is 45° (`Math.PI / 4`).
|
||||
*/
|
||||
maxAngle?: number | undefined;
|
||||
/**
|
||||
* Horizontal text offset in pixels. A positive will shift the text right.
|
||||
*/
|
||||
offsetX?: number | undefined;
|
||||
/**
|
||||
* Vertical text offset in pixels. A positive will shift the text down.
|
||||
*/
|
||||
offsetY?: number | undefined;
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
overflow?: boolean | undefined;
|
||||
/**
|
||||
* Text placement.
|
||||
*/
|
||||
placement?: any | string;
|
||||
/**
|
||||
* Scale.
|
||||
*/
|
||||
scale?: number | import("../size.js").Size | undefined;
|
||||
/**
|
||||
* Whether to rotate the text with the view.
|
||||
*/
|
||||
rotateWithView?: boolean | undefined;
|
||||
/**
|
||||
* Rotation in radians (positive rotation clockwise).
|
||||
*/
|
||||
rotation?: number | undefined;
|
||||
/**
|
||||
* Text content or rich text content. For plain text provide a string, which can
|
||||
* contain line breaks (`\n`). For rich text provide an array of text/font tuples. A tuple consists of the text to
|
||||
* render and the font to use (or `''` to use the text style's font). A line break has to be a separate tuple (i.e. `'\n', ''`).
|
||||
* **Example:** `['foo', 'bold 10px sans-serif', ' bar', 'italic 10px sans-serif', ' baz', '']` will yield "**foo** *bar* baz".
|
||||
* **Note:** Rich text is not supported for the immediate rendering API.
|
||||
*/
|
||||
text?: string | string[] | undefined;
|
||||
/**
|
||||
* Text alignment. Possible values: 'left', 'right', 'center', 'end' or 'start'.
|
||||
* Default is 'center' for `placement: 'point'`. For `placement: 'line'`, the default is to let the renderer choose a
|
||||
* placement where `maxAngle` is not exceeded.
|
||||
*/
|
||||
textAlign?: string | undefined;
|
||||
/**
|
||||
* Text justification within the text box.
|
||||
* If not set, text is justified towards the `textAlign` anchor.
|
||||
* Otherwise, use options `'left'`, `'center'`, or `'right'` to justify the text within the text box.
|
||||
* **Note:** `justify` is ignored for immediate rendering and also for `placement: 'line'`.
|
||||
*/
|
||||
justify?: string | undefined;
|
||||
/**
|
||||
* Text base line. Possible values: 'bottom', 'top', 'middle', 'alphabetic',
|
||||
* 'hanging', 'ideographic'.
|
||||
*/
|
||||
textBaseline?: string | undefined;
|
||||
/**
|
||||
* Fill style. If none is provided, we'll use a dark fill-style (#333).
|
||||
*/
|
||||
fill?: Fill | undefined;
|
||||
/**
|
||||
* Stroke style.
|
||||
*/
|
||||
stroke?: import("./Stroke.js").default | undefined;
|
||||
/**
|
||||
* Fill style for the text background when `placement` is
|
||||
* `'point'`. Default is no fill.
|
||||
*/
|
||||
backgroundFill?: Fill | undefined;
|
||||
/**
|
||||
* Stroke style for the text background when `placement`
|
||||
* is `'point'`. Default is no stroke.
|
||||
*/
|
||||
backgroundStroke?: import("./Stroke.js").default | undefined;
|
||||
/**
|
||||
* Padding in pixels around the text for decluttering and background. The order of
|
||||
* values in the array is `[top, right, bottom, left]`.
|
||||
*/
|
||||
padding?: number[] | undefined;
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [font] Font style as CSS 'font' value, see:
|
||||
* https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font. Default is '10px sans-serif'
|
||||
* @property {number} [maxAngle=Math.PI/4] When `placement` is set to `'line'`, allow a maximum angle between adjacent characters.
|
||||
* The expected value is in radians, and the default is 45° (`Math.PI / 4`).
|
||||
* @property {number} [offsetX=0] Horizontal text offset in pixels. A positive will shift the text right.
|
||||
* @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 {import("./TextPlacement.js").default|string} [placement='point'] Text placement.
|
||||
* @property {number|import("../size.js").Size} [scale] Scale.
|
||||
* @property {boolean} [rotateWithView=false] Whether to rotate the text with the view.
|
||||
* @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).
|
||||
* @property {string|Array<string>} [text] Text content or rich text content. For plain text provide a string, which can
|
||||
* contain line breaks (`\n`). For rich text provide an array of text/font tuples. A tuple consists of the text to
|
||||
* render and the font to use (or `''` to use the text style's font). A line break has to be a separate tuple (i.e. `'\n', ''`).
|
||||
* **Example:** `['foo', 'bold 10px sans-serif', ' bar', 'italic 10px sans-serif', ' baz', '']` will yield "**foo** *bar* baz".
|
||||
* **Note:** Rich text is not supported for the immediate rendering API.
|
||||
* @property {string} [textAlign] Text alignment. Possible values: 'left', 'right', 'center', 'end' or 'start'.
|
||||
* Default is 'center' for `placement: 'point'`. For `placement: 'line'`, the default is to let the renderer choose a
|
||||
* placement where `maxAngle` is not exceeded.
|
||||
* @property {string} [justify] Text justification within the text box.
|
||||
* If not set, text is justified towards the `textAlign` anchor.
|
||||
* Otherwise, use options `'left'`, `'center'`, or `'right'` to justify the text within the text box.
|
||||
* **Note:** `justify` is ignored for immediate rendering and also for `placement: 'line'`.
|
||||
* @property {string} [textBaseline='middle'] Text base line. Possible values: 'bottom', 'top', 'middle', 'alphabetic',
|
||||
* 'hanging', 'ideographic'.
|
||||
* @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 {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]`.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Set text style for vector features.
|
||||
* @api
|
||||
*/
|
||||
declare class Text {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
constructor(opt_options?: Options | undefined);
|
||||
/**
|
||||
* @private
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
private font_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
private rotation_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean|undefined}
|
||||
*/
|
||||
private rotateWithView_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|import("../size.js").Size|undefined}
|
||||
*/
|
||||
private scale_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
private scaleArray_;
|
||||
/**
|
||||
* @private
|
||||
* @type {string|Array<string>|undefined}
|
||||
*/
|
||||
private text_;
|
||||
/**
|
||||
* @private
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
private textAlign_;
|
||||
/**
|
||||
* @private
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
private justify_;
|
||||
/**
|
||||
* @private
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
private textBaseline_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Fill.js").default}
|
||||
*/
|
||||
private fill_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private maxAngle_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./TextPlacement.js").default|string}
|
||||
*/
|
||||
private placement_;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
private overflow_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Stroke.js").default}
|
||||
*/
|
||||
private stroke_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private offsetX_;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
private offsetY_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Fill.js").default}
|
||||
*/
|
||||
private backgroundFill_;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Stroke.js").default}
|
||||
*/
|
||||
private backgroundStroke_;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>|null}
|
||||
*/
|
||||
private padding_;
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {Text} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
clone(): Text;
|
||||
/**
|
||||
* Get the `overflow` configuration.
|
||||
* @return {boolean} Let text overflow the length of the path they follow.
|
||||
* @api
|
||||
*/
|
||||
getOverflow(): boolean;
|
||||
/**
|
||||
* Get the font name.
|
||||
* @return {string|undefined} Font.
|
||||
* @api
|
||||
*/
|
||||
getFont(): string | undefined;
|
||||
/**
|
||||
* Get the maximum angle between adjacent characters.
|
||||
* @return {number} Angle in radians.
|
||||
* @api
|
||||
*/
|
||||
getMaxAngle(): number;
|
||||
/**
|
||||
* Get the label placement.
|
||||
* @return {import("./TextPlacement.js").default|string} Text placement.
|
||||
* @api
|
||||
*/
|
||||
getPlacement(): any | string;
|
||||
/**
|
||||
* Get the x-offset for the text.
|
||||
* @return {number} Horizontal text offset.
|
||||
* @api
|
||||
*/
|
||||
getOffsetX(): number;
|
||||
/**
|
||||
* Get the y-offset for the text.
|
||||
* @return {number} Vertical text offset.
|
||||
* @api
|
||||
*/
|
||||
getOffsetY(): number;
|
||||
/**
|
||||
* Get the fill style for the text.
|
||||
* @return {import("./Fill.js").default} Fill style.
|
||||
* @api
|
||||
*/
|
||||
getFill(): import("./Fill.js").default;
|
||||
/**
|
||||
* Determine whether the text rotates with the map.
|
||||
* @return {boolean|undefined} Rotate with map.
|
||||
* @api
|
||||
*/
|
||||
getRotateWithView(): boolean | undefined;
|
||||
/**
|
||||
* Get the text rotation.
|
||||
* @return {number|undefined} Rotation.
|
||||
* @api
|
||||
*/
|
||||
getRotation(): number | undefined;
|
||||
/**
|
||||
* Get the text scale.
|
||||
* @return {number|import("../size.js").Size|undefined} Scale.
|
||||
* @api
|
||||
*/
|
||||
getScale(): number | import("../size.js").Size | undefined;
|
||||
/**
|
||||
* Get the symbolizer scale array.
|
||||
* @return {import("../size.js").Size} Scale array.
|
||||
*/
|
||||
getScaleArray(): import("../size.js").Size;
|
||||
/**
|
||||
* Get the stroke style for the text.
|
||||
* @return {import("./Stroke.js").default} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
getStroke(): import("./Stroke.js").default;
|
||||
/**
|
||||
* Get the text to be rendered.
|
||||
* @return {string|Array<string>|undefined} Text.
|
||||
* @api
|
||||
*/
|
||||
getText(): string | Array<string> | undefined;
|
||||
/**
|
||||
* Get the text alignment.
|
||||
* @return {string|undefined} Text align.
|
||||
* @api
|
||||
*/
|
||||
getTextAlign(): string | undefined;
|
||||
/**
|
||||
* Get the justification.
|
||||
* @return {string|undefined} Justification.
|
||||
* @api
|
||||
*/
|
||||
getJustify(): string | undefined;
|
||||
/**
|
||||
* Get the text baseline.
|
||||
* @return {string|undefined} Text baseline.
|
||||
* @api
|
||||
*/
|
||||
getTextBaseline(): string | undefined;
|
||||
/**
|
||||
* Get the background fill style for the text.
|
||||
* @return {import("./Fill.js").default} Fill style.
|
||||
* @api
|
||||
*/
|
||||
getBackgroundFill(): import("./Fill.js").default;
|
||||
/**
|
||||
* Get the background stroke style for the text.
|
||||
* @return {import("./Stroke.js").default} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
getBackgroundStroke(): import("./Stroke.js").default;
|
||||
/**
|
||||
* Get the padding for the text.
|
||||
* @return {Array<number>|null} Padding.
|
||||
* @api
|
||||
*/
|
||||
getPadding(): Array<number> | null;
|
||||
/**
|
||||
* Set the `overflow` property.
|
||||
*
|
||||
* @param {boolean} overflow Let text overflow the path that it follows.
|
||||
* @api
|
||||
*/
|
||||
setOverflow(overflow: boolean): void;
|
||||
/**
|
||||
* Set the font.
|
||||
*
|
||||
* @param {string|undefined} font Font.
|
||||
* @api
|
||||
*/
|
||||
setFont(font: string | undefined): void;
|
||||
/**
|
||||
* Set the maximum angle between adjacent characters.
|
||||
*
|
||||
* @param {number} maxAngle Angle in radians.
|
||||
* @api
|
||||
*/
|
||||
setMaxAngle(maxAngle: number): void;
|
||||
/**
|
||||
* Set the x offset.
|
||||
*
|
||||
* @param {number} offsetX Horizontal text offset.
|
||||
* @api
|
||||
*/
|
||||
setOffsetX(offsetX: number): void;
|
||||
/**
|
||||
* Set the y offset.
|
||||
*
|
||||
* @param {number} offsetY Vertical text offset.
|
||||
* @api
|
||||
*/
|
||||
setOffsetY(offsetY: number): void;
|
||||
/**
|
||||
* Set the text placement.
|
||||
*
|
||||
* @param {import("./TextPlacement.js").default|string} placement Placement.
|
||||
* @api
|
||||
*/
|
||||
setPlacement(placement: any | string): void;
|
||||
/**
|
||||
* Set whether to rotate the text with the view.
|
||||
*
|
||||
* @param {boolean} rotateWithView Rotate with map.
|
||||
* @api
|
||||
*/
|
||||
setRotateWithView(rotateWithView: boolean): void;
|
||||
/**
|
||||
* Set the fill.
|
||||
*
|
||||
* @param {import("./Fill.js").default} fill Fill style.
|
||||
* @api
|
||||
*/
|
||||
setFill(fill: import("./Fill.js").default): void;
|
||||
/**
|
||||
* Set the rotation.
|
||||
*
|
||||
* @param {number|undefined} rotation Rotation.
|
||||
* @api
|
||||
*/
|
||||
setRotation(rotation: number | undefined): void;
|
||||
/**
|
||||
* Set the scale.
|
||||
*
|
||||
* @param {number|import("../size.js").Size|undefined} scale Scale.
|
||||
* @api
|
||||
*/
|
||||
setScale(scale: number | import("../size.js").Size | undefined): void;
|
||||
/**
|
||||
* Set the stroke.
|
||||
*
|
||||
* @param {import("./Stroke.js").default} stroke Stroke style.
|
||||
* @api
|
||||
*/
|
||||
setStroke(stroke: import("./Stroke.js").default): void;
|
||||
/**
|
||||
* Set the text.
|
||||
*
|
||||
* @param {string|Array<string>|undefined} text Text.
|
||||
* @api
|
||||
*/
|
||||
setText(text: string | Array<string> | undefined): void;
|
||||
/**
|
||||
* Set the text alignment.
|
||||
*
|
||||
* @param {string|undefined} textAlign Text align.
|
||||
* @api
|
||||
*/
|
||||
setTextAlign(textAlign: string | undefined): void;
|
||||
/**
|
||||
* Set the justification.
|
||||
*
|
||||
* @param {string|undefined} justify Justification.
|
||||
* @api
|
||||
*/
|
||||
setJustify(justify: string | undefined): void;
|
||||
/**
|
||||
* Set the text baseline.
|
||||
*
|
||||
* @param {string|undefined} textBaseline Text baseline.
|
||||
* @api
|
||||
*/
|
||||
setTextBaseline(textBaseline: string | undefined): void;
|
||||
/**
|
||||
* Set the background fill.
|
||||
*
|
||||
* @param {import("./Fill.js").default} fill Fill style.
|
||||
* @api
|
||||
*/
|
||||
setBackgroundFill(fill: import("./Fill.js").default): void;
|
||||
/**
|
||||
* Set the background stroke.
|
||||
*
|
||||
* @param {import("./Stroke.js").default} stroke Stroke style.
|
||||
* @api
|
||||
*/
|
||||
setBackgroundStroke(stroke: import("./Stroke.js").default): void;
|
||||
/**
|
||||
* Set the padding (`[top, right, bottom, left]`).
|
||||
*
|
||||
* @param {Array<number>|null} padding Padding.
|
||||
* @api
|
||||
*/
|
||||
setPadding(padding: Array<number> | null): void;
|
||||
}
|
||||
import Fill from "./Fill.js";
|
||||
//# sourceMappingURL=Text.d.ts.map
|
||||
1
node_modules/ol/style/Text.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/Text.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../src/style/Text.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAyBc,MAAqC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAVzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,+CA6HC;IA1HC;;;OAGG;IACH,cAAyB;IAEzB;;;OAGG;IACH,kBAAiC;IAEjC;;;OAGG;IACH,wBAA6C;IAE7C;;;OAGG;IACH,eAA2B;IAE3B;;;OAGG;IACH,oBAA0E;IAE1E;;;OAGG;IACH,cAAyB;IAEzB;;;OAGG;IACH,mBAAmC;IAEnC;;;OAGG;IACH,iBAA+B;IAE/B;;;OAGG;IACH,sBAAyC;IAEzC;;;OAGG;IACH,cAG2C;IAE3C;;;OAGG;IACH,kBACiE;IAEjE;;;OAGG;IACH,mBAC2E;IAE3E;;;OAGG;IACH,kBAAmC;IAEnC;;;OAGG;IACH,gBAAmE;IAEnE;;;OAGG;IACH,iBAAmE;IAEnE;;;OAGG;IACH,iBAAmE;IAEnE;;;OAGG;IACH,wBAEQ;IAER;;;OAGG;IACH,0BAEQ;IAER;;;OAGG;IACH,iBAAsE;IAGxE;;;;OAIG;IACH,SAHY,IAAI,CA6Bf;IAED;;;;OAIG;IACH,eAHY,OAAO,CAKlB;IAED;;;;OAIG;IACH,WAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,eAHY,MAAM,CAKjB;IAED;;;;OAIG;IACH,gBAHY,MAAqC,MAAM,CAKtD;IAED;;;;OAIG;IACH,cAHY,MAAM,CAKjB;IAED;;;;OAIG;IACH,cAHY,MAAM,CAKjB;IAED;;;;OAIG;IACH,WAHY,OAAO,WAAW,EAAE,OAAO,CAKtC;IAED;;;;OAIG;IACH,qBAHY,OAAO,GAAC,SAAS,CAK5B;IAED;;;;OAIG;IACH,eAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,YAHY,MAAM,GAAC,OAAO,YAAY,EAAE,IAAI,GAAC,SAAS,CAKrD;IAED;;;OAGG;IACH,iBAFY,OAAO,YAAY,EAAE,IAAI,CAIpC;IAED;;;;OAIG;IACH,aAHY,OAAO,aAAa,EAAE,OAAO,CAKxC;IAED;;;;OAIG;IACH,WAHY,MAAM,GAAC,MAAM,MAAM,CAAC,GAAC,SAAS,CAKzC;IAED;;;;OAIG;IACH,gBAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,cAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,mBAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,qBAHY,OAAO,WAAW,EAAE,OAAO,CAKtC;IAED;;;;OAIG;IACH,uBAHY,OAAO,aAAa,EAAE,OAAO,CAKxC;IAED;;;;OAIG;IACH,cAHY,MAAM,MAAM,CAAC,GAAC,IAAI,CAK7B;IAED;;;;;OAKG;IACH,sBAHW,OAAO,QAKjB;IAED;;;;;OAKG;IACH,cAHW,MAAM,GAAC,SAAS,QAK1B;IAED;;;;;OAKG;IACH,sBAHW,MAAM,QAKhB;IAED;;;;;OAKG;IACH,oBAHW,MAAM,QAKhB;IAED;;;;;OAKG;IACH,oBAHW,MAAM,QAKhB;IAED;;;;;OAKG;IACH,wBAHW,MAAqC,MAAM,QAKrD;IAED;;;;;OAKG;IACH,kCAHW,OAAO,QAKjB;IAED;;;;;OAKG;IACH,cAHW,OAAO,WAAW,EAAE,OAAO,QAKrC;IAED;;;;;OAKG;IACH,sBAHW,MAAM,GAAC,SAAS,QAK1B;IAED;;;;;OAKG;IACH,gBAHW,MAAM,GAAC,OAAO,YAAY,EAAE,IAAI,GAAC,SAAS,QAMpD;IAED;;;;;OAKG;IACH,kBAHW,OAAO,aAAa,EAAE,OAAO,QAKvC;IAED;;;;;OAKG;IACH,cAHW,MAAM,GAAC,MAAM,MAAM,CAAC,GAAC,SAAS,QAKxC;IAED;;;;;OAKG;IACH,wBAHW,MAAM,GAAC,SAAS,QAK1B;IAED;;;;;OAKG;IACH,oBAHW,MAAM,GAAC,SAAS,QAK1B;IAED;;;;;OAKG;IACH,8BAHW,MAAM,GAAC,SAAS,QAK1B;IAED;;;;;OAKG;IACH,wBAHW,OAAO,WAAW,EAAE,OAAO,QAKrC;IAED;;;;;OAKG;IACH,4BAHW,OAAO,aAAa,EAAE,OAAO,QAKvC;IAED;;;;;OAKG;IACH,oBAHW,MAAM,MAAM,CAAC,GAAC,IAAI,QAK5B;CACF"}
|
||||
516
node_modules/ol/style/Text.js
generated
vendored
Normal file
516
node_modules/ol/style/Text.js
generated
vendored
Normal file
@@ -0,0 +1,516 @@
|
||||
/**
|
||||
* @module ol/style/Text
|
||||
*/
|
||||
import Fill from './Fill.js';
|
||||
import TextPlacement from './TextPlacement.js';
|
||||
import { toSize } from '../size.js';
|
||||
/**
|
||||
* The default fill color to use if no fill was set at construction time; a
|
||||
* blackish `#333`.
|
||||
*
|
||||
* @const {string}
|
||||
*/
|
||||
var DEFAULT_FILL_COLOR = '#333';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [font] Font style as CSS 'font' value, see:
|
||||
* https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font. Default is '10px sans-serif'
|
||||
* @property {number} [maxAngle=Math.PI/4] When `placement` is set to `'line'`, allow a maximum angle between adjacent characters.
|
||||
* The expected value is in radians, and the default is 45° (`Math.PI / 4`).
|
||||
* @property {number} [offsetX=0] Horizontal text offset in pixels. A positive will shift the text right.
|
||||
* @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 {import("./TextPlacement.js").default|string} [placement='point'] Text placement.
|
||||
* @property {number|import("../size.js").Size} [scale] Scale.
|
||||
* @property {boolean} [rotateWithView=false] Whether to rotate the text with the view.
|
||||
* @property {number} [rotation=0] Rotation in radians (positive rotation clockwise).
|
||||
* @property {string|Array<string>} [text] Text content or rich text content. For plain text provide a string, which can
|
||||
* contain line breaks (`\n`). For rich text provide an array of text/font tuples. A tuple consists of the text to
|
||||
* render and the font to use (or `''` to use the text style's font). A line break has to be a separate tuple (i.e. `'\n', ''`).
|
||||
* **Example:** `['foo', 'bold 10px sans-serif', ' bar', 'italic 10px sans-serif', ' baz', '']` will yield "**foo** *bar* baz".
|
||||
* **Note:** Rich text is not supported for the immediate rendering API.
|
||||
* @property {string} [textAlign] Text alignment. Possible values: 'left', 'right', 'center', 'end' or 'start'.
|
||||
* Default is 'center' for `placement: 'point'`. For `placement: 'line'`, the default is to let the renderer choose a
|
||||
* placement where `maxAngle` is not exceeded.
|
||||
* @property {string} [justify] Text justification within the text box.
|
||||
* If not set, text is justified towards the `textAlign` anchor.
|
||||
* Otherwise, use options `'left'`, `'center'`, or `'right'` to justify the text within the text box.
|
||||
* **Note:** `justify` is ignored for immediate rendering and also for `placement: 'line'`.
|
||||
* @property {string} [textBaseline='middle'] Text base line. Possible values: 'bottom', 'top', 'middle', 'alphabetic',
|
||||
* 'hanging', 'ideographic'.
|
||||
* @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 {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]`.
|
||||
*/
|
||||
/**
|
||||
* @classdesc
|
||||
* Set text style for vector features.
|
||||
* @api
|
||||
*/
|
||||
var Text = /** @class */ (function () {
|
||||
/**
|
||||
* @param {Options} [opt_options] Options.
|
||||
*/
|
||||
function Text(opt_options) {
|
||||
var options = opt_options || {};
|
||||
/**
|
||||
* @private
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
this.font_ = options.font;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.rotation_ = options.rotation;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean|undefined}
|
||||
*/
|
||||
this.rotateWithView_ = options.rotateWithView;
|
||||
/**
|
||||
* @private
|
||||
* @type {number|import("../size.js").Size|undefined}
|
||||
*/
|
||||
this.scale_ = options.scale;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("../size.js").Size}
|
||||
*/
|
||||
this.scaleArray_ = toSize(options.scale !== undefined ? options.scale : 1);
|
||||
/**
|
||||
* @private
|
||||
* @type {string|Array<string>|undefined}
|
||||
*/
|
||||
this.text_ = options.text;
|
||||
/**
|
||||
* @private
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
this.textAlign_ = options.textAlign;
|
||||
/**
|
||||
* @private
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
this.justify_ = options.justify;
|
||||
/**
|
||||
* @private
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
this.textBaseline_ = options.textBaseline;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Fill.js").default}
|
||||
*/
|
||||
this.fill_ =
|
||||
options.fill !== undefined
|
||||
? options.fill
|
||||
: new Fill({ color: DEFAULT_FILL_COLOR });
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.maxAngle_ =
|
||||
options.maxAngle !== undefined ? options.maxAngle : Math.PI / 4;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./TextPlacement.js").default|string}
|
||||
*/
|
||||
this.placement_ =
|
||||
options.placement !== undefined ? options.placement : TextPlacement.POINT;
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.overflow_ = !!options.overflow;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Stroke.js").default}
|
||||
*/
|
||||
this.stroke_ = options.stroke !== undefined ? options.stroke : null;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.offsetX_ = options.offsetX !== undefined ? options.offsetX : 0;
|
||||
/**
|
||||
* @private
|
||||
* @type {number}
|
||||
*/
|
||||
this.offsetY_ = options.offsetY !== undefined ? options.offsetY : 0;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Fill.js").default}
|
||||
*/
|
||||
this.backgroundFill_ = options.backgroundFill
|
||||
? options.backgroundFill
|
||||
: null;
|
||||
/**
|
||||
* @private
|
||||
* @type {import("./Stroke.js").default}
|
||||
*/
|
||||
this.backgroundStroke_ = options.backgroundStroke
|
||||
? options.backgroundStroke
|
||||
: null;
|
||||
/**
|
||||
* @private
|
||||
* @type {Array<number>|null}
|
||||
*/
|
||||
this.padding_ = options.padding === undefined ? null : options.padding;
|
||||
}
|
||||
/**
|
||||
* Clones the style.
|
||||
* @return {Text} The cloned style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.clone = function () {
|
||||
var scale = this.getScale();
|
||||
return new Text({
|
||||
font: this.getFont(),
|
||||
placement: this.getPlacement(),
|
||||
maxAngle: this.getMaxAngle(),
|
||||
overflow: this.getOverflow(),
|
||||
rotation: this.getRotation(),
|
||||
rotateWithView: this.getRotateWithView(),
|
||||
scale: Array.isArray(scale) ? scale.slice() : scale,
|
||||
text: this.getText(),
|
||||
textAlign: this.getTextAlign(),
|
||||
justify: this.getJustify(),
|
||||
textBaseline: this.getTextBaseline(),
|
||||
fill: this.getFill() ? this.getFill().clone() : undefined,
|
||||
stroke: this.getStroke() ? this.getStroke().clone() : undefined,
|
||||
offsetX: this.getOffsetX(),
|
||||
offsetY: this.getOffsetY(),
|
||||
backgroundFill: this.getBackgroundFill()
|
||||
? this.getBackgroundFill().clone()
|
||||
: undefined,
|
||||
backgroundStroke: this.getBackgroundStroke()
|
||||
? this.getBackgroundStroke().clone()
|
||||
: undefined,
|
||||
padding: this.getPadding() || undefined,
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Get the `overflow` configuration.
|
||||
* @return {boolean} Let text overflow the length of the path they follow.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getOverflow = function () {
|
||||
return this.overflow_;
|
||||
};
|
||||
/**
|
||||
* Get the font name.
|
||||
* @return {string|undefined} Font.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getFont = function () {
|
||||
return this.font_;
|
||||
};
|
||||
/**
|
||||
* Get the maximum angle between adjacent characters.
|
||||
* @return {number} Angle in radians.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getMaxAngle = function () {
|
||||
return this.maxAngle_;
|
||||
};
|
||||
/**
|
||||
* Get the label placement.
|
||||
* @return {import("./TextPlacement.js").default|string} Text placement.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getPlacement = function () {
|
||||
return this.placement_;
|
||||
};
|
||||
/**
|
||||
* Get the x-offset for the text.
|
||||
* @return {number} Horizontal text offset.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getOffsetX = function () {
|
||||
return this.offsetX_;
|
||||
};
|
||||
/**
|
||||
* Get the y-offset for the text.
|
||||
* @return {number} Vertical text offset.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getOffsetY = function () {
|
||||
return this.offsetY_;
|
||||
};
|
||||
/**
|
||||
* Get the fill style for the text.
|
||||
* @return {import("./Fill.js").default} Fill style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getFill = function () {
|
||||
return this.fill_;
|
||||
};
|
||||
/**
|
||||
* Determine whether the text rotates with the map.
|
||||
* @return {boolean|undefined} Rotate with map.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getRotateWithView = function () {
|
||||
return this.rotateWithView_;
|
||||
};
|
||||
/**
|
||||
* Get the text rotation.
|
||||
* @return {number|undefined} Rotation.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getRotation = function () {
|
||||
return this.rotation_;
|
||||
};
|
||||
/**
|
||||
* Get the text scale.
|
||||
* @return {number|import("../size.js").Size|undefined} Scale.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getScale = function () {
|
||||
return this.scale_;
|
||||
};
|
||||
/**
|
||||
* Get the symbolizer scale array.
|
||||
* @return {import("../size.js").Size} Scale array.
|
||||
*/
|
||||
Text.prototype.getScaleArray = function () {
|
||||
return this.scaleArray_;
|
||||
};
|
||||
/**
|
||||
* Get the stroke style for the text.
|
||||
* @return {import("./Stroke.js").default} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getStroke = function () {
|
||||
return this.stroke_;
|
||||
};
|
||||
/**
|
||||
* Get the text to be rendered.
|
||||
* @return {string|Array<string>|undefined} Text.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getText = function () {
|
||||
return this.text_;
|
||||
};
|
||||
/**
|
||||
* Get the text alignment.
|
||||
* @return {string|undefined} Text align.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getTextAlign = function () {
|
||||
return this.textAlign_;
|
||||
};
|
||||
/**
|
||||
* Get the justification.
|
||||
* @return {string|undefined} Justification.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getJustify = function () {
|
||||
return this.justify_;
|
||||
};
|
||||
/**
|
||||
* Get the text baseline.
|
||||
* @return {string|undefined} Text baseline.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getTextBaseline = function () {
|
||||
return this.textBaseline_;
|
||||
};
|
||||
/**
|
||||
* Get the background fill style for the text.
|
||||
* @return {import("./Fill.js").default} Fill style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getBackgroundFill = function () {
|
||||
return this.backgroundFill_;
|
||||
};
|
||||
/**
|
||||
* Get the background stroke style for the text.
|
||||
* @return {import("./Stroke.js").default} Stroke style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getBackgroundStroke = function () {
|
||||
return this.backgroundStroke_;
|
||||
};
|
||||
/**
|
||||
* Get the padding for the text.
|
||||
* @return {Array<number>|null} Padding.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.getPadding = function () {
|
||||
return this.padding_;
|
||||
};
|
||||
/**
|
||||
* Set the `overflow` property.
|
||||
*
|
||||
* @param {boolean} overflow Let text overflow the path that it follows.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setOverflow = function (overflow) {
|
||||
this.overflow_ = overflow;
|
||||
};
|
||||
/**
|
||||
* Set the font.
|
||||
*
|
||||
* @param {string|undefined} font Font.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setFont = function (font) {
|
||||
this.font_ = font;
|
||||
};
|
||||
/**
|
||||
* Set the maximum angle between adjacent characters.
|
||||
*
|
||||
* @param {number} maxAngle Angle in radians.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setMaxAngle = function (maxAngle) {
|
||||
this.maxAngle_ = maxAngle;
|
||||
};
|
||||
/**
|
||||
* Set the x offset.
|
||||
*
|
||||
* @param {number} offsetX Horizontal text offset.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setOffsetX = function (offsetX) {
|
||||
this.offsetX_ = offsetX;
|
||||
};
|
||||
/**
|
||||
* Set the y offset.
|
||||
*
|
||||
* @param {number} offsetY Vertical text offset.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setOffsetY = function (offsetY) {
|
||||
this.offsetY_ = offsetY;
|
||||
};
|
||||
/**
|
||||
* Set the text placement.
|
||||
*
|
||||
* @param {import("./TextPlacement.js").default|string} placement Placement.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setPlacement = function (placement) {
|
||||
this.placement_ = placement;
|
||||
};
|
||||
/**
|
||||
* Set whether to rotate the text with the view.
|
||||
*
|
||||
* @param {boolean} rotateWithView Rotate with map.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setRotateWithView = function (rotateWithView) {
|
||||
this.rotateWithView_ = rotateWithView;
|
||||
};
|
||||
/**
|
||||
* Set the fill.
|
||||
*
|
||||
* @param {import("./Fill.js").default} fill Fill style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setFill = function (fill) {
|
||||
this.fill_ = fill;
|
||||
};
|
||||
/**
|
||||
* Set the rotation.
|
||||
*
|
||||
* @param {number|undefined} rotation Rotation.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setRotation = function (rotation) {
|
||||
this.rotation_ = rotation;
|
||||
};
|
||||
/**
|
||||
* Set the scale.
|
||||
*
|
||||
* @param {number|import("../size.js").Size|undefined} scale Scale.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setScale = function (scale) {
|
||||
this.scale_ = scale;
|
||||
this.scaleArray_ = toSize(scale !== undefined ? scale : 1);
|
||||
};
|
||||
/**
|
||||
* Set the stroke.
|
||||
*
|
||||
* @param {import("./Stroke.js").default} stroke Stroke style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setStroke = function (stroke) {
|
||||
this.stroke_ = stroke;
|
||||
};
|
||||
/**
|
||||
* Set the text.
|
||||
*
|
||||
* @param {string|Array<string>|undefined} text Text.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setText = function (text) {
|
||||
this.text_ = text;
|
||||
};
|
||||
/**
|
||||
* Set the text alignment.
|
||||
*
|
||||
* @param {string|undefined} textAlign Text align.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setTextAlign = function (textAlign) {
|
||||
this.textAlign_ = textAlign;
|
||||
};
|
||||
/**
|
||||
* Set the justification.
|
||||
*
|
||||
* @param {string|undefined} justify Justification.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setJustify = function (justify) {
|
||||
this.justify_ = justify;
|
||||
};
|
||||
/**
|
||||
* Set the text baseline.
|
||||
*
|
||||
* @param {string|undefined} textBaseline Text baseline.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setTextBaseline = function (textBaseline) {
|
||||
this.textBaseline_ = textBaseline;
|
||||
};
|
||||
/**
|
||||
* Set the background fill.
|
||||
*
|
||||
* @param {import("./Fill.js").default} fill Fill style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setBackgroundFill = function (fill) {
|
||||
this.backgroundFill_ = fill;
|
||||
};
|
||||
/**
|
||||
* Set the background stroke.
|
||||
*
|
||||
* @param {import("./Stroke.js").default} stroke Stroke style.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setBackgroundStroke = function (stroke) {
|
||||
this.backgroundStroke_ = stroke;
|
||||
};
|
||||
/**
|
||||
* Set the padding (`[top, right, bottom, left]`).
|
||||
*
|
||||
* @param {Array<number>|null} padding Padding.
|
||||
* @api
|
||||
*/
|
||||
Text.prototype.setPadding = function (padding) {
|
||||
this.padding_ = padding;
|
||||
};
|
||||
return Text;
|
||||
}());
|
||||
export default Text;
|
||||
//# sourceMappingURL=Text.js.map
|
||||
1
node_modules/ol/style/Text.js.map
generated
vendored
Normal file
1
node_modules/ol/style/Text.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/ol/style/TextPlacement.d.ts
generated
vendored
Normal file
6
node_modules/ol/style/TextPlacement.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
declare namespace _default {
|
||||
const POINT: string;
|
||||
const LINE: string;
|
||||
}
|
||||
export default _default;
|
||||
//# sourceMappingURL=TextPlacement.d.ts.map
|
||||
1
node_modules/ol/style/TextPlacement.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/TextPlacement.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"TextPlacement.d.ts","sourceRoot":"","sources":["../src/style/TextPlacement.js"],"names":[],"mappings":""}
|
||||
15
node_modules/ol/style/TextPlacement.js
generated
vendored
Normal file
15
node_modules/ol/style/TextPlacement.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @module ol/style/TextPlacement
|
||||
*/
|
||||
/**
|
||||
* Text placement. One of `'point'`, `'line'`. Default is `'point'`. Note that
|
||||
* `'line'` requires the underlying geometry to be a {@link module:ol/geom/LineString~LineString},
|
||||
* {@link module:ol/geom/Polygon~Polygon}, {@link module:ol/geom/MultiLineString~MultiLineString} or
|
||||
* {@link module:ol/geom/MultiPolygon~MultiPolygon}.
|
||||
* @enum {string}
|
||||
*/
|
||||
export default {
|
||||
POINT: 'point',
|
||||
LINE: 'line',
|
||||
};
|
||||
//# sourceMappingURL=TextPlacement.js.map
|
||||
1
node_modules/ol/style/TextPlacement.js.map
generated
vendored
Normal file
1
node_modules/ol/style/TextPlacement.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"TextPlacement.js","sourceRoot":"","sources":["../src/style/TextPlacement.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;GAMG;AACH,eAAe;IACb,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACb,CAAC"}
|
||||
247
node_modules/ol/style/expressions.d.ts
generated
vendored
Normal file
247
node_modules/ol/style/expressions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
/**
|
||||
* Returns the possible types for a given value (each type being a binary flag)
|
||||
* To test a value use e.g. `getValueType(v) & ValueTypes.BOOLEAN`
|
||||
* @param {ExpressionValue} value Value
|
||||
* @return {ValueTypes|number} Type or types inferred from the value
|
||||
*/
|
||||
export function getValueType(value: ExpressionValue): ValueTypes | number;
|
||||
/**
|
||||
* Checks if only one value type is enabled in the input number.
|
||||
* @param {ValueTypes|number} valueType Number containing value type binary flags
|
||||
* @return {boolean} True if only one type flag is enabled, false if zero or multiple
|
||||
*/
|
||||
export function isTypeUnique(valueType: ValueTypes | number): boolean;
|
||||
/**
|
||||
* Context available during the parsing of an expression.
|
||||
* @typedef {Object} ParsingContext
|
||||
* @property {boolean} [inFragmentShader] If false, means the expression output should be made for a vertex shader
|
||||
* @property {Array<string>} variables List of variables used in the expression; contains **unprefixed names**
|
||||
* @property {Array<string>} attributes List of attributes used in the expression; contains **unprefixed names**
|
||||
* @property {Object<string, number>} stringLiteralsMap This object maps all encountered string values to a number
|
||||
* @property {Object<string, string>} functions Lookup of functions used by the style.
|
||||
* @property {number} [bandCount] Number of bands per pixel.
|
||||
* @property {Array<PaletteTexture>} [paletteTextures] List of palettes used by the style.
|
||||
*/
|
||||
/**
|
||||
* Will return the number as a float with a dot separator, which is required by GLSL.
|
||||
* @param {number} v Numerical value.
|
||||
* @return {string} The value as string.
|
||||
*/
|
||||
export function numberToGlsl(v: number): string;
|
||||
/**
|
||||
* Will return the number array as a float with a dot separator, concatenated with ', '.
|
||||
* @param {Array<number>} array Numerical values array.
|
||||
* @return {string} The array as a vector, e. g.: `vec3(1.0, 2.0, 3.0)`.
|
||||
*/
|
||||
export function arrayToGlsl(array: Array<number>): string;
|
||||
/**
|
||||
* Will normalize and converts to string a `vec4` color array compatible with GLSL.
|
||||
* @param {string|import("../color.js").Color} color Color either in string format or [r, g, b, a] array format,
|
||||
* with RGB components in the 0..255 range and the alpha component in the 0..1 range.
|
||||
* Note that the final array will always have 4 components.
|
||||
* @return {string} The color expressed in the `vec4(1.0, 1.0, 1.0, 1.0)` form.
|
||||
*/
|
||||
export function colorToGlsl(color: string | import("../color.js").Color): string;
|
||||
/**
|
||||
* Returns a stable equivalent number for the string literal.
|
||||
* @param {ParsingContext} context Parsing context
|
||||
* @param {string} string String literal value
|
||||
* @return {number} Number equivalent
|
||||
*/
|
||||
export function getStringNumberEquivalent(context: ParsingContext, string: string): number;
|
||||
/**
|
||||
* Returns a stable equivalent number for the string literal, for use in shaders. This number is then
|
||||
* converted to be a GLSL-compatible string.
|
||||
* @param {ParsingContext} context Parsing context
|
||||
* @param {string} string String literal value
|
||||
* @return {string} GLSL-compatible string containing a number
|
||||
*/
|
||||
export function stringToGlsl(context: ParsingContext, string: string): string;
|
||||
/**
|
||||
* Recursively parses a style expression and outputs a GLSL-compatible string. Takes in a parsing context that
|
||||
* will be read and modified during the parsing operation.
|
||||
* @param {ParsingContext} context Parsing context
|
||||
* @param {ExpressionValue} value Value
|
||||
* @param {ValueTypes|number} [typeHint] Hint for the expected final type (can be several types combined)
|
||||
* @return {string} GLSL-compatible output
|
||||
*/
|
||||
export function expressionToGlsl(context: ParsingContext, value: ExpressionValue, typeHint?: number | undefined): string;
|
||||
/**
|
||||
* Get the uniform name given a variable name.
|
||||
* @param {string} variableName The variable name.
|
||||
* @return {string} The uniform name.
|
||||
*/
|
||||
export function uniformNameForVariable(variableName: string): string;
|
||||
/**
|
||||
* Possible inferred types from a given value or expression.
|
||||
* Note: these are binary flags.
|
||||
*/
|
||||
export type ValueTypes = number;
|
||||
export namespace ValueTypes {
|
||||
const NUMBER: number;
|
||||
const STRING: number;
|
||||
const COLOR: number;
|
||||
const BOOLEAN: number;
|
||||
const NUMBER_ARRAY: number;
|
||||
const ANY: number;
|
||||
const NONE: number;
|
||||
}
|
||||
/**
|
||||
* An operator declaration must contain two methods: `getReturnType` which returns a type based on
|
||||
* the operator arguments, and `toGlsl` which returns a GLSL-compatible string.
|
||||
* Note: both methods can process arguments recursively.
|
||||
* @typedef {Object} Operator
|
||||
* @property {function(Array<ExpressionValue>): ValueTypes|number} getReturnType Returns one or several types
|
||||
* @property {function(ParsingContext, Array<ExpressionValue>, ValueTypes=): string} toGlsl Returns a GLSL-compatible string
|
||||
* Note: takes in an optional type hint as 3rd parameter
|
||||
*/
|
||||
/**
|
||||
* Operator declarations
|
||||
* @type {Object<string, Operator>}
|
||||
*/
|
||||
export const Operators: {
|
||||
[x: string]: Operator;
|
||||
};
|
||||
export const PALETTE_TEXTURE_ARRAY: "u_paletteTextures";
|
||||
/**
|
||||
* Context available during the parsing of an expression.
|
||||
*/
|
||||
export type ParsingContext = {
|
||||
/**
|
||||
* If false, means the expression output should be made for a vertex shader
|
||||
*/
|
||||
inFragmentShader?: boolean | undefined;
|
||||
/**
|
||||
* List of variables used in the expression; contains **unprefixed names**
|
||||
*/
|
||||
variables: Array<string>;
|
||||
/**
|
||||
* List of attributes used in the expression; contains **unprefixed names**
|
||||
*/
|
||||
attributes: Array<string>;
|
||||
/**
|
||||
* This object maps all encountered string values to a number
|
||||
*/
|
||||
stringLiteralsMap: {
|
||||
[x: string]: number;
|
||||
};
|
||||
/**
|
||||
* Lookup of functions used by the style.
|
||||
*/
|
||||
functions: {
|
||||
[x: string]: string;
|
||||
};
|
||||
/**
|
||||
* Number of bands per pixel.
|
||||
*/
|
||||
bandCount?: number | undefined;
|
||||
/**
|
||||
* List of palettes used by the style.
|
||||
*/
|
||||
paletteTextures?: PaletteTexture[] | undefined;
|
||||
};
|
||||
/**
|
||||
* Base type used for literal style parameters; can be a number literal or the output of an operator,
|
||||
* which in turns takes {@link import ("./expressions.js").ExpressionValue} arguments.
|
||||
*
|
||||
* The following operators can be used:
|
||||
*
|
||||
* * Reading operators:
|
||||
* * `['band', bandIndex, xOffset, yOffset]` For tile layers only. Fetches pixel values from band
|
||||
* `bandIndex` of the source's data. The first `bandIndex` of the source data is `1`. Fetched values
|
||||
* are in the 0..1 range. {@link import ("../source/TileImage.js").default} sources have 4 bands: red,
|
||||
* green, blue and alpha. {@link import ("../source/DataTile.js").default} sources can have any number
|
||||
* of bands, depending on the underlying data source and
|
||||
* {@link import ("../source/GeoTIFF.js").Options configuration}. `xOffset` and `yOffset` are optional
|
||||
* and allow specifying pixel offsets for x and y. This is used for sampling data from neighboring pixels.
|
||||
* * `['get', 'attributeName']` fetches a feature attribute (it will be prefixed by `a_` in the shader)
|
||||
* Note: those will be taken from the attributes provided to the renderer
|
||||
* * `['resolution']` returns the current resolution
|
||||
* * `['time']` returns the time in seconds since the creation of the layer
|
||||
* * `['var', 'varName']` fetches a value from the style variables, or 0 if undefined
|
||||
* * `['zoom']` returns the current zoom level
|
||||
*
|
||||
* * Math operators:
|
||||
* * `['*', value1, value2]` multiplies `value1` by `value2`
|
||||
* * `['/', value1, value2]` divides `value1` by `value2`
|
||||
* * `['+', value1, value2]` adds `value1` and `value2`
|
||||
* * `['-', value1, value2]` subtracts `value2` from `value1`
|
||||
* * `['clamp', value, low, high]` clamps `value` between `low` and `high`
|
||||
* * `['%', value1, value2]` returns the result of `value1 % value2` (modulo)
|
||||
* * `['^', value1, value2]` returns the value of `value1` raised to the `value2` power
|
||||
* * `['abs', value1]` returns the absolute value of `value1`
|
||||
* * `['floor', value1]` returns the nearest integer less than or equal to `value1`
|
||||
* * `['round', value1]` returns the nearest integer to `value1`
|
||||
* * `['ceil', value1]` returns the nearest integer greater than or equal to `value1`
|
||||
* * `['sin', value1]` returns the sine of `value1`
|
||||
* * `['cos', value1]` returns the cosine of `value1`
|
||||
* * `['atan', value1, value2]` returns `atan2(value1, value2)`. If `value2` is not provided, returns `atan(value1)`
|
||||
*
|
||||
* * Transform operators:
|
||||
* * `['case', condition1, output1, ...conditionN, outputN, fallback]` selects the first output whose corresponding
|
||||
* condition evaluates to `true`. If no match is found, returns the `fallback` value.
|
||||
* All conditions should be `boolean`, output and fallback can be any kind.
|
||||
* * `['match', input, match1, output1, ...matchN, outputN, fallback]` compares the `input` value against all
|
||||
* provided `matchX` values, returning the output associated with the first valid match. If no match is found,
|
||||
* returns the `fallback` value.
|
||||
* `input` and `matchX` values must all be of the same type, and can be `number` or `string`. `outputX` and
|
||||
* `fallback` values must be of the same type, and can be of any kind.
|
||||
* * `['interpolate', interpolation, input, stop1, output1, ...stopN, outputN]` returns a value by interpolating between
|
||||
* pairs of inputs and outputs; `interpolation` can either be `['linear']` or `['exponential', base]` where `base` is
|
||||
* the rate of increase from stop A to stop B (i.e. power to which the interpolation ratio is raised); a value
|
||||
* of 1 is equivalent to `['linear']`.
|
||||
* `input` and `stopX` values must all be of type `number`. `outputX` values can be `number` or `color` values.
|
||||
* Note: `input` will be clamped between `stop1` and `stopN`, meaning that all output values will be comprised
|
||||
* between `output1` and `outputN`.
|
||||
*
|
||||
* * Logical operators:
|
||||
* * `['<', value1, value2]` returns `true` if `value1` is strictly lower than `value2`, or `false` otherwise.
|
||||
* * `['<=', value1, value2]` returns `true` if `value1` is lower than or equals `value2`, or `false` otherwise.
|
||||
* * `['>', value1, value2]` returns `true` if `value1` is strictly greater than `value2`, or `false` otherwise.
|
||||
* * `['>=', value1, value2]` returns `true` if `value1` is greater than or equals `value2`, or `false` otherwise.
|
||||
* * `['==', value1, value2]` returns `true` if `value1` equals `value2`, or `false` otherwise.
|
||||
* * `['!=', value1, value2]` returns `true` if `value1` does not equal `value2`, or `false` otherwise.
|
||||
* * `['!', value1]` returns `false` if `value1` is `true` or greater than `0`, or `true` otherwise.
|
||||
* * `['all', value1, value2, ...]` returns `true` if all the inputs are `true`, `false` otherwise.
|
||||
* * `['any', value1, value2, ...]` returns `true` if any of the inputs are `true`, `false` otherwise.
|
||||
* * `['between', value1, value2, value3]` returns `true` if `value1` is contained between `value2` and `value3`
|
||||
* (inclusively), or `false` otherwise.
|
||||
*
|
||||
* * Conversion operators:
|
||||
* * `['array', value1, ...valueN]` creates a numerical array from `number` values; please note that the amount of
|
||||
* values can currently only be 2, 3 or 4.
|
||||
* * `['color', red, green, blue, alpha]` creates a `color` value from `number` values; the `alpha` parameter is
|
||||
* optional; if not specified, it will be set to 1.
|
||||
* Note: `red`, `green` and `blue` components must be values between 0 and 255; `alpha` between 0 and 1.
|
||||
* * `['palette', index, colors]` picks a `color` value from an array of colors using the given index; the `index`
|
||||
* expression must evaluate to a number; the items in the `colors` array must be strings with hex colors
|
||||
* (e.g. `'#86A136'`), colors using the rgba[a] functional notation (e.g. `'rgb(134, 161, 54)'` or `'rgba(134, 161, 54, 1)'`),
|
||||
* named colors (e.g. `'red'`), or array literals with 3 ([r, g, b]) or 4 ([r, g, b, a]) values (with r, g, and b
|
||||
* in the 0-255 range and a in the 0-1 range).
|
||||
*
|
||||
* Values can either be literals or another operator, as they will be evaluated recursively.
|
||||
* Literal values can be of the following types:
|
||||
* * `boolean`
|
||||
* * `number`
|
||||
* * `string`
|
||||
* * {@link module :ol/color~Color}
|
||||
*/
|
||||
export type ExpressionValue = Array<any> | import("../color.js").Color | string | number | boolean;
|
||||
/**
|
||||
* An operator declaration must contain two methods: `getReturnType` which returns a type based on
|
||||
* the operator arguments, and `toGlsl` which returns a GLSL-compatible string.
|
||||
* Note: both methods can process arguments recursively.
|
||||
*/
|
||||
export type Operator = {
|
||||
/**
|
||||
* Returns one or several types
|
||||
*/
|
||||
getReturnType: (arg0: Array<ExpressionValue>) => ValueTypes | number;
|
||||
/**
|
||||
* Returns a GLSL-compatible string
|
||||
* Note: takes in an optional type hint as 3rd parameter
|
||||
*/
|
||||
toGlsl: (arg0: ParsingContext, arg1: Array<ExpressionValue>, arg2: ValueTypes | undefined) => string;
|
||||
};
|
||||
import PaletteTexture from "../webgl/PaletteTexture.js";
|
||||
//# sourceMappingURL=expressions.d.ts.map
|
||||
1
node_modules/ol/style/expressions.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/expressions.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"expressions.d.ts","sourceRoot":"","sources":["../src/style/expressions.js"],"names":[],"mappings":"AAmIA;;;;;GAKG;AACH,oCAHW,eAAe,GACd,UAAU,GAAC,MAAM,CA0C5B;AAED;;;;GAIG;AACH,wCAHW,UAAU,GAAC,MAAM,GAChB,OAAO,CAIlB;AAED;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH,gCAHW,MAAM,GACL,MAAM,CAKjB;AAED;;;;GAIG;AACH,mCAHW,MAAM,MAAM,CAAC,GACZ,MAAM,CASjB;AAED;;;;;;GAMG;AACH,mCALW,MAAM,GAAC,OAAO,aAAa,EAAE,KAAK,GAGjC,MAAM,CAYjB;AAED;;;;;GAKG;AACH,mDAJW,cAAc,UACd,MAAM,GACL,MAAM,CASjB;AAED;;;;;;GAMG;AACH,sCAJW,cAAc,UACd,MAAM,GACL,MAAM,CAIjB;AAED;;;;;;;GAOG;AACH,0CALW,cAAc,SACd,eAAe,kCAEd,MAAM,CA0CjB;AAyFD;;;;GAIG;AACH,qDAHW,MAAM,GACL,MAAM,CAIjB;;;;;yBAtTS,MAAM;;;;;;;;;;AAYhB;;;;;;;;GAQG;AAEH;;;GAGG;AACH;QAFiB,MAAM,GAAE,QAAQ;EAEL;AA6S5B,wDAAyD;;;;;;;;;;;;eA9O3C,MAAM,MAAM,CAAC;;;;gBACb,MAAM,MAAM,CAAC;;;;;YACN,MAAM,GAAE,MAAM;;;;;;YACd,MAAM,GAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAnGtB,UAAQ,GAAC,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,GAAC,MAAM,GAAC,OAAO;;;;;;;;;;0BAwBhD,MAAM,eAAe,CAAC,KAAG,UAAU,GAAC,MAAM;;;;;mBAC1C,cAAc,QAAE,MAAM,eAAe,CAAC,QAAE,UAAU,iBAAI,MAAM"}
|
||||
864
node_modules/ol/style/expressions.js
generated
vendored
Normal file
864
node_modules/ol/style/expressions.js
generated
vendored
Normal file
@@ -0,0 +1,864 @@
|
||||
/**
|
||||
* Operators and utilities used for style expressions
|
||||
* @module ol/style/expressions
|
||||
*/
|
||||
import PaletteTexture from '../webgl/PaletteTexture.js';
|
||||
import { Uniforms } from '../renderer/webgl/TileLayer.js';
|
||||
import { asArray, fromString, isStringColor } from '../color.js';
|
||||
import { log2 } from '../math.js';
|
||||
/**
|
||||
* Base type used for literal style parameters; can be a number literal or the output of an operator,
|
||||
* which in turns takes {@link import("./expressions.js").ExpressionValue} arguments.
|
||||
*
|
||||
* The following operators can be used:
|
||||
*
|
||||
* * Reading operators:
|
||||
* * `['band', bandIndex, xOffset, yOffset]` For tile layers only. Fetches pixel values from band
|
||||
* `bandIndex` of the source's data. The first `bandIndex` of the source data is `1`. Fetched values
|
||||
* are in the 0..1 range. {@link import("../source/TileImage.js").default} sources have 4 bands: red,
|
||||
* green, blue and alpha. {@link import("../source/DataTile.js").default} sources can have any number
|
||||
* of bands, depending on the underlying data source and
|
||||
* {@link import("../source/GeoTIFF.js").Options configuration}. `xOffset` and `yOffset` are optional
|
||||
* and allow specifying pixel offsets for x and y. This is used for sampling data from neighboring pixels.
|
||||
* * `['get', 'attributeName']` fetches a feature attribute (it will be prefixed by `a_` in the shader)
|
||||
* Note: those will be taken from the attributes provided to the renderer
|
||||
* * `['resolution']` returns the current resolution
|
||||
* * `['time']` returns the time in seconds since the creation of the layer
|
||||
* * `['var', 'varName']` fetches a value from the style variables, or 0 if undefined
|
||||
* * `['zoom']` returns the current zoom level
|
||||
*
|
||||
* * Math operators:
|
||||
* * `['*', value1, value2]` multiplies `value1` by `value2`
|
||||
* * `['/', value1, value2]` divides `value1` by `value2`
|
||||
* * `['+', value1, value2]` adds `value1` and `value2`
|
||||
* * `['-', value1, value2]` subtracts `value2` from `value1`
|
||||
* * `['clamp', value, low, high]` clamps `value` between `low` and `high`
|
||||
* * `['%', value1, value2]` returns the result of `value1 % value2` (modulo)
|
||||
* * `['^', value1, value2]` returns the value of `value1` raised to the `value2` power
|
||||
* * `['abs', value1]` returns the absolute value of `value1`
|
||||
* * `['floor', value1]` returns the nearest integer less than or equal to `value1`
|
||||
* * `['round', value1]` returns the nearest integer to `value1`
|
||||
* * `['ceil', value1]` returns the nearest integer greater than or equal to `value1`
|
||||
* * `['sin', value1]` returns the sine of `value1`
|
||||
* * `['cos', value1]` returns the cosine of `value1`
|
||||
* * `['atan', value1, value2]` returns `atan2(value1, value2)`. If `value2` is not provided, returns `atan(value1)`
|
||||
*
|
||||
* * Transform operators:
|
||||
* * `['case', condition1, output1, ...conditionN, outputN, fallback]` selects the first output whose corresponding
|
||||
* condition evaluates to `true`. If no match is found, returns the `fallback` value.
|
||||
* All conditions should be `boolean`, output and fallback can be any kind.
|
||||
* * `['match', input, match1, output1, ...matchN, outputN, fallback]` compares the `input` value against all
|
||||
* provided `matchX` values, returning the output associated with the first valid match. If no match is found,
|
||||
* returns the `fallback` value.
|
||||
* `input` and `matchX` values must all be of the same type, and can be `number` or `string`. `outputX` and
|
||||
* `fallback` values must be of the same type, and can be of any kind.
|
||||
* * `['interpolate', interpolation, input, stop1, output1, ...stopN, outputN]` returns a value by interpolating between
|
||||
* pairs of inputs and outputs; `interpolation` can either be `['linear']` or `['exponential', base]` where `base` is
|
||||
* the rate of increase from stop A to stop B (i.e. power to which the interpolation ratio is raised); a value
|
||||
* of 1 is equivalent to `['linear']`.
|
||||
* `input` and `stopX` values must all be of type `number`. `outputX` values can be `number` or `color` values.
|
||||
* Note: `input` will be clamped between `stop1` and `stopN`, meaning that all output values will be comprised
|
||||
* between `output1` and `outputN`.
|
||||
*
|
||||
* * Logical operators:
|
||||
* * `['<', value1, value2]` returns `true` if `value1` is strictly lower than `value2`, or `false` otherwise.
|
||||
* * `['<=', value1, value2]` returns `true` if `value1` is lower than or equals `value2`, or `false` otherwise.
|
||||
* * `['>', value1, value2]` returns `true` if `value1` is strictly greater than `value2`, or `false` otherwise.
|
||||
* * `['>=', value1, value2]` returns `true` if `value1` is greater than or equals `value2`, or `false` otherwise.
|
||||
* * `['==', value1, value2]` returns `true` if `value1` equals `value2`, or `false` otherwise.
|
||||
* * `['!=', value1, value2]` returns `true` if `value1` does not equal `value2`, or `false` otherwise.
|
||||
* * `['!', value1]` returns `false` if `value1` is `true` or greater than `0`, or `true` otherwise.
|
||||
* * `['all', value1, value2, ...]` returns `true` if all the inputs are `true`, `false` otherwise.
|
||||
* * `['any', value1, value2, ...]` returns `true` if any of the inputs are `true`, `false` otherwise.
|
||||
* * `['between', value1, value2, value3]` returns `true` if `value1` is contained between `value2` and `value3`
|
||||
* (inclusively), or `false` otherwise.
|
||||
*
|
||||
* * Conversion operators:
|
||||
* * `['array', value1, ...valueN]` creates a numerical array from `number` values; please note that the amount of
|
||||
* values can currently only be 2, 3 or 4.
|
||||
* * `['color', red, green, blue, alpha]` creates a `color` value from `number` values; the `alpha` parameter is
|
||||
* optional; if not specified, it will be set to 1.
|
||||
* Note: `red`, `green` and `blue` components must be values between 0 and 255; `alpha` between 0 and 1.
|
||||
* * `['palette', index, colors]` picks a `color` value from an array of colors using the given index; the `index`
|
||||
* expression must evaluate to a number; the items in the `colors` array must be strings with hex colors
|
||||
* (e.g. `'#86A136'`), colors using the rgba[a] functional notation (e.g. `'rgb(134, 161, 54)'` or `'rgba(134, 161, 54, 1)'`),
|
||||
* named colors (e.g. `'red'`), or array literals with 3 ([r, g, b]) or 4 ([r, g, b, a]) values (with r, g, and b
|
||||
* in the 0-255 range and a in the 0-1 range).
|
||||
*
|
||||
* Values can either be literals or another operator, as they will be evaluated recursively.
|
||||
* Literal values can be of the following types:
|
||||
* * `boolean`
|
||||
* * `number`
|
||||
* * `string`
|
||||
* * {@link module:ol/color~Color}
|
||||
*
|
||||
* @typedef {Array<*>|import("../color.js").Color|string|number|boolean} ExpressionValue
|
||||
* @api
|
||||
*/
|
||||
/**
|
||||
* Possible inferred types from a given value or expression.
|
||||
* Note: these are binary flags.
|
||||
* @enum {number}
|
||||
*/
|
||||
export var ValueTypes = {
|
||||
NUMBER: 1,
|
||||
STRING: 2,
|
||||
COLOR: 4,
|
||||
BOOLEAN: 8,
|
||||
NUMBER_ARRAY: 16,
|
||||
ANY: 31,
|
||||
NONE: 0,
|
||||
};
|
||||
/**
|
||||
* An operator declaration must contain two methods: `getReturnType` which returns a type based on
|
||||
* the operator arguments, and `toGlsl` which returns a GLSL-compatible string.
|
||||
* Note: both methods can process arguments recursively.
|
||||
* @typedef {Object} Operator
|
||||
* @property {function(Array<ExpressionValue>): ValueTypes|number} getReturnType Returns one or several types
|
||||
* @property {function(ParsingContext, Array<ExpressionValue>, ValueTypes=): string} toGlsl Returns a GLSL-compatible string
|
||||
* Note: takes in an optional type hint as 3rd parameter
|
||||
*/
|
||||
/**
|
||||
* Operator declarations
|
||||
* @type {Object<string, Operator>}
|
||||
*/
|
||||
export var Operators = {};
|
||||
/**
|
||||
* Returns the possible types for a given value (each type being a binary flag)
|
||||
* To test a value use e.g. `getValueType(v) & ValueTypes.BOOLEAN`
|
||||
* @param {ExpressionValue} value Value
|
||||
* @return {ValueTypes|number} Type or types inferred from the value
|
||||
*/
|
||||
export function getValueType(value) {
|
||||
if (typeof value === 'number') {
|
||||
return ValueTypes.NUMBER;
|
||||
}
|
||||
if (typeof value === 'boolean') {
|
||||
return ValueTypes.BOOLEAN;
|
||||
}
|
||||
if (typeof value === 'string') {
|
||||
if (isStringColor(value)) {
|
||||
return ValueTypes.COLOR | ValueTypes.STRING;
|
||||
}
|
||||
return ValueTypes.STRING;
|
||||
}
|
||||
if (!Array.isArray(value)) {
|
||||
throw new Error("Unhandled value type: ".concat(JSON.stringify(value)));
|
||||
}
|
||||
var valueArr = /** @type {Array<*>} */ (value);
|
||||
var onlyNumbers = valueArr.every(function (v) {
|
||||
return typeof v === 'number';
|
||||
});
|
||||
if (onlyNumbers) {
|
||||
if (valueArr.length === 3 || valueArr.length === 4) {
|
||||
return ValueTypes.COLOR | ValueTypes.NUMBER_ARRAY;
|
||||
}
|
||||
return ValueTypes.NUMBER_ARRAY;
|
||||
}
|
||||
if (typeof valueArr[0] !== 'string') {
|
||||
throw new Error("Expected an expression operator but received: ".concat(JSON.stringify(valueArr)));
|
||||
}
|
||||
var operator = Operators[valueArr[0]];
|
||||
if (operator === undefined) {
|
||||
throw new Error("Unrecognized expression operator: ".concat(JSON.stringify(valueArr)));
|
||||
}
|
||||
return operator.getReturnType(valueArr.slice(1));
|
||||
}
|
||||
/**
|
||||
* Checks if only one value type is enabled in the input number.
|
||||
* @param {ValueTypes|number} valueType Number containing value type binary flags
|
||||
* @return {boolean} True if only one type flag is enabled, false if zero or multiple
|
||||
*/
|
||||
export function isTypeUnique(valueType) {
|
||||
return log2(valueType) % 1 === 0;
|
||||
}
|
||||
/**
|
||||
* Context available during the parsing of an expression.
|
||||
* @typedef {Object} ParsingContext
|
||||
* @property {boolean} [inFragmentShader] If false, means the expression output should be made for a vertex shader
|
||||
* @property {Array<string>} variables List of variables used in the expression; contains **unprefixed names**
|
||||
* @property {Array<string>} attributes List of attributes used in the expression; contains **unprefixed names**
|
||||
* @property {Object<string, number>} stringLiteralsMap This object maps all encountered string values to a number
|
||||
* @property {Object<string, string>} functions Lookup of functions used by the style.
|
||||
* @property {number} [bandCount] Number of bands per pixel.
|
||||
* @property {Array<PaletteTexture>} [paletteTextures] List of palettes used by the style.
|
||||
*/
|
||||
/**
|
||||
* Will return the number as a float with a dot separator, which is required by GLSL.
|
||||
* @param {number} v Numerical value.
|
||||
* @return {string} The value as string.
|
||||
*/
|
||||
export function numberToGlsl(v) {
|
||||
var s = v.toString();
|
||||
return s.indexOf('.') === -1 ? s + '.0' : s;
|
||||
}
|
||||
/**
|
||||
* Will return the number array as a float with a dot separator, concatenated with ', '.
|
||||
* @param {Array<number>} array Numerical values array.
|
||||
* @return {string} The array as a vector, e. g.: `vec3(1.0, 2.0, 3.0)`.
|
||||
*/
|
||||
export function arrayToGlsl(array) {
|
||||
if (array.length < 2 || array.length > 4) {
|
||||
throw new Error('`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.');
|
||||
}
|
||||
return "vec".concat(array.length, "(").concat(array.map(numberToGlsl).join(', '), ")");
|
||||
}
|
||||
/**
|
||||
* Will normalize and converts to string a `vec4` color array compatible with GLSL.
|
||||
* @param {string|import("../color.js").Color} color Color either in string format or [r, g, b, a] array format,
|
||||
* with RGB components in the 0..255 range and the alpha component in the 0..1 range.
|
||||
* Note that the final array will always have 4 components.
|
||||
* @return {string} The color expressed in the `vec4(1.0, 1.0, 1.0, 1.0)` form.
|
||||
*/
|
||||
export function colorToGlsl(color) {
|
||||
var array = asArray(color).slice();
|
||||
if (array.length < 4) {
|
||||
array.push(1);
|
||||
}
|
||||
return arrayToGlsl(array.map(function (c, i) {
|
||||
return i < 3 ? c / 255 : c;
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* Returns a stable equivalent number for the string literal.
|
||||
* @param {ParsingContext} context Parsing context
|
||||
* @param {string} string String literal value
|
||||
* @return {number} Number equivalent
|
||||
*/
|
||||
export function getStringNumberEquivalent(context, string) {
|
||||
if (context.stringLiteralsMap[string] === undefined) {
|
||||
context.stringLiteralsMap[string] = Object.keys(context.stringLiteralsMap).length;
|
||||
}
|
||||
return context.stringLiteralsMap[string];
|
||||
}
|
||||
/**
|
||||
* Returns a stable equivalent number for the string literal, for use in shaders. This number is then
|
||||
* converted to be a GLSL-compatible string.
|
||||
* @param {ParsingContext} context Parsing context
|
||||
* @param {string} string String literal value
|
||||
* @return {string} GLSL-compatible string containing a number
|
||||
*/
|
||||
export function stringToGlsl(context, string) {
|
||||
return numberToGlsl(getStringNumberEquivalent(context, string));
|
||||
}
|
||||
/**
|
||||
* Recursively parses a style expression and outputs a GLSL-compatible string. Takes in a parsing context that
|
||||
* will be read and modified during the parsing operation.
|
||||
* @param {ParsingContext} context Parsing context
|
||||
* @param {ExpressionValue} value Value
|
||||
* @param {ValueTypes|number} [typeHint] Hint for the expected final type (can be several types combined)
|
||||
* @return {string} GLSL-compatible output
|
||||
*/
|
||||
export function expressionToGlsl(context, value, typeHint) {
|
||||
// operator
|
||||
if (Array.isArray(value) && typeof value[0] === 'string') {
|
||||
var operator = Operators[value[0]];
|
||||
if (operator === undefined) {
|
||||
throw new Error("Unrecognized expression operator: ".concat(JSON.stringify(value)));
|
||||
}
|
||||
return operator.toGlsl(context, value.slice(1), typeHint);
|
||||
}
|
||||
var valueType = getValueType(value);
|
||||
if ((valueType & ValueTypes.NUMBER) > 0) {
|
||||
return numberToGlsl(/** @type {number} */ (value));
|
||||
}
|
||||
if ((valueType & ValueTypes.BOOLEAN) > 0) {
|
||||
return value.toString();
|
||||
}
|
||||
if ((valueType & ValueTypes.STRING) > 0 &&
|
||||
(typeHint === undefined || typeHint == ValueTypes.STRING)) {
|
||||
return stringToGlsl(context, value.toString());
|
||||
}
|
||||
if ((valueType & ValueTypes.COLOR) > 0 &&
|
||||
(typeHint === undefined || typeHint == ValueTypes.COLOR)) {
|
||||
return colorToGlsl(/** @type {Array<number> | string} */ (value));
|
||||
}
|
||||
if ((valueType & ValueTypes.NUMBER_ARRAY) > 0) {
|
||||
return arrayToGlsl(/** @type {Array<number>} */ (value));
|
||||
}
|
||||
throw new Error("Unexpected expression ".concat(value, " (expected type ").concat(typeHint, ")"));
|
||||
}
|
||||
function assertNumber(value) {
|
||||
if (!(getValueType(value) & ValueTypes.NUMBER)) {
|
||||
throw new Error("A numeric value was expected, got ".concat(JSON.stringify(value), " instead"));
|
||||
}
|
||||
}
|
||||
function assertNumbers(values) {
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
assertNumber(values[i]);
|
||||
}
|
||||
}
|
||||
function assertString(value) {
|
||||
if (!(getValueType(value) & ValueTypes.STRING)) {
|
||||
throw new Error("A string value was expected, got ".concat(JSON.stringify(value), " instead"));
|
||||
}
|
||||
}
|
||||
function assertBoolean(value) {
|
||||
if (!(getValueType(value) & ValueTypes.BOOLEAN)) {
|
||||
throw new Error("A boolean value was expected, got ".concat(JSON.stringify(value), " instead"));
|
||||
}
|
||||
}
|
||||
function assertArgsCount(args, count) {
|
||||
if (args.length !== count) {
|
||||
throw new Error("Exactly ".concat(count, " arguments were expected, got ").concat(args.length, " instead"));
|
||||
}
|
||||
}
|
||||
function assertArgsMinCount(args, count) {
|
||||
if (args.length < count) {
|
||||
throw new Error("At least ".concat(count, " arguments were expected, got ").concat(args.length, " instead"));
|
||||
}
|
||||
}
|
||||
function assertArgsMaxCount(args, count) {
|
||||
if (args.length > count) {
|
||||
throw new Error("At most ".concat(count, " arguments were expected, got ").concat(args.length, " instead"));
|
||||
}
|
||||
}
|
||||
function assertArgsEven(args) {
|
||||
if (args.length % 2 !== 0) {
|
||||
throw new Error("An even amount of arguments was expected, got ".concat(args, " instead"));
|
||||
}
|
||||
}
|
||||
function assertArgsOdd(args) {
|
||||
if (args.length % 2 === 0) {
|
||||
throw new Error("An odd amount of arguments was expected, got ".concat(args, " instead"));
|
||||
}
|
||||
}
|
||||
function assertUniqueInferredType(args, types) {
|
||||
if (!isTypeUnique(types)) {
|
||||
throw new Error("Could not infer only one type from the following expression: ".concat(JSON.stringify(args)));
|
||||
}
|
||||
}
|
||||
Operators['get'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.ANY;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 1);
|
||||
assertString(args[0]);
|
||||
var value = args[0].toString();
|
||||
if (context.attributes.indexOf(value) === -1) {
|
||||
context.attributes.push(value);
|
||||
}
|
||||
var prefix = context.inFragmentShader ? 'v_' : 'a_';
|
||||
return prefix + value;
|
||||
},
|
||||
};
|
||||
/**
|
||||
* Get the uniform name given a variable name.
|
||||
* @param {string} variableName The variable name.
|
||||
* @return {string} The uniform name.
|
||||
*/
|
||||
export function uniformNameForVariable(variableName) {
|
||||
return 'u_var_' + variableName;
|
||||
}
|
||||
Operators['var'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.ANY;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 1);
|
||||
assertString(args[0]);
|
||||
var value = args[0].toString();
|
||||
if (context.variables.indexOf(value) === -1) {
|
||||
context.variables.push(value);
|
||||
}
|
||||
return uniformNameForVariable(value);
|
||||
},
|
||||
};
|
||||
export var PALETTE_TEXTURE_ARRAY = 'u_paletteTextures';
|
||||
// ['palette', index, colors]
|
||||
Operators['palette'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.COLOR;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 2);
|
||||
assertNumber(args[0]);
|
||||
var index = expressionToGlsl(context, args[0]);
|
||||
var colors = args[1];
|
||||
if (!Array.isArray(colors)) {
|
||||
throw new Error('The second argument of palette must be an array');
|
||||
}
|
||||
var numColors = colors.length;
|
||||
var palette = new Uint8Array(numColors * 4);
|
||||
for (var i = 0; i < numColors; i++) {
|
||||
var candidate = colors[i];
|
||||
/**
|
||||
* @type {import('../color.js').Color}
|
||||
*/
|
||||
var color = void 0;
|
||||
if (typeof candidate === 'string') {
|
||||
color = fromString(candidate);
|
||||
}
|
||||
else {
|
||||
if (!Array.isArray(candidate)) {
|
||||
throw new Error('The second argument of palette must be an array of strings or colors');
|
||||
}
|
||||
var length_1 = candidate.length;
|
||||
if (length_1 === 4) {
|
||||
color = candidate;
|
||||
}
|
||||
else {
|
||||
if (length_1 !== 3) {
|
||||
throw new Error("Expected palette color to have 3 or 4 values, got ".concat(length_1));
|
||||
}
|
||||
color = [candidate[0], candidate[1], candidate[2], 1];
|
||||
}
|
||||
}
|
||||
var offset = i * 4;
|
||||
palette[offset] = color[0];
|
||||
palette[offset + 1] = color[1];
|
||||
palette[offset + 2] = color[2];
|
||||
palette[offset + 3] = color[3] * 255;
|
||||
}
|
||||
if (!context.paletteTextures) {
|
||||
context.paletteTextures = [];
|
||||
}
|
||||
var paletteName = "".concat(PALETTE_TEXTURE_ARRAY, "[").concat(context.paletteTextures.length, "]");
|
||||
var paletteTexture = new PaletteTexture(paletteName, palette);
|
||||
context.paletteTextures.push(paletteTexture);
|
||||
return "texture2D(".concat(paletteName, ", vec2((").concat(index, " + 0.5) / ").concat(numColors, ".0, 0.5))");
|
||||
},
|
||||
};
|
||||
var GET_BAND_VALUE_FUNC = 'getBandValue';
|
||||
Operators['band'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsMinCount(args, 1);
|
||||
assertArgsMaxCount(args, 3);
|
||||
var band = args[0];
|
||||
if (!(GET_BAND_VALUE_FUNC in context.functions)) {
|
||||
var ifBlocks = '';
|
||||
var bandCount = context.bandCount || 1;
|
||||
for (var i = 0; i < bandCount; i++) {
|
||||
var colorIndex = Math.floor(i / 4);
|
||||
var bandIndex = i % 4;
|
||||
if (bandIndex === bandCount - 1 && bandIndex === 1) {
|
||||
// LUMINANCE_ALPHA - band 1 assigned to rgb and band 2 assigned to alpha
|
||||
bandIndex = 3;
|
||||
}
|
||||
var textureName = "".concat(Uniforms.TILE_TEXTURE_ARRAY, "[").concat(colorIndex, "]");
|
||||
ifBlocks += "\n if (band == ".concat(i + 1, ".0) {\n return texture2D(").concat(textureName, ", v_textureCoord + vec2(dx, dy))[").concat(bandIndex, "];\n }\n ");
|
||||
}
|
||||
context.functions[GET_BAND_VALUE_FUNC] = "\n float getBandValue(float band, float xOffset, float yOffset) {\n float dx = xOffset / ".concat(Uniforms.TEXTURE_PIXEL_WIDTH, ";\n float dy = yOffset / ").concat(Uniforms.TEXTURE_PIXEL_HEIGHT, ";\n ").concat(ifBlocks, "\n }\n ");
|
||||
}
|
||||
var bandExpression = expressionToGlsl(context, band);
|
||||
var xOffsetExpression = expressionToGlsl(context, args[1] || 0);
|
||||
var yOffsetExpression = expressionToGlsl(context, args[2] || 0);
|
||||
return "".concat(GET_BAND_VALUE_FUNC, "(").concat(bandExpression, ", ").concat(xOffsetExpression, ", ").concat(yOffsetExpression, ")");
|
||||
},
|
||||
};
|
||||
Operators['time'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 0);
|
||||
return 'u_time';
|
||||
},
|
||||
};
|
||||
Operators['zoom'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 0);
|
||||
return 'u_zoom';
|
||||
},
|
||||
};
|
||||
Operators['resolution'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 0);
|
||||
return 'u_resolution';
|
||||
},
|
||||
};
|
||||
Operators['*'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 2);
|
||||
assertNumbers(args);
|
||||
return "(".concat(expressionToGlsl(context, args[0]), " * ").concat(expressionToGlsl(context, args[1]), ")");
|
||||
},
|
||||
};
|
||||
Operators['/'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 2);
|
||||
assertNumbers(args);
|
||||
return "(".concat(expressionToGlsl(context, args[0]), " / ").concat(expressionToGlsl(context, args[1]), ")");
|
||||
},
|
||||
};
|
||||
Operators['+'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 2);
|
||||
assertNumbers(args);
|
||||
return "(".concat(expressionToGlsl(context, args[0]), " + ").concat(expressionToGlsl(context, args[1]), ")");
|
||||
},
|
||||
};
|
||||
Operators['-'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 2);
|
||||
assertNumbers(args);
|
||||
return "(".concat(expressionToGlsl(context, args[0]), " - ").concat(expressionToGlsl(context, args[1]), ")");
|
||||
},
|
||||
};
|
||||
Operators['clamp'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 3);
|
||||
assertNumbers(args);
|
||||
var min = expressionToGlsl(context, args[1]);
|
||||
var max = expressionToGlsl(context, args[2]);
|
||||
return "clamp(".concat(expressionToGlsl(context, args[0]), ", ").concat(min, ", ").concat(max, ")");
|
||||
},
|
||||
};
|
||||
Operators['%'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 2);
|
||||
assertNumbers(args);
|
||||
return "mod(".concat(expressionToGlsl(context, args[0]), ", ").concat(expressionToGlsl(context, args[1]), ")");
|
||||
},
|
||||
};
|
||||
Operators['^'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 2);
|
||||
assertNumbers(args);
|
||||
return "pow(".concat(expressionToGlsl(context, args[0]), ", ").concat(expressionToGlsl(context, args[1]), ")");
|
||||
},
|
||||
};
|
||||
Operators['abs'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 1);
|
||||
assertNumbers(args);
|
||||
return "abs(".concat(expressionToGlsl(context, args[0]), ")");
|
||||
},
|
||||
};
|
||||
Operators['floor'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 1);
|
||||
assertNumbers(args);
|
||||
return "floor(".concat(expressionToGlsl(context, args[0]), ")");
|
||||
},
|
||||
};
|
||||
Operators['round'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 1);
|
||||
assertNumbers(args);
|
||||
return "floor(".concat(expressionToGlsl(context, args[0]), " + 0.5)");
|
||||
},
|
||||
};
|
||||
Operators['ceil'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 1);
|
||||
assertNumbers(args);
|
||||
return "ceil(".concat(expressionToGlsl(context, args[0]), ")");
|
||||
},
|
||||
};
|
||||
Operators['sin'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 1);
|
||||
assertNumbers(args);
|
||||
return "sin(".concat(expressionToGlsl(context, args[0]), ")");
|
||||
},
|
||||
};
|
||||
Operators['cos'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 1);
|
||||
assertNumbers(args);
|
||||
return "cos(".concat(expressionToGlsl(context, args[0]), ")");
|
||||
},
|
||||
};
|
||||
Operators['atan'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsMinCount(args, 1);
|
||||
assertArgsMaxCount(args, 2);
|
||||
assertNumbers(args);
|
||||
return args.length === 2
|
||||
? "atan(".concat(expressionToGlsl(context, args[0]), ", ").concat(expressionToGlsl(context, args[1]), ")")
|
||||
: "atan(".concat(expressionToGlsl(context, args[0]), ")");
|
||||
},
|
||||
};
|
||||
Operators['>'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.BOOLEAN;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 2);
|
||||
assertNumbers(args);
|
||||
return "(".concat(expressionToGlsl(context, args[0]), " > ").concat(expressionToGlsl(context, args[1]), ")");
|
||||
},
|
||||
};
|
||||
Operators['>='] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.BOOLEAN;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 2);
|
||||
assertNumbers(args);
|
||||
return "(".concat(expressionToGlsl(context, args[0]), " >= ").concat(expressionToGlsl(context, args[1]), ")");
|
||||
},
|
||||
};
|
||||
Operators['<'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.BOOLEAN;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 2);
|
||||
assertNumbers(args);
|
||||
return "(".concat(expressionToGlsl(context, args[0]), " < ").concat(expressionToGlsl(context, args[1]), ")");
|
||||
},
|
||||
};
|
||||
Operators['<='] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.BOOLEAN;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 2);
|
||||
assertNumbers(args);
|
||||
return "(".concat(expressionToGlsl(context, args[0]), " <= ").concat(expressionToGlsl(context, args[1]), ")");
|
||||
},
|
||||
};
|
||||
function getEqualOperator(operator) {
|
||||
return {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.BOOLEAN;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 2);
|
||||
// find common type
|
||||
var type = ValueTypes.ANY;
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
type &= getValueType(args[i]);
|
||||
}
|
||||
if (type === ValueTypes.NONE) {
|
||||
throw new Error("All arguments should be of compatible type, got ".concat(JSON.stringify(args), " instead"));
|
||||
}
|
||||
// Since it's not possible to have color types here, we can leave it out
|
||||
// This fixes issues in case the value type is ambiguously detected as a color (e.g. the string 'red')
|
||||
type &= ~ValueTypes.COLOR;
|
||||
return "(".concat(expressionToGlsl(context, args[0], type), " ").concat(operator, " ").concat(expressionToGlsl(context, args[1], type), ")");
|
||||
},
|
||||
};
|
||||
}
|
||||
Operators['=='] = getEqualOperator('==');
|
||||
Operators['!='] = getEqualOperator('!=');
|
||||
Operators['!'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.BOOLEAN;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 1);
|
||||
assertBoolean(args[0]);
|
||||
return "(!".concat(expressionToGlsl(context, args[0]), ")");
|
||||
},
|
||||
};
|
||||
function getDecisionOperator(operator) {
|
||||
return {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.BOOLEAN;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsMinCount(args, 2);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
assertBoolean(args[i]);
|
||||
}
|
||||
var result = '';
|
||||
result = args
|
||||
.map(function (arg) { return expressionToGlsl(context, arg); })
|
||||
.join(" ".concat(operator, " "));
|
||||
result = "(".concat(result, ")");
|
||||
return result;
|
||||
},
|
||||
};
|
||||
}
|
||||
Operators['all'] = getDecisionOperator('&&');
|
||||
Operators['any'] = getDecisionOperator('||');
|
||||
Operators['between'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.BOOLEAN;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsCount(args, 3);
|
||||
assertNumbers(args);
|
||||
var min = expressionToGlsl(context, args[1]);
|
||||
var max = expressionToGlsl(context, args[2]);
|
||||
var value = expressionToGlsl(context, args[0]);
|
||||
return "(".concat(value, " >= ").concat(min, " && ").concat(value, " <= ").concat(max, ")");
|
||||
},
|
||||
};
|
||||
Operators['array'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.NUMBER_ARRAY;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsMinCount(args, 2);
|
||||
assertArgsMaxCount(args, 4);
|
||||
assertNumbers(args);
|
||||
var parsedArgs = args.map(function (val) {
|
||||
return expressionToGlsl(context, val, ValueTypes.NUMBER);
|
||||
});
|
||||
return "vec".concat(args.length, "(").concat(parsedArgs.join(', '), ")");
|
||||
},
|
||||
};
|
||||
Operators['color'] = {
|
||||
getReturnType: function (args) {
|
||||
return ValueTypes.COLOR;
|
||||
},
|
||||
toGlsl: function (context, args) {
|
||||
assertArgsMinCount(args, 3);
|
||||
assertArgsMaxCount(args, 4);
|
||||
assertNumbers(args);
|
||||
var array = /** @type {Array<number>} */ (args);
|
||||
if (args.length === 3) {
|
||||
array.push(1);
|
||||
}
|
||||
var parsedArgs = args.map(function (val, i) {
|
||||
return (expressionToGlsl(context, val, ValueTypes.NUMBER) +
|
||||
(i < 3 ? ' / 255.0' : ''));
|
||||
});
|
||||
return "vec".concat(args.length, "(").concat(parsedArgs.join(', '), ")");
|
||||
},
|
||||
};
|
||||
Operators['interpolate'] = {
|
||||
getReturnType: function (args) {
|
||||
var type = ValueTypes.COLOR | ValueTypes.NUMBER;
|
||||
for (var i = 3; i < args.length; i += 2) {
|
||||
type = type & getValueType(args[i]);
|
||||
}
|
||||
return type;
|
||||
},
|
||||
toGlsl: function (context, args, opt_typeHint) {
|
||||
assertArgsEven(args);
|
||||
assertArgsMinCount(args, 6);
|
||||
// validate interpolation type
|
||||
var type = args[0];
|
||||
var interpolation;
|
||||
switch (type[0]) {
|
||||
case 'linear':
|
||||
interpolation = 1;
|
||||
break;
|
||||
case 'exponential':
|
||||
interpolation = type[1];
|
||||
break;
|
||||
default:
|
||||
interpolation = null;
|
||||
}
|
||||
if (!interpolation) {
|
||||
throw new Error("Invalid interpolation type for \"interpolate\" operator, received: ".concat(JSON.stringify(type)));
|
||||
}
|
||||
// compute input/output types
|
||||
var typeHint = opt_typeHint !== undefined ? opt_typeHint : ValueTypes.ANY;
|
||||
var outputType = Operators['interpolate'].getReturnType(args) & typeHint;
|
||||
assertUniqueInferredType(args, outputType);
|
||||
var input = expressionToGlsl(context, args[1]);
|
||||
var exponent = numberToGlsl(interpolation);
|
||||
var result = '';
|
||||
for (var i = 2; i < args.length - 2; i += 2) {
|
||||
var stop1 = expressionToGlsl(context, args[i]);
|
||||
var output1 = result || expressionToGlsl(context, args[i + 1], outputType);
|
||||
var stop2 = expressionToGlsl(context, args[i + 2]);
|
||||
var output2 = expressionToGlsl(context, args[i + 3], outputType);
|
||||
result = "mix(".concat(output1, ", ").concat(output2, ", pow(clamp((").concat(input, " - ").concat(stop1, ") / (").concat(stop2, " - ").concat(stop1, "), 0.0, 1.0), ").concat(exponent, "))");
|
||||
}
|
||||
return result;
|
||||
},
|
||||
};
|
||||
Operators['match'] = {
|
||||
getReturnType: function (args) {
|
||||
var type = ValueTypes.ANY;
|
||||
for (var i = 2; i < args.length; i += 2) {
|
||||
type = type & getValueType(args[i]);
|
||||
}
|
||||
type = type & getValueType(args[args.length - 1]);
|
||||
return type;
|
||||
},
|
||||
toGlsl: function (context, args, opt_typeHint) {
|
||||
assertArgsEven(args);
|
||||
assertArgsMinCount(args, 4);
|
||||
var typeHint = opt_typeHint !== undefined ? opt_typeHint : ValueTypes.ANY;
|
||||
var outputType = Operators['match'].getReturnType(args) & typeHint;
|
||||
assertUniqueInferredType(args, outputType);
|
||||
var input = expressionToGlsl(context, args[0]);
|
||||
var fallback = expressionToGlsl(context, args[args.length - 1], outputType);
|
||||
var result = null;
|
||||
for (var i = args.length - 3; i >= 1; i -= 2) {
|
||||
var match = expressionToGlsl(context, args[i]);
|
||||
var output = expressionToGlsl(context, args[i + 1], outputType);
|
||||
result = "(".concat(input, " == ").concat(match, " ? ").concat(output, " : ").concat(result || fallback, ")");
|
||||
}
|
||||
return result;
|
||||
},
|
||||
};
|
||||
Operators['case'] = {
|
||||
getReturnType: function (args) {
|
||||
var type = ValueTypes.ANY;
|
||||
for (var i = 1; i < args.length; i += 2) {
|
||||
type = type & getValueType(args[i]);
|
||||
}
|
||||
type = type & getValueType(args[args.length - 1]);
|
||||
return type;
|
||||
},
|
||||
toGlsl: function (context, args, opt_typeHint) {
|
||||
assertArgsOdd(args);
|
||||
assertArgsMinCount(args, 3);
|
||||
var typeHint = opt_typeHint !== undefined ? opt_typeHint : ValueTypes.ANY;
|
||||
var outputType = Operators['case'].getReturnType(args) & typeHint;
|
||||
assertUniqueInferredType(args, outputType);
|
||||
for (var i = 0; i < args.length - 1; i += 2) {
|
||||
assertBoolean(args[i]);
|
||||
}
|
||||
var fallback = expressionToGlsl(context, args[args.length - 1], outputType);
|
||||
var result = null;
|
||||
for (var i = args.length - 3; i >= 0; i -= 2) {
|
||||
var condition = expressionToGlsl(context, args[i]);
|
||||
var output = expressionToGlsl(context, args[i + 1], outputType);
|
||||
result = "(".concat(condition, " ? ").concat(output, " : ").concat(result || fallback, ")");
|
||||
}
|
||||
return result;
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=expressions.js.map
|
||||
1
node_modules/ol/style/expressions.js.map
generated
vendored
Normal file
1
node_modules/ol/style/expressions.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
69
node_modules/ol/style/literal.d.ts
generated
vendored
Normal file
69
node_modules/ol/style/literal.d.ts
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
export type SymbolType = string;
|
||||
export namespace SymbolType {
|
||||
const CIRCLE: string;
|
||||
const SQUARE: string;
|
||||
const TRIANGLE: string;
|
||||
const IMAGE: string;
|
||||
}
|
||||
export type ExpressionValue = import("./expressions.js").ExpressionValue;
|
||||
export type LiteralStyle = {
|
||||
/**
|
||||
* Filter expression. If it resolves to a number strictly greater than 0, the
|
||||
* point will be displayed. If undefined, all points will show.
|
||||
*/
|
||||
filter?: import("./expressions.js").ExpressionValue | undefined;
|
||||
/**
|
||||
* Style variables; each variable must hold a number.
|
||||
* Note: **this object is meant to be mutated**: changes to the values will immediately be visible on the rendered features
|
||||
*/
|
||||
variables?: {
|
||||
[x: string]: number;
|
||||
} | undefined;
|
||||
/**
|
||||
* Symbol representation.
|
||||
*/
|
||||
symbol?: LiteralSymbolStyle | undefined;
|
||||
};
|
||||
export type LiteralSymbolStyle = {
|
||||
/**
|
||||
* Size, mandatory.
|
||||
*/
|
||||
size: ExpressionValue | Array<ExpressionValue>;
|
||||
/**
|
||||
* Symbol type to use, either a regular shape or an image.
|
||||
*/
|
||||
symbolType: SymbolType;
|
||||
/**
|
||||
* Path to the image to be used for the symbol. Only required with `symbolType: 'image'`.
|
||||
*/
|
||||
src?: string | undefined;
|
||||
/**
|
||||
* The `crossOrigin` attribute for loading `src`.
|
||||
*/
|
||||
crossOrigin?: string | undefined;
|
||||
/**
|
||||
* Color used for the representation (either fill, line or symbol).
|
||||
*/
|
||||
color?: string | import("../color.js").Color | import("./expressions.js").ExpressionValue[] | undefined;
|
||||
/**
|
||||
* Opacity.
|
||||
*/
|
||||
opacity?: import("./expressions.js").ExpressionValue | undefined;
|
||||
/**
|
||||
* Symbol rotation in radians.
|
||||
*/
|
||||
rotation?: import("./expressions.js").ExpressionValue | undefined;
|
||||
/**
|
||||
* Offset on X and Y axis for symbols. If not specified, the symbol will be centered.
|
||||
*/
|
||||
offset?: import("./expressions.js").ExpressionValue[] | undefined;
|
||||
/**
|
||||
* Texture coordinates. If not specified, the whole texture will be used (range for 0 to 1 on both axes).
|
||||
*/
|
||||
textureCoord?: import("./expressions.js").ExpressionValue[] | undefined;
|
||||
/**
|
||||
* Specify whether the symbol must rotate with the view or stay upwards.
|
||||
*/
|
||||
rotateWithView?: boolean | undefined;
|
||||
};
|
||||
//# sourceMappingURL=literal.d.ts.map
|
||||
1
node_modules/ol/style/literal.d.ts.map
generated
vendored
Normal file
1
node_modules/ol/style/literal.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"literal.d.ts","sourceRoot":"","sources":["../src/style/literal.js"],"names":[],"mappings":"yBAoBU,MAAM;;;;;;;8BAbH,OAAO,kBAAkB,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;UAwBzC,eAAe,GAAC,MAAM,eAAe,CAAC;;;;gBACtC,UAAU"}
|
||||
39
node_modules/ol/style/literal.js
generated
vendored
Normal file
39
node_modules/ol/style/literal.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Literal style objects differ from standard styles in that they cannot
|
||||
* be functions and are made up of simple objects instead of classes.
|
||||
* @module ol/style/literal
|
||||
*/
|
||||
/**
|
||||
* @typedef {import("./expressions.js").ExpressionValue} ExpressionValue
|
||||
*/
|
||||
/**
|
||||
* @typedef {Object} LiteralStyle
|
||||
* @property {ExpressionValue} [filter] Filter expression. If it resolves to a number strictly greater than 0, the
|
||||
* point will be displayed. If undefined, all points will show.
|
||||
* @property {Object<string, number>} [variables] Style variables; each variable must hold a number.
|
||||
* Note: **this object is meant to be mutated**: changes to the values will immediately be visible on the rendered features
|
||||
* @property {LiteralSymbolStyle} [symbol] Symbol representation.
|
||||
*/
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
export var SymbolType = {
|
||||
CIRCLE: 'circle',
|
||||
SQUARE: 'square',
|
||||
TRIANGLE: 'triangle',
|
||||
IMAGE: 'image',
|
||||
};
|
||||
/**
|
||||
* @typedef {Object} LiteralSymbolStyle
|
||||
* @property {ExpressionValue|Array<ExpressionValue>} size Size, mandatory.
|
||||
* @property {SymbolType} symbolType Symbol type to use, either a regular shape or an image.
|
||||
* @property {string} [src] Path to the image to be used for the symbol. Only required with `symbolType: 'image'`.
|
||||
* @property {string} [crossOrigin='anonymous'] The `crossOrigin` attribute for loading `src`.
|
||||
* @property {import("../color.js").Color|Array<ExpressionValue>|string} [color='#FFFFFF'] Color used for the representation (either fill, line or symbol).
|
||||
* @property {ExpressionValue} [opacity=1] Opacity.
|
||||
* @property {ExpressionValue} [rotation=0] Symbol rotation in radians.
|
||||
* @property {Array<ExpressionValue, ExpressionValue>} [offset] Offset on X and Y axis for symbols. If not specified, the symbol will be centered.
|
||||
* @property {Array<ExpressionValue, ExpressionValue, ExpressionValue, ExpressionValue>} [textureCoord] Texture coordinates. If not specified, the whole texture will be used (range for 0 to 1 on both axes).
|
||||
* @property {boolean} [rotateWithView=false] Specify whether the symbol must rotate with the view or stay upwards.
|
||||
*/
|
||||
//# sourceMappingURL=literal.js.map
|
||||
1
node_modules/ol/style/literal.js.map
generated
vendored
Normal file
1
node_modules/ol/style/literal.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"literal.js","sourceRoot":"","sources":["../src/style/literal.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AAEH;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG;IACxB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;CACf,CAAC;AAEF;;;;;;;;;;;;GAYG"}
|
||||
Reference in New Issue
Block a user