planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

55
node_modules/ol/render/Box.d.ts generated vendored Normal file
View File

@@ -0,0 +1,55 @@
export default RenderBox;
declare class RenderBox extends Disposable {
/**
* @param {string} className CSS class name.
*/
constructor(className: string);
/**
* @type {import("../geom/Polygon.js").default}
* @private
*/
private geometry_;
/**
* @type {HTMLDivElement}
* @private
*/
private element_;
/**
* @private
* @type {import("../PluggableMap.js").default|null}
*/
private map_;
/**
* @private
* @type {import("../pixel.js").Pixel}
*/
private startPixel_;
/**
* @private
* @type {import("../pixel.js").Pixel}
*/
private endPixel_;
/**
* @private
*/
private render_;
/**
* @param {import("../PluggableMap.js").default|null} map Map.
*/
setMap(map: import("../PluggableMap.js").default | null): void;
/**
* @param {import("../pixel.js").Pixel} startPixel Start pixel.
* @param {import("../pixel.js").Pixel} endPixel End pixel.
*/
setPixels(startPixel: import("../pixel.js").Pixel, endPixel: import("../pixel.js").Pixel): void;
/**
* Creates or updates the cached geometry.
*/
createOrUpdateGeometry(): void;
/**
* @return {import("../geom/Polygon.js").default} Geometry.
*/
getGeometry(): import("../geom/Polygon.js").default;
}
import Disposable from "../Disposable.js";
//# sourceMappingURL=Box.d.ts.map

1
node_modules/ol/render/Box.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../src/render/Box.js"],"names":[],"mappings":";AAOA;IACE;;OAEG;IACH,uBAFW,MAAM,EAqChB;IAhCC;;;OAGG;IACH,kBAAqB;IAErB;;;OAGG;IACH,iBAA6C;IAK7C;;;OAGG;IACH,aAAgB;IAEhB;;;OAGG;IACH,oBAAuB;IAEvB;;;OAGG;IACH,kBAAqB;IAUvB;;OAEG;IACH,gBASC;IAED;;OAEG;IACH,YAFW,OAAO,oBAAoB,EAAE,OAAO,GAAC,IAAI,QAenD;IAED;;;OAGG;IACH,sBAHW,OAAO,aAAa,EAAE,KAAK,YAC3B,OAAO,aAAa,EAAE,KAAK,QAOrC;IAED;;OAEG;IACH,+BAoBC;IAED;;OAEG;IACH,eAFY,OAAO,oBAAoB,EAAE,OAAO,CAI/C;CACF"}

135
node_modules/ol/render/Box.js generated vendored Normal file
View File

@@ -0,0 +1,135 @@
/**
* @module ol/render/Box
*/
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 Disposable from '../Disposable.js';
import Polygon from '../geom/Polygon.js';
var RenderBox = /** @class */ (function (_super) {
__extends(RenderBox, _super);
/**
* @param {string} className CSS class name.
*/
function RenderBox(className) {
var _this = _super.call(this) || this;
/**
* @type {import("../geom/Polygon.js").default}
* @private
*/
_this.geometry_ = null;
/**
* @type {HTMLDivElement}
* @private
*/
_this.element_ = document.createElement('div');
_this.element_.style.position = 'absolute';
_this.element_.style.pointerEvents = 'auto';
_this.element_.className = 'ol-box ' + className;
/**
* @private
* @type {import("../PluggableMap.js").default|null}
*/
_this.map_ = null;
/**
* @private
* @type {import("../pixel.js").Pixel}
*/
_this.startPixel_ = null;
/**
* @private
* @type {import("../pixel.js").Pixel}
*/
_this.endPixel_ = null;
return _this;
}
/**
* Clean up.
*/
RenderBox.prototype.disposeInternal = function () {
this.setMap(null);
};
/**
* @private
*/
RenderBox.prototype.render_ = function () {
var startPixel = this.startPixel_;
var endPixel = this.endPixel_;
var px = 'px';
var style = this.element_.style;
style.left = Math.min(startPixel[0], endPixel[0]) + px;
style.top = Math.min(startPixel[1], endPixel[1]) + px;
style.width = Math.abs(endPixel[0] - startPixel[0]) + px;
style.height = Math.abs(endPixel[1] - startPixel[1]) + px;
};
/**
* @param {import("../PluggableMap.js").default|null} map Map.
*/
RenderBox.prototype.setMap = function (map) {
if (this.map_) {
this.map_.getOverlayContainer().removeChild(this.element_);
var style = this.element_.style;
style.left = 'inherit';
style.top = 'inherit';
style.width = 'inherit';
style.height = 'inherit';
}
this.map_ = map;
if (this.map_) {
this.map_.getOverlayContainer().appendChild(this.element_);
}
};
/**
* @param {import("../pixel.js").Pixel} startPixel Start pixel.
* @param {import("../pixel.js").Pixel} endPixel End pixel.
*/
RenderBox.prototype.setPixels = function (startPixel, endPixel) {
this.startPixel_ = startPixel;
this.endPixel_ = endPixel;
this.createOrUpdateGeometry();
this.render_();
};
/**
* Creates or updates the cached geometry.
*/
RenderBox.prototype.createOrUpdateGeometry = function () {
var startPixel = this.startPixel_;
var endPixel = this.endPixel_;
var pixels = [
startPixel,
[startPixel[0], endPixel[1]],
endPixel,
[endPixel[0], startPixel[1]],
];
var coordinates = pixels.map(this.map_.getCoordinateFromPixelInternal, this.map_);
// close the polygon
coordinates[4] = coordinates[0].slice();
if (!this.geometry_) {
this.geometry_ = new Polygon([coordinates]);
}
else {
this.geometry_.setCoordinates([coordinates]);
}
};
/**
* @return {import("../geom/Polygon.js").default} Geometry.
*/
RenderBox.prototype.getGeometry = function () {
return this.geometry_;
};
return RenderBox;
}(Disposable));
export default RenderBox;
//# sourceMappingURL=Box.js.map

1
node_modules/ol/render/Box.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Box.js","sourceRoot":"","sources":["../src/render/Box.js"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAEzC;IAAwB,6BAAU;IAChC;;OAEG;IACH,mBAAY,SAAS;QAArB,YACE,iBAAO,SAkCR;QAhCC;;;WAGG;QACH,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB;;;WAGG;QACH,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9C,KAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;QAC1C,KAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,GAAG,MAAM,CAAC;QAC3C,KAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;QAEhD;;;WAGG;QACH,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB;;;WAGG;QACH,KAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAExB;;;WAGG;QACH,KAAI,CAAC,SAAS,GAAG,IAAI,CAAC;;IACxB,CAAC;IAED;;OAEG;IACH,mCAAe,GAAf;QACE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,2BAAO,GAAP;QACE,IAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;QACpC,IAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAM,EAAE,GAAG,IAAI,CAAC;QAChB,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAClC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;QACvD,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;QACtD,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;QACzD,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,0BAAM,GAAN,UAAO,GAAG;QACR,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC3D,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;YAClC,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC;YACvB,KAAK,CAAC,GAAG,GAAG,SAAS,CAAC;YACtB,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;YACxB,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;SAC1B;QACD,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC5D;IACH,CAAC;IAED;;;OAGG;IACH,6BAAS,GAAT,UAAU,UAAU,EAAE,QAAQ;QAC5B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC9B,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,0CAAsB,GAAtB;QACE,IAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC;QACpC,IAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAM,MAAM,GAAG;YACb,UAAU;YACV,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC5B,QAAQ;YACR,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;SAC7B,CAAC;QACF,IAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAC5B,IAAI,CAAC,IAAI,CAAC,8BAA8B,EACxC,IAAI,CAAC,IAAI,CACV,CAAC;QACF,oBAAoB;QACpB,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;SAC7C;aAAM;YACL,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;SAC9C;IACH,CAAC;IAED;;OAEG;IACH,+BAAW,GAAX;QACE,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACH,gBAAC;AAAD,CAAC,AA1HD,CAAwB,UAAU,GA0HjC;AAED,eAAe,SAAS,CAAC"}

34
node_modules/ol/render/Event.d.ts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
export default RenderEvent;
declare class RenderEvent extends Event {
/**
* @param {import("./EventType.js").default} type Type.
* @param {import("../transform.js").Transform} [opt_inversePixelTransform] Transform for
* CSS pixels to rendered pixels.
* @param {import("../PluggableMap.js").FrameState} [opt_frameState] Frame state.
* @param {?(CanvasRenderingContext2D|WebGLRenderingContext)} [opt_context] Context.
*/
constructor(type: any, opt_inversePixelTransform?: number[] | undefined, opt_frameState?: import("../PluggableMap.js").FrameState | undefined, opt_context?: CanvasRenderingContext2D | WebGLRenderingContext | null | undefined);
/**
* Transform from CSS pixels (relative to the top-left corner of the map viewport)
* to rendered pixels on this event's `context`. Only available when a Canvas renderer is used, null otherwise.
* @type {import("../transform.js").Transform|undefined}
* @api
*/
inversePixelTransform: import("../transform.js").Transform | undefined;
/**
* An object representing the current render frame state.
* @type {import("../PluggableMap.js").FrameState|undefined}
* @api
*/
frameState: import("../PluggableMap.js").FrameState | undefined;
/**
* Canvas context. Not available when the event is dispatched by the map. For Canvas 2D layers,
* the context will be the 2D rendering context. For WebGL layers, the context will be the WebGL
* context.
* @type {CanvasRenderingContext2D|WebGLRenderingContext|undefined}
* @api
*/
context: CanvasRenderingContext2D | WebGLRenderingContext | undefined;
}
import Event from "../events/Event.js";
//# sourceMappingURL=Event.d.ts.map

1
node_modules/ol/render/Event.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Event.d.ts","sourceRoot":"","sources":["../src/render/Event.js"],"names":[],"mappings":";AAMA;IACE;;;;;;OAMG;IACH,kOA0BC;IAvBC;;;;;OAKG;IACH,uBAHU,OAAO,iBAAiB,EAAE,SAAS,GAAC,SAAS,CAGD;IAEtD;;;;OAIG;IACH,YAHU,OAAO,oBAAoB,EAAE,UAAU,GAAC,SAAS,CAG3B;IAEhC;;;;;;OAMG;IACH,SAHU,wBAAwB,GAAC,qBAAqB,GAAC,SAAS,CAGxC;CAE7B"}

57
node_modules/ol/render/Event.js generated vendored Normal file
View File

@@ -0,0 +1,57 @@
/**
* @module ol/render/Event
*/
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 Event from '../events/Event.js';
var RenderEvent = /** @class */ (function (_super) {
__extends(RenderEvent, _super);
/**
* @param {import("./EventType.js").default} type Type.
* @param {import("../transform.js").Transform} [opt_inversePixelTransform] Transform for
* CSS pixels to rendered pixels.
* @param {import("../PluggableMap.js").FrameState} [opt_frameState] Frame state.
* @param {?(CanvasRenderingContext2D|WebGLRenderingContext)} [opt_context] Context.
*/
function RenderEvent(type, opt_inversePixelTransform, opt_frameState, opt_context) {
var _this = _super.call(this, type) || this;
/**
* Transform from CSS pixels (relative to the top-left corner of the map viewport)
* to rendered pixels on this event's `context`. Only available when a Canvas renderer is used, null otherwise.
* @type {import("../transform.js").Transform|undefined}
* @api
*/
_this.inversePixelTransform = opt_inversePixelTransform;
/**
* An object representing the current render frame state.
* @type {import("../PluggableMap.js").FrameState|undefined}
* @api
*/
_this.frameState = opt_frameState;
/**
* Canvas context. Not available when the event is dispatched by the map. For Canvas 2D layers,
* the context will be the 2D rendering context. For WebGL layers, the context will be the WebGL
* context.
* @type {CanvasRenderingContext2D|WebGLRenderingContext|undefined}
* @api
*/
_this.context = opt_context;
return _this;
}
return RenderEvent;
}(Event));
export default RenderEvent;
//# sourceMappingURL=Event.js.map

1
node_modules/ol/render/Event.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Event.js","sourceRoot":"","sources":["../src/render/Event.js"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,OAAO,KAAK,MAAM,oBAAoB,CAAC;AAEvC;IAA0B,+BAAK;IAC7B;;;;;;OAMG;IACH,qBAAY,IAAI,EAAE,yBAAyB,EAAE,cAAc,EAAE,WAAW;QAAxE,YACE,kBAAM,IAAI,CAAC,SAyBZ;QAvBC;;;;;WAKG;QACH,KAAI,CAAC,qBAAqB,GAAG,yBAAyB,CAAC;QAEvD;;;;WAIG;QACH,KAAI,CAAC,UAAU,GAAG,cAAc,CAAC;QAEjC;;;;;;WAMG;QACH,KAAI,CAAC,OAAO,GAAG,WAAW,CAAC;;IAC7B,CAAC;IACH,kBAAC;AAAD,CAAC,AAnCD,CAA0B,KAAK,GAmC9B;AAED,eAAe,WAAW,CAAC"}

11
node_modules/ol/render/EventType.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
declare namespace _default {
const PRERENDER: string;
const POSTRENDER: string;
const PRECOMPOSE: string;
const POSTCOMPOSE: string;
const RENDERCOMPLETE: string;
}
export default _default;
export type MapRenderEventTypes = 'postrender' | 'precompose' | 'postcompose' | 'rendercomplete';
export type LayerRenderEventTypes = 'postrender' | 'prerender';
//# sourceMappingURL=EventType.d.ts.map

1
node_modules/ol/render/EventType.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"EventType.d.ts","sourceRoot":"","sources":["../src/render/EventType.js"],"names":[],"mappings":";;;;;;;;kCAmDa,YAAY,GAAC,YAAY,GAAC,aAAa,GAAC,gBAAgB;oCAIxD,YAAY,GAAC,WAAW"}

51
node_modules/ol/render/EventType.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
/**
* @module ol/render/EventType
*/
/**
* @enum {string}
*/
export default {
/**
* Triggered before a layer is rendered.
* @event module:ol/render/Event~RenderEvent#prerender
* @api
*/
PRERENDER: 'prerender',
/**
* Triggered after a layer is rendered.
* @event module:ol/render/Event~RenderEvent#postrender
* @api
*/
POSTRENDER: 'postrender',
/**
* Triggered before layers are composed. When dispatched by the map, the event object will not have
* a `context` set. When dispatched by a layer, the event object will have a `context` set. Only
* WebGL layers currently dispatch this event.
* @event module:ol/render/Event~RenderEvent#precompose
* @api
*/
PRECOMPOSE: 'precompose',
/**
* Triggered after layers are composed. When dispatched by the map, the event object will not have
* a `context` set. When dispatched by a layer, the event object will have a `context` set. Only
* WebGL layers currently dispatch this event.
* @event module:ol/render/Event~RenderEvent#postcompose
* @api
*/
POSTCOMPOSE: 'postcompose',
/**
* Triggered when rendering is complete, i.e. all sources and tiles have
* finished loading for the current viewport, and all tiles are faded in.
* The event object will not have a `context` set.
* @event module:ol/render/Event~RenderEvent#rendercomplete
* @api
*/
RENDERCOMPLETE: 'rendercomplete',
};
/**
* @typedef {'postrender'|'precompose'|'postcompose'|'rendercomplete'} MapRenderEventTypes
*/
/**
* @typedef {'postrender'|'prerender'} LayerRenderEventTypes
*/
//# sourceMappingURL=EventType.js.map

1
node_modules/ol/render/EventType.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"EventType.js","sourceRoot":"","sources":["../src/render/EventType.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAe;IACb;;;;OAIG;IACH,SAAS,EAAE,WAAW;IAEtB;;;;OAIG;IACH,UAAU,EAAE,YAAY;IAExB;;;;;;OAMG;IACH,UAAU,EAAE,YAAY;IAExB;;;;;;OAMG;IACH,WAAW,EAAE,aAAa;IAE1B;;;;;;OAMG;IACH,cAAc,EAAE,gBAAgB;CACjC,CAAC;AAEF;;GAEG;AAEH;;GAEG"}

187
node_modules/ol/render/Feature.d.ts generated vendored Normal file
View File

@@ -0,0 +1,187 @@
/**
* Create a geometry from an `ol/render/Feature`
* @param {RenderFeature} renderFeature
* Render Feature
* @return {Point|MultiPoint|LineString|MultiLineString|Polygon|MultiPolygon}
* New geometry instance.
* @api
*/
export function toGeometry(renderFeature: RenderFeature): Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon;
/**
* Create an `ol/Feature` from an `ol/render/Feature`
* @param {RenderFeature} renderFeature RenderFeature
* @param {string} [opt_geometryName='geometry'] Geometry name to use
* when creating the Feature.
* @return {Feature} Newly constructed `ol/Feature` with properties,
* geometry, and id copied over.
* @api
*/
export function toFeature(renderFeature: RenderFeature, opt_geometryName?: string | undefined): Feature;
export default RenderFeature;
/**
* Lightweight, read-only, {@link module:ol/Feature~Feature} and {@link module:ol/geom/Geometry~Geometry} like
* structure, optimized for vector tile rendering and styling. Geometry access
* through the API is limited to getting the type and extent of the geometry.
*/
declare class RenderFeature {
/**
* @param {import("../geom/Geometry.js").Type} type Geometry type.
* @param {Array<number>} flatCoordinates Flat coordinates. These always need
* to be right-handed for polygons.
* @param {Array<number>|Array<Array<number>>} ends Ends or Endss.
* @param {Object<string, *>} properties Properties.
* @param {number|string|undefined} id Feature id.
*/
constructor(type: import("../geom/Geometry.js").Type, flatCoordinates: Array<number>, ends: Array<number> | Array<Array<number>>, properties: {
[x: string]: any;
}, id: number | string | undefined);
/**
* @type {import("../style/Style.js").StyleFunction|undefined}
*/
styleFunction: import("../style/Style.js").StyleFunction | undefined;
/**
* @private
* @type {import("../extent.js").Extent|undefined}
*/
private extent_;
/**
* @private
* @type {number|string|undefined}
*/
private id_;
/**
* @private
* @type {import("../geom/Geometry.js").Type}
*/
private type_;
/**
* @private
* @type {Array<number>}
*/
private flatCoordinates_;
/**
* @private
* @type {Array<number>}
*/
private flatInteriorPoints_;
/**
* @private
* @type {Array<number>}
*/
private flatMidpoints_;
/**
* @private
* @type {Array<number>|Array<Array<number>>}
*/
private ends_;
/**
* @private
* @type {Object<string, *>}
*/
private properties_;
/**
* Get a feature property by its key.
* @param {string} key Key
* @return {*} Value for the requested key.
* @api
*/
get(key: string): any;
/**
* Get the extent of this feature's geometry.
* @return {import("../extent.js").Extent} Extent.
* @api
*/
getExtent(): import("../extent.js").Extent;
/**
* @return {Array<number>} Flat interior points.
*/
getFlatInteriorPoint(): Array<number>;
/**
* @return {Array<number>} Flat interior points.
*/
getFlatInteriorPoints(): Array<number>;
/**
* @return {Array<number>} Flat midpoint.
*/
getFlatMidpoint(): Array<number>;
/**
* @return {Array<number>} Flat midpoints.
*/
getFlatMidpoints(): Array<number>;
/**
* Get the feature identifier. This is a stable identifier for the feature and
* is set when reading data from a remote source.
* @return {number|string|undefined} Id.
* @api
*/
getId(): number | string | undefined;
/**
* @return {Array<number>} Flat coordinates.
*/
getOrientedFlatCoordinates(): Array<number>;
/**
* For API compatibility with {@link module:ol/Feature~Feature}, this method is useful when
* determining the geometry type in style function (see {@link #getType}).
* @return {RenderFeature} Feature.
* @api
*/
getGeometry(): RenderFeature;
/**
* @param {number} squaredTolerance Squared tolerance.
* @return {RenderFeature} Simplified geometry.
*/
getSimplifiedGeometry(squaredTolerance: number): RenderFeature;
/**
* Get a transformed and simplified version of the geometry.
* @abstract
* @param {number} squaredTolerance Squared tolerance.
* @param {import("../proj.js").TransformFunction} [opt_transform] Optional transform function.
* @return {RenderFeature} Simplified geometry.
*/
simplifyTransformed(squaredTolerance: number, opt_transform?: import("../proj.js").TransformFunction | undefined): RenderFeature;
/**
* Get the feature properties.
* @return {Object<string, *>} Feature properties.
* @api
*/
getProperties(): {
[x: string]: any;
};
/**
* @return {number} Stride.
*/
getStride(): number;
/**
* @return {import('../style/Style.js').StyleFunction|undefined} Style
*/
getStyleFunction(): import('../style/Style.js').StyleFunction | undefined;
/**
* Get the type of this feature's geometry.
* @return {import("../geom/Geometry.js").Type} Geometry type.
* @api
*/
getType(): import("../geom/Geometry.js").Type;
/**
* Transform geometry coordinates from tile pixel space to projected.
*
* @param {import("../proj.js").ProjectionLike} projection The data projection
*/
transform(projection: import("../proj.js").ProjectionLike): void;
/**
* @return {Array<number>|Array<Array<number>>} Ends or endss.
*/
getEnds(): Array<number> | Array<Array<number>>;
getEndss: () => Array<number> | Array<Array<number>>;
/**
* @return {Array<number>} Flat coordinates.
*/
getFlatCoordinates: () => Array<number>;
}
import { Point } from "../geom.js";
import { MultiPoint } from "../geom.js";
import { LineString } from "../geom.js";
import { MultiLineString } from "../geom.js";
import { Polygon } from "../geom.js";
import { MultiPolygon } from "../geom.js";
import Feature from "../Feature.js";
//# sourceMappingURL=Feature.d.ts.map

1
node_modules/ol/render/Feature.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Feature.d.ts","sourceRoot":"","sources":["../src/render/Feature.js"],"names":[],"mappings":"AAkVA;;;;;;;GAOG;AACH,0CANW,aAAa,GAEZ,KAAK,GAAC,UAAU,GAAC,UAAU,GAAC,eAAe,GAAC,OAAO,GAAC,YAAY,CAmC3E;AAED;;;;;;;;GAQG;AACH,yCAPW,aAAa,0CAGZ,OAAO,CAkBlB;;AA3WD;;;;GAIG;AACH;IACE;;;;;;;OAOG;IACH,kBAPW,OAAO,qBAAqB,EAAE,IAAI,mBAClC,MAAM,MAAM,CAAC,QAEb,MAAM,MAAM,CAAC,GAAC,MAAM,MAAM,MAAM,CAAC,CAAC;YAC3B,MAAM;WACb,MAAM,GAAC,MAAM,GAAC,SAAS,EAuDjC;IApDC;;OAEG;IACH,eAFU,OAAO,mBAAmB,EAAE,aAAa,GAAC,SAAS,CAE3C;IAElB;;;OAGG;IACH,gBAAY;IAEZ;;;OAGG;IACH,YAAa;IAEb;;;OAGG;IACH,cAAiB;IAEjB;;;OAGG;IACH,yBAAuC;IAEvC;;;OAGG;IACH,4BAA+B;IAE/B;;;OAGG;IACH,uBAA0B;IAE1B;;;OAGG;IACH,cAAiB;IAEjB;;;OAGG;IACH,oBAA6B;IAG/B;;;;;OAKG;IACH,SAJW,MAAM,OAMhB;IAED;;;;OAIG;IACH,aAHY,OAAO,cAAc,EAAE,MAAM,CAgBxC;IAED;;OAEG;IACH,wBAFY,MAAM,MAAM,CAAC,CAexB;IAED;;OAEG;IACH,yBAFY,MAAM,MAAM,CAAC,CAmBxB;IAED;;OAEG;IACH,mBAFY,MAAM,MAAM,CAAC,CAaxB;IAED;;OAEG;IACH,oBAFY,MAAM,MAAM,CAAC,CAgBxB;IAED;;;;;OAKG;IACH,SAHY,MAAM,GAAC,MAAM,GAAC,SAAS,CAKlC;IAED;;OAEG;IACH,8BAFY,MAAM,MAAM,CAAC,CAIxB;IAED;;;;;OAKG;IACH,eAHY,aAAa,CAKxB;IAED;;;OAGG;IACH,wCAHW,MAAM,GACL,aAAa,CAIxB;IAED;;;;;;OAMG;IACH,sCAJW,MAAM,uEAEL,aAAa,CAIxB;IAED;;;;OAIG;IACH;YAHmB,MAAM;MAKxB;IAED;;OAEG;IACH,aAFY,MAAM,CAIjB;IAED;;OAEG;IACH,oBAFY,OAAO,mBAAmB,EAAE,aAAa,GAAC,SAAS,CAI9D;IAED;;;;OAIG;IACH,WAHY,OAAO,qBAAqB,EAAE,IAAI,CAK7C;IAED;;;;OAIG;IACH,sBAFW,OAAO,YAAY,EAAE,cAAc,QA2B7C;IACD;;OAEG;IACH,WAFY,MAAM,MAAM,CAAC,GAAC,MAAM,MAAM,MAAM,CAAC,CAAC,CAI7C;IAGH,gBAPc,MAAM,MAAM,CAAC,GAAC,MAAM,MAAM,MAAM,CAAC,CAAC,CAOhB;IAEhC;;OAEG;IACH,0BA/Gc,MAAM,MAAM,CAAC,CA+Ge;CAPzC"}

307
node_modules/ol/render/Feature.js generated vendored Normal file
View File

@@ -0,0 +1,307 @@
/**
* @module ol/render/Feature
*/
import Feature from '../Feature.js';
import GeometryLayout from '../geom/GeometryLayout.js';
import { LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon, } from '../geom.js';
import { compose as composeTransform, create as createTransform, } from '../transform.js';
import { createOrUpdateFromCoordinate, createOrUpdateFromFlatCoordinates, getCenter, getHeight, } from '../extent.js';
import { extend } from '../array.js';
import { getInteriorPointOfArray, getInteriorPointsOfMultiArray, } from '../geom/flat/interiorpoint.js';
import { get as getProjection } from '../proj.js';
import { inflateEnds } from '../geom/flat/orient.js';
import { interpolatePoint } from '../geom/flat/interpolate.js';
import { linearRingss as linearRingssCenter } from '../geom/flat/center.js';
import { transform2D } from '../geom/flat/transform.js';
/**
* @type {import("../transform.js").Transform}
*/
var tmpTransform = createTransform();
/**
* Lightweight, read-only, {@link module:ol/Feature~Feature} and {@link module:ol/geom/Geometry~Geometry} like
* structure, optimized for vector tile rendering and styling. Geometry access
* through the API is limited to getting the type and extent of the geometry.
*/
var RenderFeature = /** @class */ (function () {
/**
* @param {import("../geom/Geometry.js").Type} type Geometry type.
* @param {Array<number>} flatCoordinates Flat coordinates. These always need
* to be right-handed for polygons.
* @param {Array<number>|Array<Array<number>>} ends Ends or Endss.
* @param {Object<string, *>} properties Properties.
* @param {number|string|undefined} id Feature id.
*/
function RenderFeature(type, flatCoordinates, ends, properties, id) {
/**
* @type {import("../style/Style.js").StyleFunction|undefined}
*/
this.styleFunction;
/**
* @private
* @type {import("../extent.js").Extent|undefined}
*/
this.extent_;
/**
* @private
* @type {number|string|undefined}
*/
this.id_ = id;
/**
* @private
* @type {import("../geom/Geometry.js").Type}
*/
this.type_ = type;
/**
* @private
* @type {Array<number>}
*/
this.flatCoordinates_ = flatCoordinates;
/**
* @private
* @type {Array<number>}
*/
this.flatInteriorPoints_ = null;
/**
* @private
* @type {Array<number>}
*/
this.flatMidpoints_ = null;
/**
* @private
* @type {Array<number>|Array<Array<number>>}
*/
this.ends_ = ends;
/**
* @private
* @type {Object<string, *>}
*/
this.properties_ = properties;
}
/**
* Get a feature property by its key.
* @param {string} key Key
* @return {*} Value for the requested key.
* @api
*/
RenderFeature.prototype.get = function (key) {
return this.properties_[key];
};
/**
* Get the extent of this feature's geometry.
* @return {import("../extent.js").Extent} Extent.
* @api
*/
RenderFeature.prototype.getExtent = function () {
if (!this.extent_) {
this.extent_ =
this.type_ === 'Point'
? createOrUpdateFromCoordinate(this.flatCoordinates_)
: createOrUpdateFromFlatCoordinates(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2);
}
return this.extent_;
};
/**
* @return {Array<number>} Flat interior points.
*/
RenderFeature.prototype.getFlatInteriorPoint = function () {
if (!this.flatInteriorPoints_) {
var flatCenter = getCenter(this.getExtent());
this.flatInteriorPoints_ = getInteriorPointOfArray(this.flatCoordinates_, 0,
/** @type {Array<number>} */ (this.ends_), 2, flatCenter, 0);
}
return this.flatInteriorPoints_;
};
/**
* @return {Array<number>} Flat interior points.
*/
RenderFeature.prototype.getFlatInteriorPoints = function () {
if (!this.flatInteriorPoints_) {
var flatCenters = linearRingssCenter(this.flatCoordinates_, 0,
/** @type {Array<Array<number>>} */ (this.ends_), 2);
this.flatInteriorPoints_ = getInteriorPointsOfMultiArray(this.flatCoordinates_, 0,
/** @type {Array<Array<number>>} */ (this.ends_), 2, flatCenters);
}
return this.flatInteriorPoints_;
};
/**
* @return {Array<number>} Flat midpoint.
*/
RenderFeature.prototype.getFlatMidpoint = function () {
if (!this.flatMidpoints_) {
this.flatMidpoints_ = interpolatePoint(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2, 0.5);
}
return this.flatMidpoints_;
};
/**
* @return {Array<number>} Flat midpoints.
*/
RenderFeature.prototype.getFlatMidpoints = function () {
if (!this.flatMidpoints_) {
this.flatMidpoints_ = [];
var flatCoordinates = this.flatCoordinates_;
var offset = 0;
var ends = /** @type {Array<number>} */ (this.ends_);
for (var i = 0, ii = ends.length; i < ii; ++i) {
var end = ends[i];
var midpoint = interpolatePoint(flatCoordinates, offset, end, 2, 0.5);
extend(this.flatMidpoints_, midpoint);
offset = end;
}
}
return this.flatMidpoints_;
};
/**
* Get the feature identifier. This is a stable identifier for the feature and
* is set when reading data from a remote source.
* @return {number|string|undefined} Id.
* @api
*/
RenderFeature.prototype.getId = function () {
return this.id_;
};
/**
* @return {Array<number>} Flat coordinates.
*/
RenderFeature.prototype.getOrientedFlatCoordinates = function () {
return this.flatCoordinates_;
};
/**
* For API compatibility with {@link module:ol/Feature~Feature}, this method is useful when
* determining the geometry type in style function (see {@link #getType}).
* @return {RenderFeature} Feature.
* @api
*/
RenderFeature.prototype.getGeometry = function () {
return this;
};
/**
* @param {number} squaredTolerance Squared tolerance.
* @return {RenderFeature} Simplified geometry.
*/
RenderFeature.prototype.getSimplifiedGeometry = function (squaredTolerance) {
return this;
};
/**
* Get a transformed and simplified version of the geometry.
* @abstract
* @param {number} squaredTolerance Squared tolerance.
* @param {import("../proj.js").TransformFunction} [opt_transform] Optional transform function.
* @return {RenderFeature} Simplified geometry.
*/
RenderFeature.prototype.simplifyTransformed = function (squaredTolerance, opt_transform) {
return this;
};
/**
* Get the feature properties.
* @return {Object<string, *>} Feature properties.
* @api
*/
RenderFeature.prototype.getProperties = function () {
return this.properties_;
};
/**
* @return {number} Stride.
*/
RenderFeature.prototype.getStride = function () {
return 2;
};
/**
* @return {import('../style/Style.js').StyleFunction|undefined} Style
*/
RenderFeature.prototype.getStyleFunction = function () {
return this.styleFunction;
};
/**
* Get the type of this feature's geometry.
* @return {import("../geom/Geometry.js").Type} Geometry type.
* @api
*/
RenderFeature.prototype.getType = function () {
return this.type_;
};
/**
* Transform geometry coordinates from tile pixel space to projected.
*
* @param {import("../proj.js").ProjectionLike} projection The data projection
*/
RenderFeature.prototype.transform = function (projection) {
projection = getProjection(projection);
var pixelExtent = projection.getExtent();
var projectedExtent = projection.getWorldExtent();
if (pixelExtent && projectedExtent) {
var scale = getHeight(projectedExtent) / getHeight(pixelExtent);
composeTransform(tmpTransform, projectedExtent[0], projectedExtent[3], scale, -scale, 0, 0, 0);
transform2D(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2, tmpTransform, this.flatCoordinates_);
}
};
/**
* @return {Array<number>|Array<Array<number>>} Ends or endss.
*/
RenderFeature.prototype.getEnds = function () {
return this.ends_;
};
return RenderFeature;
}());
RenderFeature.prototype.getEndss = RenderFeature.prototype.getEnds;
/**
* @return {Array<number>} Flat coordinates.
*/
RenderFeature.prototype.getFlatCoordinates =
RenderFeature.prototype.getOrientedFlatCoordinates;
/**
* Create a geometry from an `ol/render/Feature`
* @param {RenderFeature} renderFeature
* Render Feature
* @return {Point|MultiPoint|LineString|MultiLineString|Polygon|MultiPolygon}
* New geometry instance.
* @api
*/
export function toGeometry(renderFeature) {
var geometryType = renderFeature.getType();
switch (geometryType) {
case 'Point':
return new Point(renderFeature.getFlatCoordinates());
case 'MultiPoint':
return new MultiPoint(renderFeature.getFlatCoordinates(), GeometryLayout.XY);
case 'LineString':
return new LineString(renderFeature.getFlatCoordinates(), GeometryLayout.XY);
case 'MultiLineString':
return new MultiLineString(renderFeature.getFlatCoordinates(), GeometryLayout.XY,
/** @type {Array<number>} */ (renderFeature.getEnds()));
case 'Polygon':
var flatCoordinates = renderFeature.getFlatCoordinates();
var ends = /** @type {Array<number>} */ (renderFeature.getEnds());
var endss = inflateEnds(flatCoordinates, ends);
return endss.length > 1
? new MultiPolygon(flatCoordinates, GeometryLayout.XY, endss)
: new Polygon(flatCoordinates, GeometryLayout.XY, ends);
default:
throw new Error('Invalid geometry type:' + geometryType);
}
}
/**
* Create an `ol/Feature` from an `ol/render/Feature`
* @param {RenderFeature} renderFeature RenderFeature
* @param {string} [opt_geometryName='geometry'] Geometry name to use
* when creating the Feature.
* @return {Feature} Newly constructed `ol/Feature` with properties,
* geometry, and id copied over.
* @api
*/
export function toFeature(renderFeature, opt_geometryName) {
var id = renderFeature.getId();
var geometry = toGeometry(renderFeature);
var properties = renderFeature.getProperties();
var feature = new Feature();
if (opt_geometryName !== undefined) {
feature.setGeometryName(opt_geometryName);
}
feature.setGeometry(geometry);
if (id !== undefined) {
feature.setId(id);
}
feature.setProperties(properties, true);
return feature;
}
export default RenderFeature;
//# sourceMappingURL=Feature.js.map

1
node_modules/ol/render/Feature.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

103
node_modules/ol/render/VectorContext.d.ts generated vendored Normal file
View File

@@ -0,0 +1,103 @@
export default VectorContext;
/**
* @module ol/render/VectorContext
*/
/**
* @classdesc
* Context for drawing geometries. A vector context is available on render
* events and does not need to be constructed directly.
* @api
*/
declare class VectorContext {
/**
* Render a geometry with a custom renderer.
*
* @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
* @param {Function} renderer Renderer.
* @param {Function} hitDetectionRenderer Renderer.
*/
drawCustom(geometry: import("../geom/SimpleGeometry.js").default, feature: import("../Feature.js").FeatureLike, renderer: Function, hitDetectionRenderer: Function): void;
/**
* Render a geometry.
*
* @param {import("../geom/Geometry.js").default} geometry The geometry to render.
*/
drawGeometry(geometry: import("../geom/Geometry.js").default): void;
/**
* Set the rendering style.
*
* @param {import("../style/Style.js").default} style The rendering style.
*/
setStyle(style: import("../style/Style.js").default): void;
/**
* @param {import("../geom/Circle.js").default} circleGeometry Circle geometry.
* @param {import("../Feature.js").default} feature Feature.
*/
drawCircle(circleGeometry: import("../geom/Circle.js").default, feature: import("../Feature.js").default): void;
/**
* @param {import("../Feature.js").default} feature Feature.
* @param {import("../style/Style.js").default} style Style.
*/
drawFeature(feature: import("../Feature.js").default, style: import("../style/Style.js").default): void;
/**
* @param {import("../geom/GeometryCollection.js").default} geometryCollectionGeometry Geometry collection.
* @param {import("../Feature.js").default} feature Feature.
*/
drawGeometryCollection(geometryCollectionGeometry: import("../geom/GeometryCollection.js").default, feature: import("../Feature.js").default): void;
/**
* @param {import("../geom/LineString.js").default|import("./Feature.js").default} lineStringGeometry Line string geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
drawLineString(lineStringGeometry: import("../geom/LineString.js").default | import("./Feature.js").default, feature: import("../Feature.js").FeatureLike): void;
/**
* @param {import("../geom/MultiLineString.js").default|import("./Feature.js").default} multiLineStringGeometry MultiLineString geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
drawMultiLineString(multiLineStringGeometry: import("../geom/MultiLineString.js").default | import("./Feature.js").default, feature: import("../Feature.js").FeatureLike): void;
/**
* @param {import("../geom/MultiPoint.js").default|import("./Feature.js").default} multiPointGeometry MultiPoint geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
drawMultiPoint(multiPointGeometry: import("../geom/MultiPoint.js").default | import("./Feature.js").default, feature: import("../Feature.js").FeatureLike): void;
/**
* @param {import("../geom/MultiPolygon.js").default} multiPolygonGeometry MultiPolygon geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
drawMultiPolygon(multiPolygonGeometry: import("../geom/MultiPolygon.js").default, feature: import("../Feature.js").FeatureLike): void;
/**
* @param {import("../geom/Point.js").default|import("./Feature.js").default} pointGeometry Point geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
drawPoint(pointGeometry: import("../geom/Point.js").default | import("./Feature.js").default, feature: import("../Feature.js").FeatureLike): void;
/**
* @param {import("../geom/Polygon.js").default|import("./Feature.js").default} polygonGeometry Polygon geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
drawPolygon(polygonGeometry: import("../geom/Polygon.js").default | import("./Feature.js").default, feature: import("../Feature.js").FeatureLike): void;
/**
* @param {import("../geom/SimpleGeometry.js").default|import("./Feature.js").default} geometry Geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
drawText(geometry: import("../geom/SimpleGeometry.js").default | import("./Feature.js").default, feature: import("../Feature.js").FeatureLike): void;
/**
* @param {import("../style/Fill.js").default} fillStyle Fill style.
* @param {import("../style/Stroke.js").default} strokeStyle Stroke style.
*/
setFillStrokeStyle(fillStyle: import("../style/Fill.js").default, strokeStyle: import("../style/Stroke.js").default): void;
/**
* @param {import("../style/Image.js").default} imageStyle Image style.
* @param {import("../render/canvas.js").DeclutterImageWithText} [opt_declutterImageWithText] Shared data for combined decluttering with a text style.
*/
setImageStyle(imageStyle: import("../style/Image.js").default, opt_declutterImageWithText?: {
[x: number]: import("./canvas/Executor.js").ReplayImageOrLabelArgs;
} | undefined): void;
/**
* @param {import("../style/Text.js").default} textStyle Text style.
* @param {import("../render/canvas.js").DeclutterImageWithText} [opt_declutterImageWithText] Shared data for combined decluttering with an image style.
*/
setTextStyle(textStyle: import("../style/Text.js").default, opt_declutterImageWithText?: {
[x: number]: import("./canvas/Executor.js").ReplayImageOrLabelArgs;
} | undefined): void;
}
//# sourceMappingURL=VectorContext.d.ts.map

1
node_modules/ol/render/VectorContext.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"VectorContext.d.ts","sourceRoot":"","sources":["../src/render/VectorContext.js"],"names":[],"mappings":";AAAA;;GAEG;AAEH;;;;;GAKG;AACH;IACE;;;;;;;OAOG;IACH,qBALW,OAAO,2BAA2B,EAAE,OAAO,WAC3C,OAAO,eAAe,EAAE,WAAW,4DAIkB;IAEhE;;;;OAIG;IACH,uBAFW,OAAO,qBAAqB,EAAE,OAAO,QAEvB;IAEzB;;;;OAIG;IACH,gBAFW,OAAO,mBAAmB,EAAE,OAAO,QAE5B;IAElB;;;OAGG;IACH,2BAHW,OAAO,mBAAmB,EAAE,OAAO,WACnC,OAAO,eAAe,EAAE,OAAO,QAEJ;IAEtC;;;OAGG;IACH,qBAHW,OAAO,eAAe,EAAE,OAAO,SAC/B,OAAO,mBAAmB,EAAE,OAAO,QAEhB;IAE9B;;;OAGG;IACH,mDAHW,OAAO,+BAA+B,EAAE,OAAO,WAC/C,OAAO,eAAe,EAAE,OAAO,QAEoB;IAE9D;;;OAGG;IACH,mCAHW,OAAO,uBAAuB,EAAE,OAAO,GAAC,OAAO,cAAc,EAAE,OAAO,WACtE,OAAO,eAAe,EAAE,WAAW,QAEA;IAE9C;;;OAGG;IACH,6CAHW,OAAO,4BAA4B,EAAE,OAAO,GAAC,OAAO,cAAc,EAAE,OAAO,WAC3E,OAAO,eAAe,EAAE,WAAW,QAEU;IAExD;;;OAGG;IACH,mCAHW,OAAO,uBAAuB,EAAE,OAAO,GAAC,OAAO,cAAc,EAAE,OAAO,WACtE,OAAO,eAAe,EAAE,WAAW,QAEA;IAE9C;;;OAGG;IACH,uCAHW,OAAO,yBAAyB,EAAE,OAAO,WACzC,OAAO,eAAe,EAAE,WAAW,QAEI;IAElD;;;OAGG;IACH,yBAHW,OAAO,kBAAkB,EAAE,OAAO,GAAC,OAAO,cAAc,EAAE,OAAO,WACjE,OAAO,eAAe,EAAE,WAAW,QAEV;IAEpC;;;OAGG;IACH,6BAHW,OAAO,oBAAoB,EAAE,OAAO,GAAC,OAAO,cAAc,EAAE,OAAO,WACnE,OAAO,eAAe,EAAE,WAAW,QAEN;IAExC;;;OAGG;IACH,mBAHW,OAAO,2BAA2B,EAAE,OAAO,GAAC,OAAO,cAAc,EAAE,OAAO,WAC1E,OAAO,eAAe,EAAE,WAAW,QAEhB;IAE9B;;;OAGG;IACH,8BAHW,OAAO,kBAAkB,EAAE,OAAO,eAClC,OAAO,oBAAoB,EAAE,OAAO,QAEF;IAE7C;;;OAGG;IACH,0BAHW,OAAO,mBAAmB,EAAE,OAAO;;yBAGU;IAExD;;;OAGG;IACH,wBAHW,OAAO,kBAAkB,EAAE,OAAO;;yBAGS;CACvD"}

102
node_modules/ol/render/VectorContext.js generated vendored Normal file
View File

@@ -0,0 +1,102 @@
/**
* @module ol/render/VectorContext
*/
/**
* @classdesc
* Context for drawing geometries. A vector context is available on render
* events and does not need to be constructed directly.
* @api
*/
var VectorContext = /** @class */ (function () {
function VectorContext() {
}
/**
* Render a geometry with a custom renderer.
*
* @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
* @param {Function} renderer Renderer.
* @param {Function} hitDetectionRenderer Renderer.
*/
VectorContext.prototype.drawCustom = function (geometry, feature, renderer, hitDetectionRenderer) { };
/**
* Render a geometry.
*
* @param {import("../geom/Geometry.js").default} geometry The geometry to render.
*/
VectorContext.prototype.drawGeometry = function (geometry) { };
/**
* Set the rendering style.
*
* @param {import("../style/Style.js").default} style The rendering style.
*/
VectorContext.prototype.setStyle = function (style) { };
/**
* @param {import("../geom/Circle.js").default} circleGeometry Circle geometry.
* @param {import("../Feature.js").default} feature Feature.
*/
VectorContext.prototype.drawCircle = function (circleGeometry, feature) { };
/**
* @param {import("../Feature.js").default} feature Feature.
* @param {import("../style/Style.js").default} style Style.
*/
VectorContext.prototype.drawFeature = function (feature, style) { };
/**
* @param {import("../geom/GeometryCollection.js").default} geometryCollectionGeometry Geometry collection.
* @param {import("../Feature.js").default} feature Feature.
*/
VectorContext.prototype.drawGeometryCollection = function (geometryCollectionGeometry, feature) { };
/**
* @param {import("../geom/LineString.js").default|import("./Feature.js").default} lineStringGeometry Line string geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
VectorContext.prototype.drawLineString = function (lineStringGeometry, feature) { };
/**
* @param {import("../geom/MultiLineString.js").default|import("./Feature.js").default} multiLineStringGeometry MultiLineString geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
VectorContext.prototype.drawMultiLineString = function (multiLineStringGeometry, feature) { };
/**
* @param {import("../geom/MultiPoint.js").default|import("./Feature.js").default} multiPointGeometry MultiPoint geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
VectorContext.prototype.drawMultiPoint = function (multiPointGeometry, feature) { };
/**
* @param {import("../geom/MultiPolygon.js").default} multiPolygonGeometry MultiPolygon geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
VectorContext.prototype.drawMultiPolygon = function (multiPolygonGeometry, feature) { };
/**
* @param {import("../geom/Point.js").default|import("./Feature.js").default} pointGeometry Point geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
VectorContext.prototype.drawPoint = function (pointGeometry, feature) { };
/**
* @param {import("../geom/Polygon.js").default|import("./Feature.js").default} polygonGeometry Polygon geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
VectorContext.prototype.drawPolygon = function (polygonGeometry, feature) { };
/**
* @param {import("../geom/SimpleGeometry.js").default|import("./Feature.js").default} geometry Geometry.
* @param {import("../Feature.js").FeatureLike} feature Feature.
*/
VectorContext.prototype.drawText = function (geometry, feature) { };
/**
* @param {import("../style/Fill.js").default} fillStyle Fill style.
* @param {import("../style/Stroke.js").default} strokeStyle Stroke style.
*/
VectorContext.prototype.setFillStrokeStyle = function (fillStyle, strokeStyle) { };
/**
* @param {import("../style/Image.js").default} imageStyle Image style.
* @param {import("../render/canvas.js").DeclutterImageWithText} [opt_declutterImageWithText] Shared data for combined decluttering with a text style.
*/
VectorContext.prototype.setImageStyle = function (imageStyle, opt_declutterImageWithText) { };
/**
* @param {import("../style/Text.js").default} textStyle Text style.
* @param {import("../render/canvas.js").DeclutterImageWithText} [opt_declutterImageWithText] Shared data for combined decluttering with an image style.
*/
VectorContext.prototype.setTextStyle = function (textStyle, opt_declutterImageWithText) { };
return VectorContext;
}());
export default VectorContext;
//# sourceMappingURL=VectorContext.js.map

1
node_modules/ol/render/VectorContext.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"VectorContext.js","sourceRoot":"","sources":["../src/render/VectorContext.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH;IAAA;IAsGA,CAAC;IArGC;;;;;;;OAOG;IACH,kCAAU,GAAV,UAAW,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,IAAG,CAAC;IAEhE;;;;OAIG;IACH,oCAAY,GAAZ,UAAa,QAAQ,IAAG,CAAC;IAEzB;;;;OAIG;IACH,gCAAQ,GAAR,UAAS,KAAK,IAAG,CAAC;IAElB;;;OAGG;IACH,kCAAU,GAAV,UAAW,cAAc,EAAE,OAAO,IAAG,CAAC;IAEtC;;;OAGG;IACH,mCAAW,GAAX,UAAY,OAAO,EAAE,KAAK,IAAG,CAAC;IAE9B;;;OAGG;IACH,8CAAsB,GAAtB,UAAuB,0BAA0B,EAAE,OAAO,IAAG,CAAC;IAE9D;;;OAGG;IACH,sCAAc,GAAd,UAAe,kBAAkB,EAAE,OAAO,IAAG,CAAC;IAE9C;;;OAGG;IACH,2CAAmB,GAAnB,UAAoB,uBAAuB,EAAE,OAAO,IAAG,CAAC;IAExD;;;OAGG;IACH,sCAAc,GAAd,UAAe,kBAAkB,EAAE,OAAO,IAAG,CAAC;IAE9C;;;OAGG;IACH,wCAAgB,GAAhB,UAAiB,oBAAoB,EAAE,OAAO,IAAG,CAAC;IAElD;;;OAGG;IACH,iCAAS,GAAT,UAAU,aAAa,EAAE,OAAO,IAAG,CAAC;IAEpC;;;OAGG;IACH,mCAAW,GAAX,UAAY,eAAe,EAAE,OAAO,IAAG,CAAC;IAExC;;;OAGG;IACH,gCAAQ,GAAR,UAAS,QAAQ,EAAE,OAAO,IAAG,CAAC;IAE9B;;;OAGG;IACH,0CAAkB,GAAlB,UAAmB,SAAS,EAAE,WAAW,IAAG,CAAC;IAE7C;;;OAGG;IACH,qCAAa,GAAb,UAAc,UAAU,EAAE,0BAA0B,IAAG,CAAC;IAExD;;;OAGG;IACH,oCAAY,GAAZ,UAAa,SAAS,EAAE,0BAA0B,IAAG,CAAC;IACxD,oBAAC;AAAD,CAAC,AAtGD,IAsGC;AAED,eAAe,aAAa,CAAC"}

403
node_modules/ol/render/canvas.d.ts generated vendored Normal file
View File

@@ -0,0 +1,403 @@
/**
* @param {string} font Font.
* @param {string} text Text.
* @return {number} Width.
*/
export function measureTextWidth(font: string, text: string): number;
/**
* Measure text width using a cache.
* @param {string} font The font.
* @param {string} text The text to measure.
* @param {Object<string, number>} cache A lookup of cached widths by text.
* @return {number} The text width.
*/
export function measureAndCacheTextWidth(font: string, text: string, cache: {
[x: string]: number;
}): number;
/**
* @param {TextState} baseStyle Base style.
* @param {Array<string>} chunks Text chunks to measure.
* @return {{width: number, height: number, widths: Array<number>, heights: Array<number>, lineWidths: Array<number>}}} Text metrics.
*/
export function getTextDimensions(baseStyle: TextState, chunks: Array<string>): {
width: number;
height: number;
widths: Array<number>;
heights: Array<number>;
lineWidths: Array<number>;
};
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {number} rotation Rotation.
* @param {number} offsetX X offset.
* @param {number} offsetY Y offset.
*/
export function rotateAtOffset(context: CanvasRenderingContext2D, rotation: number, offsetX: number, offsetY: number): void;
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {import("../transform.js").Transform|null} transform Transform.
* @param {number} opacity Opacity.
* @param {Label|HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} labelOrImage Label.
* @param {number} originX Origin X.
* @param {number} originY Origin Y.
* @param {number} w Width.
* @param {number} h Height.
* @param {number} x X.
* @param {number} y Y.
* @param {import("../size.js").Size} scale Scale.
*/
export function drawImageOrLabel(context: CanvasRenderingContext2D, transform: import("../transform.js").Transform | null, opacity: number, labelOrImage: Label | HTMLCanvasElement | HTMLImageElement | HTMLVideoElement, originX: number, originY: number, w: number, h: number, x: number, y: number, scale: import("../size.js").Size): void;
/**
* @typedef {'Circle' | 'Image' | 'LineString' | 'Polygon' | 'Text' | 'Default'} BuilderType
*/
/**
* @typedef {Object} FillState
* @property {import("../colorlike.js").ColorLike} fillStyle FillStyle.
*/
/**
* @typedef Label
* @property {number} width Width.
* @property {number} height Height.
* @property {Array<string|number>} contextInstructions ContextInstructions.
*/
/**
* @typedef {Object} FillStrokeState
* @property {import("../colorlike.js").ColorLike} [currentFillStyle] Current FillStyle.
* @property {import("../colorlike.js").ColorLike} [currentStrokeStyle] Current StrokeStyle.
* @property {CanvasLineCap} [currentLineCap] Current LineCap.
* @property {Array<number>} currentLineDash Current LineDash.
* @property {number} [currentLineDashOffset] Current LineDashOffset.
* @property {CanvasLineJoin} [currentLineJoin] Current LineJoin.
* @property {number} [currentLineWidth] Current LineWidth.
* @property {number} [currentMiterLimit] Current MiterLimit.
* @property {number} [lastStroke] Last stroke.
* @property {import("../colorlike.js").ColorLike} [fillStyle] FillStyle.
* @property {import("../colorlike.js").ColorLike} [strokeStyle] StrokeStyle.
* @property {CanvasLineCap} [lineCap] LineCap.
* @property {Array<number>} lineDash LineDash.
* @property {number} [lineDashOffset] LineDashOffset.
* @property {CanvasLineJoin} [lineJoin] LineJoin.
* @property {number} [lineWidth] LineWidth.
* @property {number} [miterLimit] MiterLimit.
*/
/**
* @typedef {Object} StrokeState
* @property {CanvasLineCap} lineCap LineCap.
* @property {Array<number>} lineDash LineDash.
* @property {number} lineDashOffset LineDashOffset.
* @property {CanvasLineJoin} lineJoin LineJoin.
* @property {number} lineWidth LineWidth.
* @property {number} miterLimit MiterLimit.
* @property {import("../colorlike.js").ColorLike} strokeStyle StrokeStyle.
*/
/**
* @typedef {Object} TextState
* @property {string} font Font.
* @property {string} [textAlign] TextAlign.
* @property {string} [justify] Justify.
* @property {string} textBaseline TextBaseline.
* @property {string} [placement] Placement.
* @property {number} [maxAngle] MaxAngle.
* @property {boolean} [overflow] Overflow.
* @property {import("../style/Fill.js").default} [backgroundFill] BackgroundFill.
* @property {import("../style/Stroke.js").default} [backgroundStroke] BackgroundStroke.
* @property {import("../size.js").Size} [scale] Scale.
* @property {Array<number>} [padding] Padding.
*/
/**
* @typedef {Object} SerializableInstructions
* @property {Array<*>} instructions The rendering instructions.
* @property {Array<*>} hitDetectionInstructions The rendering hit detection instructions.
* @property {Array<number>} coordinates The array of all coordinates.
* @property {!Object<string, TextState>} [textStates] The text states (decluttering).
* @property {!Object<string, FillState>} [fillStates] The fill states (decluttering).
* @property {!Object<string, StrokeState>} [strokeStates] The stroke states (decluttering).
*/
/**
* @typedef {Object<number, import("./canvas/Executor.js").ReplayImageOrLabelArgs>} DeclutterImageWithText
*/
/**
* @const
* @type {string}
*/
export const defaultFont: string;
/**
* @const
* @type {import("../colorlike.js").ColorLike}
*/
export const defaultFillStyle: import("../colorlike.js").ColorLike;
/**
* @const
* @type {CanvasLineCap}
*/
export const defaultLineCap: CanvasLineCap;
/**
* @const
* @type {Array<number>}
*/
export const defaultLineDash: Array<number>;
/**
* @const
* @type {number}
*/
export const defaultLineDashOffset: number;
/**
* @const
* @type {CanvasLineJoin}
*/
export const defaultLineJoin: CanvasLineJoin;
/**
* @const
* @type {number}
*/
export const defaultMiterLimit: number;
/**
* @const
* @type {import("../colorlike.js").ColorLike}
*/
export const defaultStrokeStyle: import("../colorlike.js").ColorLike;
/**
* @const
* @type {string}
*/
export const defaultTextAlign: string;
/**
* @const
* @type {string}
*/
export const defaultTextBaseline: string;
/**
* @const
* @type {Array<number>}
*/
export const defaultPadding: Array<number>;
/**
* @const
* @type {number}
*/
export const defaultLineWidth: number;
/**
* @type {BaseObject}
*/
export const checkedFonts: BaseObject;
/**
* The label cache for text rendering. To change the default cache size of 2048
* entries, use {@link module:ol/structs/LRUCache~LRUCache#setSize cache.setSize()}.
* Deprecated - there is no label cache any more.
* @type {?}
* @api
* @deprecated
*/
export const labelCache: unknown;
/**
* @type {!Object<string, number>}
*/
export const textHeights: {
[x: string]: number;
};
export function registerFont(fontSpec: any): void;
export function measureTextHeight(fontSpec: any): number;
export type BuilderType = 'Circle' | 'Image' | 'LineString' | 'Polygon' | 'Text' | 'Default';
export type FillState = {
/**
* FillStyle.
*/
fillStyle: import("../colorlike.js").ColorLike;
};
export type Label = {
/**
* Width.
*/
width: number;
/**
* Height.
*/
height: number;
/**
* ContextInstructions.
*/
contextInstructions: Array<string | number>;
};
export type FillStrokeState = {
/**
* Current FillStyle.
*/
currentFillStyle?: import("../colorlike.js").ColorLike | undefined;
/**
* Current StrokeStyle.
*/
currentStrokeStyle?: import("../colorlike.js").ColorLike | undefined;
/**
* Current LineCap.
*/
currentLineCap?: CanvasLineCap | undefined;
/**
* Current LineDash.
*/
currentLineDash: Array<number>;
/**
* Current LineDashOffset.
*/
currentLineDashOffset?: number | undefined;
/**
* Current LineJoin.
*/
currentLineJoin?: CanvasLineJoin | undefined;
/**
* Current LineWidth.
*/
currentLineWidth?: number | undefined;
/**
* Current MiterLimit.
*/
currentMiterLimit?: number | undefined;
/**
* Last stroke.
*/
lastStroke?: number | undefined;
/**
* FillStyle.
*/
fillStyle?: import("../colorlike.js").ColorLike | undefined;
/**
* StrokeStyle.
*/
strokeStyle?: import("../colorlike.js").ColorLike | undefined;
/**
* LineCap.
*/
lineCap?: CanvasLineCap | undefined;
/**
* LineDash.
*/
lineDash: Array<number>;
/**
* LineDashOffset.
*/
lineDashOffset?: number | undefined;
/**
* LineJoin.
*/
lineJoin?: CanvasLineJoin | undefined;
/**
* LineWidth.
*/
lineWidth?: number | undefined;
/**
* MiterLimit.
*/
miterLimit?: number | undefined;
};
export type StrokeState = {
/**
* LineCap.
*/
lineCap: CanvasLineCap;
/**
* LineDash.
*/
lineDash: Array<number>;
/**
* LineDashOffset.
*/
lineDashOffset: number;
/**
* LineJoin.
*/
lineJoin: CanvasLineJoin;
/**
* LineWidth.
*/
lineWidth: number;
/**
* MiterLimit.
*/
miterLimit: number;
/**
* StrokeStyle.
*/
strokeStyle: import("../colorlike.js").ColorLike;
};
export type TextState = {
/**
* Font.
*/
font: string;
/**
* TextAlign.
*/
textAlign?: string | undefined;
/**
* Justify.
*/
justify?: string | undefined;
/**
* TextBaseline.
*/
textBaseline: string;
/**
* Placement.
*/
placement?: string | undefined;
/**
* MaxAngle.
*/
maxAngle?: number | undefined;
/**
* Overflow.
*/
overflow?: boolean | undefined;
/**
* BackgroundFill.
*/
backgroundFill?: import("../style/Fill.js").default | undefined;
/**
* BackgroundStroke.
*/
backgroundStroke?: import("../style/Stroke.js").default | undefined;
/**
* Scale.
*/
scale?: import("../size.js").Size | undefined;
/**
* Padding.
*/
padding?: number[] | undefined;
};
export type SerializableInstructions = {
/**
* The rendering instructions.
*/
instructions: Array<any>;
/**
* The rendering hit detection instructions.
*/
hitDetectionInstructions: Array<any>;
/**
* The array of all coordinates.
*/
coordinates: Array<number>;
/**
* The text states (decluttering).
*/
textStates?: {
[x: string]: TextState;
} | undefined;
/**
* The fill states (decluttering).
*/
fillStates?: {
[x: string]: FillState;
} | undefined;
/**
* The stroke states (decluttering).
*/
strokeStates?: {
[x: string]: StrokeState;
} | undefined;
};
export type DeclutterImageWithText = {
[x: number]: import("./canvas/Executor.js").ReplayImageOrLabelArgs;
};
import BaseObject from "../Object.js";
//# sourceMappingURL=canvas.d.ts.map

1
node_modules/ol/render/canvas.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../src/render/canvas.js"],"names":[],"mappings":"AA4VA;;;;GAIG;AACH,uCAJW,MAAM,QACN,MAAM,GACL,MAAM,CAIjB;AAED;;;;;;GAMG;AACH,+CALW,MAAM,QACN,MAAM;QACC,MAAM,GAAE,MAAM;IACpB,MAAM,CAWjB;AAED;;;;GAIG;AACH,6CAJW,SAAS,UACT,MAAM,MAAM,CAAC;WACJ,MAAM;YAAU,MAAM;YAAU,MAAM,MAAM,CAAC;aAAW,MAAM,MAAM,CAAC;gBAAc,MAAM,MAAM,CAAC;EA4BnH;AAED;;;;;GAKG;AACH,wCALW,wBAAwB,YACxB,MAAM,WACN,MAAM,WACN,MAAM,QAQhB;AAED;;;;;;;;;;;;GAYG;AACH,0CAZW,wBAAwB,aACxB,OAAO,iBAAiB,EAAE,SAAS,GAAC,IAAI,WACxC,MAAM,gBACN,KAAK,GAAC,iBAAiB,GAAC,gBAAgB,GAAC,gBAAgB,WACzD,MAAM,WACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,SACN,OAAO,YAAY,EAAE,IAAI,QAgEnC;AAveD;;GAEG;AAEH;;;GAGG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;GAQG;AAEH;;GAEG;AAEH;;;GAGG;AACH,0BAFU,MAAM,CAE6B;AAE7C;;;GAGG;AACH,+BAFU,OAAO,iBAAiB,EAAE,SAAS,CAEN;AAEvC;;;GAGG;AACH,6BAFU,aAAa,CAEe;AAEtC;;;GAGG;AACH,8BAFU,MAAM,MAAM,CAAC,CAEW;AAElC;;;GAGG;AACH,oCAFU,MAAM,CAEuB;AAEvC;;;GAGG;AACH,8BAFU,cAAc,CAEe;AAEvC;;;GAGG;AACH,gCAFU,MAAM,CAEoB;AAEpC;;;GAGG;AACH,iCAFU,OAAO,iBAAiB,EAAE,SAAS,CAEJ;AAEzC;;;GAGG;AACH,+BAFU,MAAM,CAEyB;AAEzC;;;GAGG;AACH,kCAFU,MAAM,CAE4B;AAE5C;;;GAGG;AACH,6BAFU,MAAM,MAAM,CAAC,CAEoB;AAE3C;;;GAGG;AACH,+BAFU,MAAM,CAEkB;AAElC;;GAEG;AACH,2BAFU,UAAU,CAEyB;AAE7C;;;;;;;GAOG;AACH,iCAA4C;AAe5C;;GAEG;AACH;QAFkB,MAAM,GAAE,MAAM;EAEF;AA2ErB,kDAmBN;AAYM,yDAiCN;0BA9TU,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS;;;;;eAKjE,OAAO,iBAAiB,EAAE,SAAS;;;;;;WAKnC,MAAM;;;;YACN,MAAM;;;;yBACN,MAAM,MAAM,GAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;qBAQpB,MAAM,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cASb,MAAM,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;aASb,aAAa;;;;cACb,MAAM,MAAM,CAAC;;;;oBACb,MAAM;;;;cACN,cAAc;;;;eACd,MAAM;;;;gBACN,MAAM;;;;iBACN,OAAO,iBAAiB,EAAE,SAAS;;;;;;UAKnC,MAAM;;;;;;;;;;;;kBAGN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAYN,UAAQ;;;;8BACR,UAAQ;;;;iBACR,MAAM,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;QAOP,MAAM,GAAE,OAAO,sBAAsB,EAAE,sBAAsB"}

439
node_modules/ol/render/canvas.js generated vendored Normal file
View File

@@ -0,0 +1,439 @@
/**
* @module ol/render/canvas
*/
import BaseObject from '../Object.js';
import EventTarget from '../events/Target.js';
import { WORKER_OFFSCREEN_CANVAS } from '../has.js';
import { clear } from '../obj.js';
import { createCanvasContext2D } from '../dom.js';
import { getFontParameters } from '../css.js';
/**
* @typedef {'Circle' | 'Image' | 'LineString' | 'Polygon' | 'Text' | 'Default'} BuilderType
*/
/**
* @typedef {Object} FillState
* @property {import("../colorlike.js").ColorLike} fillStyle FillStyle.
*/
/**
* @typedef Label
* @property {number} width Width.
* @property {number} height Height.
* @property {Array<string|number>} contextInstructions ContextInstructions.
*/
/**
* @typedef {Object} FillStrokeState
* @property {import("../colorlike.js").ColorLike} [currentFillStyle] Current FillStyle.
* @property {import("../colorlike.js").ColorLike} [currentStrokeStyle] Current StrokeStyle.
* @property {CanvasLineCap} [currentLineCap] Current LineCap.
* @property {Array<number>} currentLineDash Current LineDash.
* @property {number} [currentLineDashOffset] Current LineDashOffset.
* @property {CanvasLineJoin} [currentLineJoin] Current LineJoin.
* @property {number} [currentLineWidth] Current LineWidth.
* @property {number} [currentMiterLimit] Current MiterLimit.
* @property {number} [lastStroke] Last stroke.
* @property {import("../colorlike.js").ColorLike} [fillStyle] FillStyle.
* @property {import("../colorlike.js").ColorLike} [strokeStyle] StrokeStyle.
* @property {CanvasLineCap} [lineCap] LineCap.
* @property {Array<number>} lineDash LineDash.
* @property {number} [lineDashOffset] LineDashOffset.
* @property {CanvasLineJoin} [lineJoin] LineJoin.
* @property {number} [lineWidth] LineWidth.
* @property {number} [miterLimit] MiterLimit.
*/
/**
* @typedef {Object} StrokeState
* @property {CanvasLineCap} lineCap LineCap.
* @property {Array<number>} lineDash LineDash.
* @property {number} lineDashOffset LineDashOffset.
* @property {CanvasLineJoin} lineJoin LineJoin.
* @property {number} lineWidth LineWidth.
* @property {number} miterLimit MiterLimit.
* @property {import("../colorlike.js").ColorLike} strokeStyle StrokeStyle.
*/
/**
* @typedef {Object} TextState
* @property {string} font Font.
* @property {string} [textAlign] TextAlign.
* @property {string} [justify] Justify.
* @property {string} textBaseline TextBaseline.
* @property {string} [placement] Placement.
* @property {number} [maxAngle] MaxAngle.
* @property {boolean} [overflow] Overflow.
* @property {import("../style/Fill.js").default} [backgroundFill] BackgroundFill.
* @property {import("../style/Stroke.js").default} [backgroundStroke] BackgroundStroke.
* @property {import("../size.js").Size} [scale] Scale.
* @property {Array<number>} [padding] Padding.
*/
/**
* @typedef {Object} SerializableInstructions
* @property {Array<*>} instructions The rendering instructions.
* @property {Array<*>} hitDetectionInstructions The rendering hit detection instructions.
* @property {Array<number>} coordinates The array of all coordinates.
* @property {!Object<string, TextState>} [textStates] The text states (decluttering).
* @property {!Object<string, FillState>} [fillStates] The fill states (decluttering).
* @property {!Object<string, StrokeState>} [strokeStates] The stroke states (decluttering).
*/
/**
* @typedef {Object<number, import("./canvas/Executor.js").ReplayImageOrLabelArgs>} DeclutterImageWithText
*/
/**
* @const
* @type {string}
*/
export var defaultFont = '10px sans-serif';
/**
* @const
* @type {import("../colorlike.js").ColorLike}
*/
export var defaultFillStyle = '#000';
/**
* @const
* @type {CanvasLineCap}
*/
export var defaultLineCap = 'round';
/**
* @const
* @type {Array<number>}
*/
export var defaultLineDash = [];
/**
* @const
* @type {number}
*/
export var defaultLineDashOffset = 0;
/**
* @const
* @type {CanvasLineJoin}
*/
export var defaultLineJoin = 'round';
/**
* @const
* @type {number}
*/
export var defaultMiterLimit = 10;
/**
* @const
* @type {import("../colorlike.js").ColorLike}
*/
export var defaultStrokeStyle = '#000';
/**
* @const
* @type {string}
*/
export var defaultTextAlign = 'center';
/**
* @const
* @type {string}
*/
export var defaultTextBaseline = 'middle';
/**
* @const
* @type {Array<number>}
*/
export var defaultPadding = [0, 0, 0, 0];
/**
* @const
* @type {number}
*/
export var defaultLineWidth = 1;
/**
* @type {BaseObject}
*/
export var checkedFonts = new BaseObject();
/**
* The label cache for text rendering. To change the default cache size of 2048
* entries, use {@link module:ol/structs/LRUCache~LRUCache#setSize cache.setSize()}.
* Deprecated - there is no label cache any more.
* @type {?}
* @api
* @deprecated
*/
export var labelCache = new EventTarget();
labelCache.setSize = function () {
console.warn('labelCache is deprecated.'); //eslint-disable-line
};
/**
* @type {CanvasRenderingContext2D}
*/
var measureContext = null;
/**
* @type {string}
*/
var measureFont;
/**
* @type {!Object<string, number>}
*/
export var textHeights = {};
/**
* Clears the label cache when a font becomes available.
* @param {string} fontSpec CSS font spec.
*/
export var registerFont = (function () {
var retries = 100;
var size = '32px ';
var referenceFonts = ['monospace', 'serif'];
var len = referenceFonts.length;
var text = 'wmytzilWMYTZIL@#/&?$%10\uF013';
var interval, referenceWidth;
/**
* @param {string} fontStyle Css font-style
* @param {string} fontWeight Css font-weight
* @param {*} fontFamily Css font-family
* @return {boolean} Font with style and weight is available
*/
function isAvailable(fontStyle, fontWeight, fontFamily) {
var available = true;
for (var i = 0; i < len; ++i) {
var referenceFont = referenceFonts[i];
referenceWidth = measureTextWidth(fontStyle + ' ' + fontWeight + ' ' + size + referenceFont, text);
if (fontFamily != referenceFont) {
var width = measureTextWidth(fontStyle +
' ' +
fontWeight +
' ' +
size +
fontFamily +
',' +
referenceFont, text);
// If width and referenceWidth are the same, then the fallback was used
// instead of the font we wanted, so the font is not available.
available = available && width != referenceWidth;
}
}
if (available) {
return true;
}
return false;
}
function check() {
var done = true;
var fonts = checkedFonts.getKeys();
for (var i = 0, ii = fonts.length; i < ii; ++i) {
var font = fonts[i];
if (checkedFonts.get(font) < retries) {
if (isAvailable.apply(this, font.split('\n'))) {
clear(textHeights);
// Make sure that loaded fonts are picked up by Safari
measureContext = null;
measureFont = undefined;
checkedFonts.set(font, retries);
}
else {
checkedFonts.set(font, checkedFonts.get(font) + 1, true);
done = false;
}
}
}
if (done) {
clearInterval(interval);
interval = undefined;
}
}
return function (fontSpec) {
var font = getFontParameters(fontSpec);
if (!font) {
return;
}
var families = font.families;
for (var i = 0, ii = families.length; i < ii; ++i) {
var family = families[i];
var key = font.style + '\n' + font.weight + '\n' + family;
if (checkedFonts.get(key) === undefined) {
checkedFonts.set(key, retries, true);
if (!isAvailable(font.style, font.weight, family)) {
checkedFonts.set(key, 0, true);
if (interval === undefined) {
interval = setInterval(check, 32);
}
}
}
}
};
})();
/**
* @param {string} font Font to use for measuring.
* @return {import("../size.js").Size} Measurement.
*/
export var measureTextHeight = (function () {
/**
* @type {HTMLDivElement}
*/
var measureElement;
return function (fontSpec) {
var height = textHeights[fontSpec];
if (height == undefined) {
if (WORKER_OFFSCREEN_CANVAS) {
var font = getFontParameters(fontSpec);
var metrics = measureText(fontSpec, 'Žg');
var lineHeight = isNaN(Number(font.lineHeight))
? 1.2
: Number(font.lineHeight);
height =
lineHeight *
(metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent);
}
else {
if (!measureElement) {
measureElement = document.createElement('div');
measureElement.innerHTML = 'M';
measureElement.style.minHeight = '0';
measureElement.style.maxHeight = 'none';
measureElement.style.height = 'auto';
measureElement.style.padding = '0';
measureElement.style.border = 'none';
measureElement.style.position = 'absolute';
measureElement.style.display = 'block';
measureElement.style.left = '-99999px';
}
measureElement.style.font = fontSpec;
document.body.appendChild(measureElement);
height = measureElement.offsetHeight;
document.body.removeChild(measureElement);
}
textHeights[fontSpec] = height;
}
return height;
};
})();
/**
* @param {string} font Font.
* @param {string} text Text.
* @return {TextMetrics} Text metrics.
*/
function measureText(font, text) {
if (!measureContext) {
measureContext = createCanvasContext2D(1, 1);
}
if (font != measureFont) {
measureContext.font = font;
measureFont = measureContext.font;
}
return measureContext.measureText(text);
}
/**
* @param {string} font Font.
* @param {string} text Text.
* @return {number} Width.
*/
export function measureTextWidth(font, text) {
return measureText(font, text).width;
}
/**
* Measure text width using a cache.
* @param {string} font The font.
* @param {string} text The text to measure.
* @param {Object<string, number>} cache A lookup of cached widths by text.
* @return {number} The text width.
*/
export function measureAndCacheTextWidth(font, text, cache) {
if (text in cache) {
return cache[text];
}
var width = text
.split('\n')
.reduce(function (prev, curr) { return Math.max(prev, measureTextWidth(font, curr)); }, 0);
cache[text] = width;
return width;
}
/**
* @param {TextState} baseStyle Base style.
* @param {Array<string>} chunks Text chunks to measure.
* @return {{width: number, height: number, widths: Array<number>, heights: Array<number>, lineWidths: Array<number>}}} Text metrics.
*/
export function getTextDimensions(baseStyle, chunks) {
var widths = [];
var heights = [];
var lineWidths = [];
var width = 0;
var lineWidth = 0;
var height = 0;
var lineHeight = 0;
for (var i = 0, ii = chunks.length; i <= ii; i += 2) {
var text = chunks[i];
if (text === '\n' || i === ii) {
width = Math.max(width, lineWidth);
lineWidths.push(lineWidth);
lineWidth = 0;
height += lineHeight;
continue;
}
var font = chunks[i + 1] || baseStyle.font;
var currentWidth = measureTextWidth(font, text);
widths.push(currentWidth);
lineWidth += currentWidth;
var currentHeight = measureTextHeight(font);
heights.push(currentHeight);
lineHeight = Math.max(lineHeight, currentHeight);
}
return { width: width, height: height, widths: widths, heights: heights, lineWidths: lineWidths };
}
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {number} rotation Rotation.
* @param {number} offsetX X offset.
* @param {number} offsetY Y offset.
*/
export function rotateAtOffset(context, rotation, offsetX, offsetY) {
if (rotation !== 0) {
context.translate(offsetX, offsetY);
context.rotate(rotation);
context.translate(-offsetX, -offsetY);
}
}
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {import("../transform.js").Transform|null} transform Transform.
* @param {number} opacity Opacity.
* @param {Label|HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} labelOrImage Label.
* @param {number} originX Origin X.
* @param {number} originY Origin Y.
* @param {number} w Width.
* @param {number} h Height.
* @param {number} x X.
* @param {number} y Y.
* @param {import("../size.js").Size} scale Scale.
*/
export function drawImageOrLabel(context, transform, opacity, labelOrImage, originX, originY, w, h, x, y, scale) {
context.save();
if (opacity !== 1) {
context.globalAlpha *= opacity;
}
if (transform) {
context.setTransform.apply(context, transform);
}
if ( /** @type {*} */(labelOrImage).contextInstructions) {
// label
context.translate(x, y);
context.scale(scale[0], scale[1]);
executeLabelInstructions(/** @type {Label} */ (labelOrImage), context);
}
else if (scale[0] < 0 || scale[1] < 0) {
// flipped image
context.translate(x, y);
context.scale(scale[0], scale[1]);
context.drawImage(
/** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ (labelOrImage), originX, originY, w, h, 0, 0, w, h);
}
else {
// if image not flipped translate and scale can be avoided
context.drawImage(
/** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */ (labelOrImage), originX, originY, w, h, x, y, w * scale[0], h * scale[1]);
}
context.restore();
}
/**
* @param {Label} label Label.
* @param {CanvasRenderingContext2D} context Context.
*/
function executeLabelInstructions(label, context) {
var contextInstructions = label.contextInstructions;
for (var i = 0, ii = contextInstructions.length; i < ii; i += 2) {
if (Array.isArray(contextInstructions[i + 1])) {
context[contextInstructions[i]].apply(context, contextInstructions[i + 1]);
}
else {
context[contextInstructions[i]] = contextInstructions[i + 1];
}
}
}
//# sourceMappingURL=canvas.js.map

1
node_modules/ol/render/canvas.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

162
node_modules/ol/render/canvas/Builder.d.ts generated vendored Normal file
View File

@@ -0,0 +1,162 @@
export default CanvasBuilder;
declare class CanvasBuilder extends VectorContext {
/**
* @param {number} tolerance Tolerance.
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
*/
constructor(tolerance: number, maxExtent: import("../../extent.js").Extent, resolution: number, pixelRatio: number);
/**
* @protected
* @type {number}
*/
protected tolerance: number;
/**
* @protected
* @const
* @type {import("../../extent.js").Extent}
*/
protected maxExtent: import("../../extent.js").Extent;
/**
* @protected
* @type {number}
*/
protected pixelRatio: number;
/**
* @protected
* @type {number}
*/
protected maxLineWidth: number;
/**
* @protected
* @const
* @type {number}
*/
protected resolution: number;
/**
* @private
* @type {Array<*>}
*/
private beginGeometryInstruction1_;
/**
* @private
* @type {Array<*>}
*/
private beginGeometryInstruction2_;
/**
* @private
* @type {import("../../extent.js").Extent}
*/
private bufferedMaxExtent_;
/**
* @protected
* @type {Array<*>}
*/
protected instructions: Array<any>;
/**
* @protected
* @type {Array<number>}
*/
protected coordinates: Array<number>;
/**
* @private
* @type {import("../../coordinate.js").Coordinate}
*/
private tmpCoordinate_;
/**
* @protected
* @type {Array<*>}
*/
protected hitDetectionInstructions: Array<any>;
/**
* @protected
* @type {import("../canvas.js").FillStrokeState}
*/
protected state: import("../canvas.js").FillStrokeState;
/**
* @protected
* @param {Array<number>} dashArray Dash array.
* @return {Array<number>} Dash array with pixel ratio applied
*/
protected applyPixelRatio(dashArray: Array<number>): Array<number>;
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} stride Stride.
* @protected
* @return {number} My end
*/
protected appendFlatPointCoordinates(flatCoordinates: Array<number>, stride: number): number;
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
* @param {boolean} closed Last input coordinate equals first.
* @param {boolean} skipFirst Skip first coordinate.
* @protected
* @return {number} My end.
*/
protected appendFlatLineCoordinates(flatCoordinates: Array<number>, offset: number, end: number, stride: number, closed: boolean, skipFirst: boolean): number;
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {Array<number>} ends Ends.
* @param {number} stride Stride.
* @param {Array<number>} builderEnds Builder ends.
* @return {number} Offset.
*/
drawCustomCoordinates_(flatCoordinates: Array<number>, offset: number, ends: Array<number>, stride: number, builderEnds: Array<number>): number;
/**
* @protected
* @param {import("../../geom/Geometry").default|import("../Feature.js").default} geometry The geometry.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
*/
protected beginGeometry(geometry: import("../../geom/Geometry").default | import("../Feature.js").default, feature: import("../../Feature.js").FeatureLike): void;
/**
* @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
*/
finish(): import("../canvas.js").SerializableInstructions;
/**
* Reverse the hit detection instructions.
*/
reverseHitDetectionInstructions(): void;
/**
* @param {import("../canvas.js").FillStrokeState} state State.
* @return {Array<*>} Fill instruction.
*/
createFill(state: import("../canvas.js").FillStrokeState): Array<any>;
/**
* @param {import("../canvas.js").FillStrokeState} state State.
*/
applyStroke(state: import("../canvas.js").FillStrokeState): void;
/**
* @param {import("../canvas.js").FillStrokeState} state State.
* @return {Array<*>} Stroke instruction.
*/
createStroke(state: import("../canvas.js").FillStrokeState): Array<any>;
/**
* @param {import("../canvas.js").FillStrokeState} state State.
* @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState):Array<*>} createFill Create fill.
*/
updateFillStyle(state: import("../canvas.js").FillStrokeState, createFill: (this: CanvasBuilder, arg1: import("../canvas.js").FillStrokeState) => Array<any>): void;
/**
* @param {import("../canvas.js").FillStrokeState} state State.
* @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState): void} applyStroke Apply stroke.
*/
updateStrokeStyle(state: import("../canvas.js").FillStrokeState, applyStroke: (this: CanvasBuilder, arg1: import("../canvas.js").FillStrokeState) => void): void;
/**
* @param {import("../../Feature.js").FeatureLike} feature Feature.
*/
endGeometry(feature: import("../../Feature.js").FeatureLike): void;
/**
* Get the buffered rendering extent. Rendering will be clipped to the extent
* provided to the constructor. To account for symbolizers that may intersect
* this extent, we calculate a buffered extent (e.g. based on stroke width).
* @return {import("../../extent.js").Extent} The buffered rendering extent.
* @protected
*/
protected getBufferedMaxExtent(): import("../../extent.js").Extent;
}
import VectorContext from "../VectorContext.js";
//# sourceMappingURL=Builder.d.ts.map

1
node_modules/ol/render/canvas/Builder.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Builder.d.ts","sourceRoot":"","sources":["../../src/render/canvas/Builder.js"],"names":[],"mappings":";AA8BA;IACE;;;;;OAKG;IACH,uBALW,MAAM,aACN,OAAO,iBAAiB,EAAE,MAAM,cAChC,MAAM,cACN,MAAM,EAoFhB;IA/EC;;;OAGG;IACH,qBAFU,MAAM,CAEU;IAE1B;;;;OAIG;IACH,qBAFU,OAAO,iBAAiB,EAAE,MAAM,CAEhB;IAE1B;;;OAGG;IACH,sBAFU,MAAM,CAEY;IAE5B;;;OAGG;IACH,wBAFU,MAAM,CAEK;IAErB;;;;OAIG;IACH,sBAFU,MAAM,CAEY;IAE5B;;;OAGG;IACH,mCAAsC;IAEtC;;;OAGG;IACH,mCAAsC;IAEtC;;;OAGG;IACH,2BAA8B;IAE9B;;;OAGG;IACH,wBAFU,UAAQ,CAEI;IAEtB;;;OAGG;IACH,uBAFU,MAAM,MAAM,CAAC,CAEF;IAErB;;;OAGG;IACH,uBAAwB;IAExB;;;OAGG;IACH,oCAFU,UAAQ,CAEgB;IAElC;;;OAGG;IACH,iBAFU,OAAO,cAAc,EAAE,eAAe,CAEuB;IAGzE;;;;OAIG;IACH,qCAHW,MAAM,MAAM,CAAC,GACZ,MAAM,MAAM,CAAC,CASxB;IAED;;;;;OAKG;IACH,sDALW,MAAM,MAAM,CAAC,UACb,MAAM,GAEL,MAAM,CAgBjB;IAED;;;;;;;;;OASG;IACH,qDATW,MAAM,MAAM,CAAC,UACb,MAAM,OACN,MAAM,UACN,MAAM,UACN,OAAO,aACP,OAAO,GAEN,MAAM,CAoDjB;IAED;;;;;;;OAOG;IACH,wCAPW,MAAM,MAAM,CAAC,UACb,MAAM,QACN,MAAM,MAAM,CAAC,UACb,MAAM,eACN,MAAM,MAAM,CAAC,GACZ,MAAM,CAiBjB;IAyKD;;;;OAIG;IACH,kCAHW,OAAO,qBAAqB,EAAE,OAAO,GAAC,OAAO,eAAe,EAAE,OAAO,WACrE,OAAO,kBAAkB,EAAE,WAAW,QAiBhD;IAED;;OAEG;IACH,UAFY,OAAO,cAAc,EAAE,wBAAwB,CAQ1D;IAED;;OAEG;IACH,wCAqBC;IA8DD;;;OAGG;IACH,kBAHW,OAAO,cAAc,EAAE,eAAe,GACrC,UAAQ,CAWnB;IAED;;OAEG;IACH,mBAFW,OAAO,cAAc,EAAE,eAAe,QAIhD;IAED;;;OAGG;IACH,oBAHW,OAAO,cAAc,EAAE,eAAe,GACrC,UAAQ,CAanB;IAED;;;OAGG;IACH,uBAHW,OAAO,cAAc,EAAE,eAAe,qBACxB,aAAa,QAAE,OAAO,cAAc,EAAE,eAAe,KAAE,UAAQ,QAUvF;IAED;;;OAGG;IACH,yBAHW,OAAO,cAAc,EAAE,eAAe,sBACxB,aAAa,QAAE,OAAO,cAAc,EAAE,eAAe,KAAG,IAAI,QA+BpF;IAED;;OAEG;IACH,qBAFW,OAAO,kBAAkB,EAAE,WAAW,QAUhD;IAED;;;;;;OAMG;IACH,kCAHY,OAAO,iBAAiB,EAAE,MAAM,CAY3C;CACF"}

572
node_modules/ol/render/canvas/Builder.js generated vendored Normal file
View File

@@ -0,0 +1,572 @@
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/render/canvas/Builder
*/
import CanvasInstruction from './Instruction.js';
import Relationship from '../../extent/Relationship.js';
import VectorContext from '../VectorContext.js';
import { asColorLike } from '../../colorlike.js';
import { buffer, clone, containsCoordinate, coordinateRelationship, } from '../../extent.js';
import { defaultFillStyle, defaultLineCap, defaultLineDash, defaultLineDashOffset, defaultLineJoin, defaultLineWidth, defaultMiterLimit, defaultStrokeStyle, } from '../canvas.js';
import { equals, reverseSubArray } from '../../array.js';
import { inflateCoordinates, inflateCoordinatesArray, inflateMultiCoordinatesArray, } from '../../geom/flat/inflate.js';
var CanvasBuilder = /** @class */ (function (_super) {
__extends(CanvasBuilder, _super);
/**
* @param {number} tolerance Tolerance.
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
*/
function CanvasBuilder(tolerance, maxExtent, resolution, pixelRatio) {
var _this = _super.call(this) || this;
/**
* @protected
* @type {number}
*/
_this.tolerance = tolerance;
/**
* @protected
* @const
* @type {import("../../extent.js").Extent}
*/
_this.maxExtent = maxExtent;
/**
* @protected
* @type {number}
*/
_this.pixelRatio = pixelRatio;
/**
* @protected
* @type {number}
*/
_this.maxLineWidth = 0;
/**
* @protected
* @const
* @type {number}
*/
_this.resolution = resolution;
/**
* @private
* @type {Array<*>}
*/
_this.beginGeometryInstruction1_ = null;
/**
* @private
* @type {Array<*>}
*/
_this.beginGeometryInstruction2_ = null;
/**
* @private
* @type {import("../../extent.js").Extent}
*/
_this.bufferedMaxExtent_ = null;
/**
* @protected
* @type {Array<*>}
*/
_this.instructions = [];
/**
* @protected
* @type {Array<number>}
*/
_this.coordinates = [];
/**
* @private
* @type {import("../../coordinate.js").Coordinate}
*/
_this.tmpCoordinate_ = [];
/**
* @protected
* @type {Array<*>}
*/
_this.hitDetectionInstructions = [];
/**
* @protected
* @type {import("../canvas.js").FillStrokeState}
*/
_this.state = /** @type {import("../canvas.js").FillStrokeState} */ ({});
return _this;
}
/**
* @protected
* @param {Array<number>} dashArray Dash array.
* @return {Array<number>} Dash array with pixel ratio applied
*/
CanvasBuilder.prototype.applyPixelRatio = function (dashArray) {
var pixelRatio = this.pixelRatio;
return pixelRatio == 1
? dashArray
: dashArray.map(function (dash) {
return dash * pixelRatio;
});
};
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} stride Stride.
* @protected
* @return {number} My end
*/
CanvasBuilder.prototype.appendFlatPointCoordinates = function (flatCoordinates, stride) {
var extent = this.getBufferedMaxExtent();
var tmpCoord = this.tmpCoordinate_;
var coordinates = this.coordinates;
var myEnd = coordinates.length;
for (var i = 0, ii = flatCoordinates.length; i < ii; i += stride) {
tmpCoord[0] = flatCoordinates[i];
tmpCoord[1] = flatCoordinates[i + 1];
if (containsCoordinate(extent, tmpCoord)) {
coordinates[myEnd++] = tmpCoord[0];
coordinates[myEnd++] = tmpCoord[1];
}
}
return myEnd;
};
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
* @param {boolean} closed Last input coordinate equals first.
* @param {boolean} skipFirst Skip first coordinate.
* @protected
* @return {number} My end.
*/
CanvasBuilder.prototype.appendFlatLineCoordinates = function (flatCoordinates, offset, end, stride, closed, skipFirst) {
var coordinates = this.coordinates;
var myEnd = coordinates.length;
var extent = this.getBufferedMaxExtent();
if (skipFirst) {
offset += stride;
}
var lastXCoord = flatCoordinates[offset];
var lastYCoord = flatCoordinates[offset + 1];
var nextCoord = this.tmpCoordinate_;
var skipped = true;
var i, lastRel, nextRel;
for (i = offset + stride; i < end; i += stride) {
nextCoord[0] = flatCoordinates[i];
nextCoord[1] = flatCoordinates[i + 1];
nextRel = coordinateRelationship(extent, nextCoord);
if (nextRel !== lastRel) {
if (skipped) {
coordinates[myEnd++] = lastXCoord;
coordinates[myEnd++] = lastYCoord;
skipped = false;
}
coordinates[myEnd++] = nextCoord[0];
coordinates[myEnd++] = nextCoord[1];
}
else if (nextRel === Relationship.INTERSECTING) {
coordinates[myEnd++] = nextCoord[0];
coordinates[myEnd++] = nextCoord[1];
skipped = false;
}
else {
skipped = true;
}
lastXCoord = nextCoord[0];
lastYCoord = nextCoord[1];
lastRel = nextRel;
}
// Last coordinate equals first or only one point to append:
if ((closed && skipped) || i === offset + stride) {
coordinates[myEnd++] = lastXCoord;
coordinates[myEnd++] = lastYCoord;
}
return myEnd;
};
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {Array<number>} ends Ends.
* @param {number} stride Stride.
* @param {Array<number>} builderEnds Builder ends.
* @return {number} Offset.
*/
CanvasBuilder.prototype.drawCustomCoordinates_ = function (flatCoordinates, offset, ends, stride, builderEnds) {
for (var i = 0, ii = ends.length; i < ii; ++i) {
var end = ends[i];
var builderEnd = this.appendFlatLineCoordinates(flatCoordinates, offset, end, stride, false, false);
builderEnds.push(builderEnd);
offset = end;
}
return offset;
};
/**
* @param {import("../../geom/SimpleGeometry.js").default} geometry Geometry.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
* @param {Function} renderer Renderer.
* @param {Function} hitDetectionRenderer Renderer.
*/
CanvasBuilder.prototype.drawCustom = function (geometry, feature, renderer, hitDetectionRenderer) {
this.beginGeometry(geometry, feature);
var type = geometry.getType();
var stride = geometry.getStride();
var builderBegin = this.coordinates.length;
var flatCoordinates, builderEnd, builderEnds, builderEndss;
var offset;
switch (type) {
case 'MultiPolygon':
flatCoordinates =
/** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getOrientedFlatCoordinates();
builderEndss = [];
var endss =
/** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getEndss();
offset = 0;
for (var i = 0, ii = endss.length; i < ii; ++i) {
var myEnds = [];
offset = this.drawCustomCoordinates_(flatCoordinates, offset, endss[i], stride, myEnds);
builderEndss.push(myEnds);
}
this.instructions.push([
CanvasInstruction.CUSTOM,
builderBegin,
builderEndss,
geometry,
renderer,
inflateMultiCoordinatesArray,
]);
this.hitDetectionInstructions.push([
CanvasInstruction.CUSTOM,
builderBegin,
builderEndss,
geometry,
hitDetectionRenderer || renderer,
inflateMultiCoordinatesArray,
]);
break;
case 'Polygon':
case 'MultiLineString':
builderEnds = [];
flatCoordinates =
type == 'Polygon'
? /** @type {import("../../geom/Polygon.js").default} */ (geometry).getOrientedFlatCoordinates()
: geometry.getFlatCoordinates();
offset = this.drawCustomCoordinates_(flatCoordinates, 0,
/** @type {import("../../geom/Polygon.js").default|import("../../geom/MultiLineString.js").default} */ (geometry).getEnds(), stride, builderEnds);
this.instructions.push([
CanvasInstruction.CUSTOM,
builderBegin,
builderEnds,
geometry,
renderer,
inflateCoordinatesArray,
]);
this.hitDetectionInstructions.push([
CanvasInstruction.CUSTOM,
builderBegin,
builderEnds,
geometry,
hitDetectionRenderer || renderer,
inflateCoordinatesArray,
]);
break;
case 'LineString':
case 'Circle':
flatCoordinates = geometry.getFlatCoordinates();
builderEnd = this.appendFlatLineCoordinates(flatCoordinates, 0, flatCoordinates.length, stride, false, false);
this.instructions.push([
CanvasInstruction.CUSTOM,
builderBegin,
builderEnd,
geometry,
renderer,
inflateCoordinates,
]);
this.hitDetectionInstructions.push([
CanvasInstruction.CUSTOM,
builderBegin,
builderEnd,
geometry,
hitDetectionRenderer || renderer,
inflateCoordinates,
]);
break;
case 'MultiPoint':
flatCoordinates = geometry.getFlatCoordinates();
builderEnd = this.appendFlatPointCoordinates(flatCoordinates, stride);
if (builderEnd > builderBegin) {
this.instructions.push([
CanvasInstruction.CUSTOM,
builderBegin,
builderEnd,
geometry,
renderer,
inflateCoordinates,
]);
this.hitDetectionInstructions.push([
CanvasInstruction.CUSTOM,
builderBegin,
builderEnd,
geometry,
hitDetectionRenderer || renderer,
inflateCoordinates,
]);
}
break;
case 'Point':
flatCoordinates = geometry.getFlatCoordinates();
this.coordinates.push(flatCoordinates[0], flatCoordinates[1]);
builderEnd = this.coordinates.length;
this.instructions.push([
CanvasInstruction.CUSTOM,
builderBegin,
builderEnd,
geometry,
renderer,
]);
this.hitDetectionInstructions.push([
CanvasInstruction.CUSTOM,
builderBegin,
builderEnd,
geometry,
hitDetectionRenderer || renderer,
]);
break;
default:
}
this.endGeometry(feature);
};
/**
* @protected
* @param {import("../../geom/Geometry").default|import("../Feature.js").default} geometry The geometry.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
*/
CanvasBuilder.prototype.beginGeometry = function (geometry, feature) {
this.beginGeometryInstruction1_ = [
CanvasInstruction.BEGIN_GEOMETRY,
feature,
0,
geometry,
];
this.instructions.push(this.beginGeometryInstruction1_);
this.beginGeometryInstruction2_ = [
CanvasInstruction.BEGIN_GEOMETRY,
feature,
0,
geometry,
];
this.hitDetectionInstructions.push(this.beginGeometryInstruction2_);
};
/**
* @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
*/
CanvasBuilder.prototype.finish = function () {
return {
instructions: this.instructions,
hitDetectionInstructions: this.hitDetectionInstructions,
coordinates: this.coordinates,
};
};
/**
* Reverse the hit detection instructions.
*/
CanvasBuilder.prototype.reverseHitDetectionInstructions = function () {
var hitDetectionInstructions = this.hitDetectionInstructions;
// step 1 - reverse array
hitDetectionInstructions.reverse();
// step 2 - reverse instructions within geometry blocks
var i;
var n = hitDetectionInstructions.length;
var instruction;
var type;
var begin = -1;
for (i = 0; i < n; ++i) {
instruction = hitDetectionInstructions[i];
type = /** @type {import("./Instruction.js").default} */ (instruction[0]);
if (type == CanvasInstruction.END_GEOMETRY) {
begin = i;
}
else if (type == CanvasInstruction.BEGIN_GEOMETRY) {
instruction[2] = i;
reverseSubArray(this.hitDetectionInstructions, begin, i);
begin = -1;
}
}
};
/**
* @param {import("../../style/Fill.js").default} fillStyle Fill style.
* @param {import("../../style/Stroke.js").default} strokeStyle Stroke style.
*/
CanvasBuilder.prototype.setFillStrokeStyle = function (fillStyle, strokeStyle) {
var state = this.state;
if (fillStyle) {
var fillStyleColor = fillStyle.getColor();
state.fillStyle = asColorLike(fillStyleColor ? fillStyleColor : defaultFillStyle);
}
else {
state.fillStyle = undefined;
}
if (strokeStyle) {
var strokeStyleColor = strokeStyle.getColor();
state.strokeStyle = asColorLike(strokeStyleColor ? strokeStyleColor : defaultStrokeStyle);
var strokeStyleLineCap = strokeStyle.getLineCap();
state.lineCap =
strokeStyleLineCap !== undefined ? strokeStyleLineCap : defaultLineCap;
var strokeStyleLineDash = strokeStyle.getLineDash();
state.lineDash = strokeStyleLineDash
? strokeStyleLineDash.slice()
: defaultLineDash;
var strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();
state.lineDashOffset = strokeStyleLineDashOffset
? strokeStyleLineDashOffset
: defaultLineDashOffset;
var strokeStyleLineJoin = strokeStyle.getLineJoin();
state.lineJoin =
strokeStyleLineJoin !== undefined
? strokeStyleLineJoin
: defaultLineJoin;
var strokeStyleWidth = strokeStyle.getWidth();
state.lineWidth =
strokeStyleWidth !== undefined ? strokeStyleWidth : defaultLineWidth;
var strokeStyleMiterLimit = strokeStyle.getMiterLimit();
state.miterLimit =
strokeStyleMiterLimit !== undefined
? strokeStyleMiterLimit
: defaultMiterLimit;
if (state.lineWidth > this.maxLineWidth) {
this.maxLineWidth = state.lineWidth;
// invalidate the buffered max extent cache
this.bufferedMaxExtent_ = null;
}
}
else {
state.strokeStyle = undefined;
state.lineCap = undefined;
state.lineDash = null;
state.lineDashOffset = undefined;
state.lineJoin = undefined;
state.lineWidth = undefined;
state.miterLimit = undefined;
}
};
/**
* @param {import("../canvas.js").FillStrokeState} state State.
* @return {Array<*>} Fill instruction.
*/
CanvasBuilder.prototype.createFill = function (state) {
var fillStyle = state.fillStyle;
/** @type {Array<*>} */
var fillInstruction = [CanvasInstruction.SET_FILL_STYLE, fillStyle];
if (typeof fillStyle !== 'string') {
// Fill is a pattern or gradient - align it!
fillInstruction.push(true);
}
return fillInstruction;
};
/**
* @param {import("../canvas.js").FillStrokeState} state State.
*/
CanvasBuilder.prototype.applyStroke = function (state) {
this.instructions.push(this.createStroke(state));
};
/**
* @param {import("../canvas.js").FillStrokeState} state State.
* @return {Array<*>} Stroke instruction.
*/
CanvasBuilder.prototype.createStroke = function (state) {
return [
CanvasInstruction.SET_STROKE_STYLE,
state.strokeStyle,
state.lineWidth * this.pixelRatio,
state.lineCap,
state.lineJoin,
state.miterLimit,
this.applyPixelRatio(state.lineDash),
state.lineDashOffset * this.pixelRatio,
];
};
/**
* @param {import("../canvas.js").FillStrokeState} state State.
* @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState):Array<*>} createFill Create fill.
*/
CanvasBuilder.prototype.updateFillStyle = function (state, createFill) {
var fillStyle = state.fillStyle;
if (typeof fillStyle !== 'string' || state.currentFillStyle != fillStyle) {
if (fillStyle !== undefined) {
this.instructions.push(createFill.call(this, state));
}
state.currentFillStyle = fillStyle;
}
};
/**
* @param {import("../canvas.js").FillStrokeState} state State.
* @param {function(this:CanvasBuilder, import("../canvas.js").FillStrokeState): void} applyStroke Apply stroke.
*/
CanvasBuilder.prototype.updateStrokeStyle = function (state, applyStroke) {
var strokeStyle = state.strokeStyle;
var lineCap = state.lineCap;
var lineDash = state.lineDash;
var lineDashOffset = state.lineDashOffset;
var lineJoin = state.lineJoin;
var lineWidth = state.lineWidth;
var miterLimit = state.miterLimit;
if (state.currentStrokeStyle != strokeStyle ||
state.currentLineCap != lineCap ||
(lineDash != state.currentLineDash &&
!equals(state.currentLineDash, lineDash)) ||
state.currentLineDashOffset != lineDashOffset ||
state.currentLineJoin != lineJoin ||
state.currentLineWidth != lineWidth ||
state.currentMiterLimit != miterLimit) {
if (strokeStyle !== undefined) {
applyStroke.call(this, state);
}
state.currentStrokeStyle = strokeStyle;
state.currentLineCap = lineCap;
state.currentLineDash = lineDash;
state.currentLineDashOffset = lineDashOffset;
state.currentLineJoin = lineJoin;
state.currentLineWidth = lineWidth;
state.currentMiterLimit = miterLimit;
}
};
/**
* @param {import("../../Feature.js").FeatureLike} feature Feature.
*/
CanvasBuilder.prototype.endGeometry = function (feature) {
this.beginGeometryInstruction1_[2] = this.instructions.length;
this.beginGeometryInstruction1_ = null;
this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length;
this.beginGeometryInstruction2_ = null;
var endGeometryInstruction = [CanvasInstruction.END_GEOMETRY, feature];
this.instructions.push(endGeometryInstruction);
this.hitDetectionInstructions.push(endGeometryInstruction);
};
/**
* Get the buffered rendering extent. Rendering will be clipped to the extent
* provided to the constructor. To account for symbolizers that may intersect
* this extent, we calculate a buffered extent (e.g. based on stroke width).
* @return {import("../../extent.js").Extent} The buffered rendering extent.
* @protected
*/
CanvasBuilder.prototype.getBufferedMaxExtent = function () {
if (!this.bufferedMaxExtent_) {
this.bufferedMaxExtent_ = clone(this.maxExtent);
if (this.maxLineWidth > 0) {
var width = (this.resolution * (this.maxLineWidth + 1)) / 2;
buffer(this.bufferedMaxExtent_, width, this.bufferedMaxExtent_);
}
}
return this.bufferedMaxExtent_;
};
return CanvasBuilder;
}(VectorContext));
export default CanvasBuilder;
//# sourceMappingURL=Builder.js.map

1
node_modules/ol/render/canvas/Builder.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

48
node_modules/ol/render/canvas/BuilderGroup.d.ts generated vendored Normal file
View File

@@ -0,0 +1,48 @@
export default BuilderGroup;
declare class BuilderGroup {
/**
* @param {number} tolerance Tolerance.
* @param {import("../../extent.js").Extent} maxExtent Max extent.
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
*/
constructor(tolerance: number, maxExtent: import("../../extent.js").Extent, resolution: number, pixelRatio: number);
/**
* @private
* @type {number}
*/
private tolerance_;
/**
* @private
* @type {import("../../extent.js").Extent}
*/
private maxExtent_;
/**
* @private
* @type {number}
*/
private pixelRatio_;
/**
* @private
* @type {number}
*/
private resolution_;
/**
* @private
* @type {!Object<string, !Object<import("../canvas.js").BuilderType, Builder>>}
*/
private buildersByZIndex_;
/**
* @return {!Object<string, !Object<import("../canvas.js").BuilderType, import("./Builder.js").SerializableInstructions>>} The serializable instructions
*/
finish(): {
[x: string]: any;
};
/**
* @param {number|undefined} zIndex Z index.
* @param {import("../canvas.js").BuilderType} builderType Replay type.
* @return {import("../VectorContext.js").default} Replay.
*/
getBuilder(zIndex: number | undefined, builderType: import("../canvas.js").BuilderType): import("../VectorContext.js").default;
}
//# sourceMappingURL=BuilderGroup.d.ts.map

1
node_modules/ol/render/canvas/BuilderGroup.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"BuilderGroup.d.ts","sourceRoot":"","sources":["../../src/render/canvas/BuilderGroup.js"],"names":[],"mappings":";AAsBA;IACE;;;;;OAKG;IACH,uBALW,MAAM,aACN,OAAO,iBAAiB,EAAE,MAAM,cAChC,MAAM,cACN,MAAM,EAgChB;IA7BC;;;OAGG;IACH,mBAA2B;IAE3B;;;OAGG;IACH,mBAA2B;IAE3B;;;OAGG;IACH,oBAA6B;IAE7B;;;OAGG;IACH,oBAA6B;IAE7B;;;OAGG;IACH,0BAA2B;IAG7B;;OAEG;IACH;YAFoB,MAAM;MAazB;IAED;;;;OAIG;IACH,mBAJW,MAAM,GAAC,SAAS,eAChB,OAAO,cAAc,EAAE,WAAW,GACjC,OAAO,qBAAqB,EAAE,OAAO,CAqBhD;CACF"}

92
node_modules/ol/render/canvas/BuilderGroup.js generated vendored Normal file
View File

@@ -0,0 +1,92 @@
/**
* @module ol/render/canvas/BuilderGroup
*/
import Builder from './Builder.js';
import ImageBuilder from './ImageBuilder.js';
import LineStringBuilder from './LineStringBuilder.js';
import PolygonBuilder from './PolygonBuilder.js';
import TextBuilder from './TextBuilder.js';
/**
* @type {Object<import("../canvas.js").BuilderType, typeof Builder>}
*/
var BATCH_CONSTRUCTORS = {
'Circle': PolygonBuilder,
'Default': Builder,
'Image': ImageBuilder,
'LineString': LineStringBuilder,
'Polygon': PolygonBuilder,
'Text': TextBuilder,
};
var BuilderGroup = /** @class */ (function () {
/**
* @param {number} tolerance Tolerance.
* @param {import("../../extent.js").Extent} maxExtent Max extent.
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
*/
function BuilderGroup(tolerance, maxExtent, resolution, pixelRatio) {
/**
* @private
* @type {number}
*/
this.tolerance_ = tolerance;
/**
* @private
* @type {import("../../extent.js").Extent}
*/
this.maxExtent_ = maxExtent;
/**
* @private
* @type {number}
*/
this.pixelRatio_ = pixelRatio;
/**
* @private
* @type {number}
*/
this.resolution_ = resolution;
/**
* @private
* @type {!Object<string, !Object<import("../canvas.js").BuilderType, Builder>>}
*/
this.buildersByZIndex_ = {};
}
/**
* @return {!Object<string, !Object<import("../canvas.js").BuilderType, import("./Builder.js").SerializableInstructions>>} The serializable instructions
*/
BuilderGroup.prototype.finish = function () {
var builderInstructions = {};
for (var zKey in this.buildersByZIndex_) {
builderInstructions[zKey] = builderInstructions[zKey] || {};
var builders = this.buildersByZIndex_[zKey];
for (var builderKey in builders) {
var builderInstruction = builders[builderKey].finish();
builderInstructions[zKey][builderKey] = builderInstruction;
}
}
return builderInstructions;
};
/**
* @param {number|undefined} zIndex Z index.
* @param {import("../canvas.js").BuilderType} builderType Replay type.
* @return {import("../VectorContext.js").default} Replay.
*/
BuilderGroup.prototype.getBuilder = function (zIndex, builderType) {
var zIndexKey = zIndex !== undefined ? zIndex.toString() : '0';
var replays = this.buildersByZIndex_[zIndexKey];
if (replays === undefined) {
replays = {};
this.buildersByZIndex_[zIndexKey] = replays;
}
var replay = replays[builderType];
if (replay === undefined) {
var Constructor = BATCH_CONSTRUCTORS[builderType];
replay = new Constructor(this.tolerance_, this.maxExtent_, this.resolution_, this.pixelRatio_);
replays[builderType] = replay;
}
return replay;
};
return BuilderGroup;
}());
export default BuilderGroup;
//# sourceMappingURL=BuilderGroup.js.map

1
node_modules/ol/render/canvas/BuilderGroup.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"BuilderGroup.js","sourceRoot":"","sources":["../../src/render/canvas/BuilderGroup.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAE3C;;GAEG;AACH,IAAM,kBAAkB,GAAG;IACzB,QAAQ,EAAE,cAAc;IACxB,SAAS,EAAE,OAAO;IAClB,OAAO,EAAE,YAAY;IACrB,YAAY,EAAE,iBAAiB;IAC/B,SAAS,EAAE,cAAc;IACzB,MAAM,EAAE,WAAW;CACpB,CAAC;AAEF;IACE;;;;;OAKG;IACH,sBAAY,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU;QACtD;;;WAGG;QACH,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAE5B;;;WAGG;QACH,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAE5B;;;WAGG;QACH,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAE9B;;;WAGG;QACH,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAE9B;;;WAGG;QACH,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,6BAAM,GAAN;QACE,IAAM,mBAAmB,GAAG,EAAE,CAAC;QAC/B,KAAK,IAAM,IAAI,IAAI,IAAI,CAAC,iBAAiB,EAAE;YACzC,mBAAmB,CAAC,IAAI,CAAC,GAAG,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5D,IAAM,QAAQ,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;YAC9C,KAAK,IAAM,UAAU,IAAI,QAAQ,EAAE;gBACjC,IAAM,kBAAkB,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,CAAC;gBACzD,mBAAmB,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAC;aAC5D;SACF;QACD,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,iCAAU,GAAV,UAAW,MAAM,EAAE,WAAW;QAC5B,IAAM,SAAS,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QACjE,IAAI,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAChD,IAAI,OAAO,KAAK,SAAS,EAAE;YACzB,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;SAC7C;QACD,IAAI,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;QAClC,IAAI,MAAM,KAAK,SAAS,EAAE;YACxB,IAAM,WAAW,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;YACpD,MAAM,GAAG,IAAI,WAAW,CACtB,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,WAAW,CACjB,CAAC;YACF,OAAO,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC;SAC/B;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACH,mBAAC;AAAD,CAAC,AAhFD,IAgFC;AAED,eAAe,YAAY,CAAC"}

271
node_modules/ol/render/canvas/Executor.d.ts generated vendored Normal file
View File

@@ -0,0 +1,271 @@
export default Executor;
export type BBox = {
/**
* Minimal x.
*/
minX: number;
/**
* Minimal y.
*/
minY: number;
/**
* Maximal x.
*/
maxX: number;
/**
* Maximal y
*/
maxY: number;
/**
* Value.
*/
value: any;
};
export type ImageOrLabelDimensions = {
/**
* DrawImageX.
*/
drawImageX: number;
/**
* DrawImageY.
*/
drawImageY: number;
/**
* DrawImageW.
*/
drawImageW: number;
/**
* DrawImageH.
*/
drawImageH: number;
/**
* OriginX.
*/
originX: number;
/**
* OriginY.
*/
originY: number;
/**
* Scale.
*/
scale: Array<number>;
/**
* DeclutterBox.
*/
declutterBox: BBox;
/**
* CanvasTransform.
*/
canvasTransform: import("../../transform.js").Transform;
};
export type ReplayImageOrLabelArgs = {
0: CanvasRenderingContext2D;
1: number;
2: import("../canvas.js").Label | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
3: ImageOrLabelDimensions;
4: number;
5: Array<any>;
6: Array<any>;
};
export type FeatureCallback<T> = (arg0: import("../../Feature.js").FeatureLike, arg1: import("../../geom/SimpleGeometry.js").default) => T;
declare class Executor {
/**
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
* @param {boolean} overlaps The replay can have overlapping geometries.
* @param {import("../canvas.js").SerializableInstructions} instructions The serializable instructions
*/
constructor(resolution: number, pixelRatio: number, overlaps: boolean, instructions: import("../canvas.js").SerializableInstructions);
/**
* @protected
* @type {boolean}
*/
protected overlaps: boolean;
/**
* @protected
* @type {number}
*/
protected pixelRatio: number;
/**
* @protected
* @const
* @type {number}
*/
protected resolution: number;
/**
* @private
* @type {boolean}
*/
private alignFill_;
/**
* @protected
* @type {Array<*>}
*/
protected instructions: Array<any>;
/**
* @protected
* @type {Array<number>}
*/
protected coordinates: Array<number>;
/**
* @private
* @type {!Object<number,import("../../coordinate.js").Coordinate|Array<import("../../coordinate.js").Coordinate>|Array<Array<import("../../coordinate.js").Coordinate>>>}
*/
private coordinateCache_;
/**
* @private
* @type {!import("../../transform.js").Transform}
*/
private renderedTransform_;
/**
* @protected
* @type {Array<*>}
*/
protected hitDetectionInstructions: Array<any>;
/**
* @private
* @type {Array<number>}
*/
private pixelCoordinates_;
/**
* @private
* @type {number}
*/
private viewRotation_;
/**
* @type {!Object<string, import("../canvas.js").FillState>}
*/
fillStates: {
[x: string]: import("../canvas.js").FillState;
};
/**
* @type {!Object<string, import("../canvas.js").StrokeState>}
*/
strokeStates: {
[x: string]: import("../canvas.js").StrokeState;
};
/**
* @type {!Object<string, import("../canvas.js").TextState>}
*/
textStates: {
[x: string]: import("../canvas.js").TextState;
};
/**
* @private
* @type {Object<string, Object<string, number>>}
*/
private widths_;
/**
* @private
* @type {Object<string, import("../canvas.js").Label>}
*/
private labels_;
/**
* @param {string|Array<string>} text Text.
* @param {string} textKey Text style key.
* @param {string} fillKey Fill style key.
* @param {string} strokeKey Stroke style key.
* @return {import("../canvas.js").Label} Label.
*/
createLabel(text: string | Array<string>, textKey: string, fillKey: string, strokeKey: string): import("../canvas.js").Label;
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {import("../../coordinate.js").Coordinate} p1 1st point of the background box.
* @param {import("../../coordinate.js").Coordinate} p2 2nd point of the background box.
* @param {import("../../coordinate.js").Coordinate} p3 3rd point of the background box.
* @param {import("../../coordinate.js").Coordinate} p4 4th point of the background box.
* @param {Array<*>} fillInstruction Fill instruction.
* @param {Array<*>} strokeInstruction Stroke instruction.
*/
replayTextBackground_(context: CanvasRenderingContext2D, p1: import("../../coordinate.js").Coordinate, p2: import("../../coordinate.js").Coordinate, p3: import("../../coordinate.js").Coordinate, p4: import("../../coordinate.js").Coordinate, fillInstruction: Array<any>, strokeInstruction: Array<any>): void;
/**
* @private
* @param {number} sheetWidth Width of the sprite sheet.
* @param {number} sheetHeight Height of the sprite sheet.
* @param {number} centerX X.
* @param {number} centerY Y.
* @param {number} width Width.
* @param {number} height Height.
* @param {number} anchorX Anchor X.
* @param {number} anchorY Anchor Y.
* @param {number} originX Origin X.
* @param {number} originY Origin Y.
* @param {number} rotation Rotation.
* @param {import("../../size.js").Size} scale Scale.
* @param {boolean} snapToPixel Snap to pixel.
* @param {Array<number>} padding Padding.
* @param {boolean} fillStroke Background fill or stroke.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
* @return {ImageOrLabelDimensions} Dimensions for positioning and decluttering the image or label.
*/
private calculateImageOrLabelDimensions_;
/**
* @private
* @param {CanvasRenderingContext2D} context Context.
* @param {number} contextScale Scale of the context.
* @param {import("../canvas.js").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} imageOrLabel Image.
* @param {ImageOrLabelDimensions} dimensions Dimensions.
* @param {number} opacity Opacity.
* @param {Array<*>} fillInstruction Fill instruction.
* @param {Array<*>} strokeInstruction Stroke instruction.
* @return {boolean} The image or label was rendered.
*/
private replayImageOrLabel_;
/**
* @private
* @param {CanvasRenderingContext2D} context Context.
*/
private fill_;
/**
* @private
* @param {CanvasRenderingContext2D} context Context.
* @param {Array<*>} instruction Instruction.
*/
private setStrokeStyle_;
/**
* @private
* @param {string|Array<string>} text The text to draw.
* @param {string} textKey The key of the text state.
* @param {string} strokeKey The key for the stroke state.
* @param {string} fillKey The key for the fill state.
* @return {{label: import("../canvas.js").Label, anchorX: number, anchorY: number}} The text image and its anchor.
*/
private drawLabelWithPointPlacement_;
/**
* @private
* @param {CanvasRenderingContext2D} context Context.
* @param {number} contextScale Scale of the context.
* @param {import("../../transform.js").Transform} transform Transform.
* @param {Array<*>} instructions Instructions array.
* @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
* @param {FeatureCallback<T>} [opt_featureCallback] Feature callback.
* @param {import("../../extent.js").Extent} [opt_hitExtent] Only check
* features that intersect this extent.
* @param {import("rbush").default} [opt_declutterTree] Declutter tree.
* @return {T|undefined} Callback result.
* @template T
*/
private execute_;
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {number} contextScale Scale of the context.
* @param {import("../../transform.js").Transform} transform Transform.
* @param {number} viewRotation View rotation.
* @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
* @param {import("rbush").default} [opt_declutterTree] Declutter tree.
*/
execute(context: CanvasRenderingContext2D, contextScale: number, transform: import("../../transform.js").Transform, viewRotation: number, snapToPixel: boolean, opt_declutterTree?: any): void;
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {import("../../transform.js").Transform} transform Transform.
* @param {number} viewRotation View rotation.
* @param {FeatureCallback<T>} [opt_featureCallback] Feature callback.
* @param {import("../../extent.js").Extent} [opt_hitExtent] Only check
* features that intersect this extent.
* @return {T|undefined} Callback result.
* @template T
*/
executeHitDetection<T>(context: CanvasRenderingContext2D, transform: import("../../transform.js").Transform, viewRotation: number, opt_featureCallback?: FeatureCallback<T> | undefined, opt_hitExtent?: import("../../extent.js").Extent | undefined): T | undefined;
}
//# sourceMappingURL=Executor.d.ts.map

1
node_modules/ol/render/canvas/Executor.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Executor.d.ts","sourceRoot":"","sources":["../../src/render/canvas/Executor.js"],"names":[],"mappings":";;;;;UA4Bc,MAAM;;;;UACN,MAAM;;;;UACN,MAAM;;;;UACN,MAAM;;;;;;;;;;gBAMN,MAAM;;;;gBACN,MAAM;;;;gBACN,MAAM;;;;gBACN,MAAM;;;;aACN,MAAM;;;;aACN,MAAM;;;;WACN,MAAM,MAAM,CAAC;;;;kBACb,IAAI;;;;qBACJ,OAAO,oBAAoB,EAAE,SAAS;;qCAIvC;IAAC,CAAC,EAAE,wBAAwB,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,OAAO,cAAc,EAAE,KAAK,GAAC,gBAAgB,GAAC,iBAAiB,GAAC,gBAAgB,CAAC;IAAC,CAAC,EAAE,sBAAsB,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,UAAQ,CAAC;IAAC,CAAC,EAAE,UAAQ,CAAA;CAAC;wCAKpL,OAAO,kBAAkB,EAAE,WAAW,QAAE,OAAO,8BAA8B,EAAE,OAAO,KAAG,CAAC;AA+DhH;IACE;;;;;OAKG;IACH,wBALW,MAAM,cACN,MAAM,YACN,OAAO,gBACP,OAAO,cAAc,EAAE,wBAAwB,EAgGzD;IA7FC;;;OAGG;IACH,oBAFU,OAAO,CAEO;IAExB;;;OAGG;IACH,sBAFU,MAAM,CAEY;IAE5B;;;;OAIG;IACH,sBAFU,MAAM,CAEY;IAE5B;;;OAGG;IACH,mBAAe;IAEf;;;OAGG;IACH,wBAFU,UAAQ,CAE2B;IAE7C;;;OAGG;IACH,uBAFU,MAAM,MAAM,CAAC,CAEoB;IAE3C;;;OAGG;IACH,yBAA0B;IAE1B;;;OAGG;IACH,2BAA2C;IAE3C;;;OAGG;IACH,oCAFU,UAAQ,CAEmD;IAErE;;;OAGG;IACH,0BAA6B;IAE7B;;;OAGG;IACH,sBAAsB;IAEtB;;OAEG;IACH;YAFkB,MAAM,GAAE,OAAO,cAAc,EAAE,SAAS;MAEX;IAE/C;;OAEG;IACH;YAFkB,MAAM,GAAE,OAAO,cAAc,EAAE,WAAW;MAET;IAEnD;;OAEG;IACH;YAFkB,MAAM,GAAE,OAAO,cAAc,EAAE,SAAS;MAEX;IAE/C;;;OAGG;IACH,gBAAiB;IAEjB;;;OAGG;IACH,gBAAiB;IAGnB;;;;;;OAMG;IACH,kBANW,MAAM,GAAC,MAAM,MAAM,CAAC,WACpB,MAAM,WACN,MAAM,aACN,MAAM,GACL,OAAO,cAAc,EAAE,KAAK,CAkHvC;IAED;;;;;;;;OAQG;IACH,+BARW,wBAAwB,MACxB,OAAO,qBAAqB,EAAE,UAAU,MACxC,OAAO,qBAAqB,EAAE,UAAU,MACxC,OAAO,qBAAqB,EAAE,UAAU,MACxC,OAAO,qBAAqB,EAAE,UAAU,mBACxC,UAAQ,qBACR,UAAQ,QA4BlB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,yCA+FC;IAED;;;;;;;;;;OAUG;IACH,4BAiDC;IAED;;;OAGG;IACH,cAYC;IAED;;;;OAIG;IACH,wBAWC;IAED;;;;;;;OAOG;IACH,qCA2BC;IAED;;;;;;;;;;;;;OAaG;IACH,iBA+iBC;IAED;;;;;;;OAOG;IACH,iBAPW,wBAAwB,gBACxB,MAAM,aACN,OAAO,oBAAoB,EAAE,SAAS,gBACtC,MAAM,eACN,OAAO,iCAsBjB;IAED;;;;;;;;;OASG;IACH,gCATW,wBAAwB,aACxB,OAAO,oBAAoB,EAAE,SAAS,gBACtC,MAAM,qIAwBhB;CACF"}

963
node_modules/ol/render/canvas/Executor.js generated vendored Normal file
View File

@@ -0,0 +1,963 @@
/**
* @module ol/render/canvas/Executor
*/
import CanvasInstruction from './Instruction.js';
import { TEXT_ALIGN } from './TextBuilder.js';
import { WORKER_OFFSCREEN_CANVAS } from '../../has.js';
import { apply as applyTransform, compose as composeTransform, create as createTransform, setFromArray as transformSetFromArray, } from '../../transform.js';
import { createEmpty, createOrUpdate, intersects } from '../../extent.js';
import { defaultPadding, defaultTextAlign, defaultTextBaseline, drawImageOrLabel, getTextDimensions, measureAndCacheTextWidth, } from '../canvas.js';
import { drawTextOnPath } from '../../geom/flat/textpath.js';
import { equals } from '../../array.js';
import { lineStringLength } from '../../geom/flat/length.js';
import { transform2D } from '../../geom/flat/transform.js';
/**
* @typedef {Object} BBox
* @property {number} minX Minimal x.
* @property {number} minY Minimal y.
* @property {number} maxX Maximal x.
* @property {number} maxY Maximal y
* @property {*} value Value.
*/
/**
* @typedef {Object} ImageOrLabelDimensions
* @property {number} drawImageX DrawImageX.
* @property {number} drawImageY DrawImageY.
* @property {number} drawImageW DrawImageW.
* @property {number} drawImageH DrawImageH.
* @property {number} originX OriginX.
* @property {number} originY OriginY.
* @property {Array<number>} scale Scale.
* @property {BBox} declutterBox DeclutterBox.
* @property {import("../../transform.js").Transform} canvasTransform CanvasTransform.
*/
/**
* @typedef {{0: CanvasRenderingContext2D, 1: number, 2: import("../canvas.js").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement, 3: ImageOrLabelDimensions, 4: number, 5: Array<*>, 6: Array<*>}} ReplayImageOrLabelArgs
*/
/**
* @template T
* @typedef {function(import("../../Feature.js").FeatureLike, import("../../geom/SimpleGeometry.js").default): T} FeatureCallback
*/
/**
* @type {import("../../extent.js").Extent}
*/
var tmpExtent = createEmpty();
/** @type {import("../../coordinate.js").Coordinate} */
var p1 = [];
/** @type {import("../../coordinate.js").Coordinate} */
var p2 = [];
/** @type {import("../../coordinate.js").Coordinate} */
var p3 = [];
/** @type {import("../../coordinate.js").Coordinate} */
var p4 = [];
/**
* @param {ReplayImageOrLabelArgs} replayImageOrLabelArgs Arguments to replayImageOrLabel
* @return {BBox} Declutter bbox.
*/
function getDeclutterBox(replayImageOrLabelArgs) {
return replayImageOrLabelArgs[3].declutterBox;
}
var rtlRegEx = new RegExp(
/* eslint-disable prettier/prettier */
'[' +
String.fromCharCode(0x00591) + '-' + String.fromCharCode(0x008ff) +
String.fromCharCode(0x0fb1d) + '-' + String.fromCharCode(0x0fdff) +
String.fromCharCode(0x0fe70) + '-' + String.fromCharCode(0x0fefc) +
String.fromCharCode(0x10800) + '-' + String.fromCharCode(0x10fff) +
String.fromCharCode(0x1e800) + '-' + String.fromCharCode(0x1efff) +
']'
/* eslint-enable prettier/prettier */
);
/**
* @param {string} text Text.
* @param {string} align Alignment.
* @return {number} Text alignment.
*/
function horizontalTextAlign(text, align) {
if ((align === 'start' || align === 'end') && !rtlRegEx.test(text)) {
align = align === 'start' ? 'left' : 'right';
}
return TEXT_ALIGN[align];
}
/**
* @param {Array<string>} acc Accumulator.
* @param {string} line Line of text.
* @param {number} i Index
* @return {Array<string>} Accumulator.
*/
function createTextChunks(acc, line, i) {
if (i > 0) {
acc.push('\n', '');
}
acc.push(line, '');
return acc;
}
var Executor = /** @class */ (function () {
/**
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
* @param {boolean} overlaps The replay can have overlapping geometries.
* @param {import("../canvas.js").SerializableInstructions} instructions The serializable instructions
*/
function Executor(resolution, pixelRatio, overlaps, instructions) {
/**
* @protected
* @type {boolean}
*/
this.overlaps = overlaps;
/**
* @protected
* @type {number}
*/
this.pixelRatio = pixelRatio;
/**
* @protected
* @const
* @type {number}
*/
this.resolution = resolution;
/**
* @private
* @type {boolean}
*/
this.alignFill_;
/**
* @protected
* @type {Array<*>}
*/
this.instructions = instructions.instructions;
/**
* @protected
* @type {Array<number>}
*/
this.coordinates = instructions.coordinates;
/**
* @private
* @type {!Object<number,import("../../coordinate.js").Coordinate|Array<import("../../coordinate.js").Coordinate>|Array<Array<import("../../coordinate.js").Coordinate>>>}
*/
this.coordinateCache_ = {};
/**
* @private
* @type {!import("../../transform.js").Transform}
*/
this.renderedTransform_ = createTransform();
/**
* @protected
* @type {Array<*>}
*/
this.hitDetectionInstructions = instructions.hitDetectionInstructions;
/**
* @private
* @type {Array<number>}
*/
this.pixelCoordinates_ = null;
/**
* @private
* @type {number}
*/
this.viewRotation_ = 0;
/**
* @type {!Object<string, import("../canvas.js").FillState>}
*/
this.fillStates = instructions.fillStates || {};
/**
* @type {!Object<string, import("../canvas.js").StrokeState>}
*/
this.strokeStates = instructions.strokeStates || {};
/**
* @type {!Object<string, import("../canvas.js").TextState>}
*/
this.textStates = instructions.textStates || {};
/**
* @private
* @type {Object<string, Object<string, number>>}
*/
this.widths_ = {};
/**
* @private
* @type {Object<string, import("../canvas.js").Label>}
*/
this.labels_ = {};
}
/**
* @param {string|Array<string>} text Text.
* @param {string} textKey Text style key.
* @param {string} fillKey Fill style key.
* @param {string} strokeKey Stroke style key.
* @return {import("../canvas.js").Label} Label.
*/
Executor.prototype.createLabel = function (text, textKey, fillKey, strokeKey) {
var key = text + textKey + fillKey + strokeKey;
if (this.labels_[key]) {
return this.labels_[key];
}
var strokeState = strokeKey ? this.strokeStates[strokeKey] : null;
var fillState = fillKey ? this.fillStates[fillKey] : null;
var textState = this.textStates[textKey];
var pixelRatio = this.pixelRatio;
var scale = [
textState.scale[0] * pixelRatio,
textState.scale[1] * pixelRatio,
];
var textIsArray = Array.isArray(text);
var align = textState.justify
? TEXT_ALIGN[textState.justify]
: horizontalTextAlign(Array.isArray(text) ? text[0] : text, textState.textAlign || defaultTextAlign);
var strokeWidth = strokeKey && strokeState.lineWidth ? strokeState.lineWidth : 0;
var chunks = textIsArray
? text
: text.split('\n').reduce(createTextChunks, []);
var _a = getTextDimensions(textState, chunks), width = _a.width, height = _a.height, widths = _a.widths, heights = _a.heights, lineWidths = _a.lineWidths;
var renderWidth = width + strokeWidth;
var contextInstructions = [];
// make canvas 2 pixels wider to account for italic text width measurement errors
var w = (renderWidth + 2) * scale[0];
var h = (height + strokeWidth) * scale[1];
/** @type {import("../canvas.js").Label} */
var label = {
width: w < 0 ? Math.floor(w) : Math.ceil(w),
height: h < 0 ? Math.floor(h) : Math.ceil(h),
contextInstructions: contextInstructions,
};
if (scale[0] != 1 || scale[1] != 1) {
contextInstructions.push('scale', scale);
}
if (strokeKey) {
contextInstructions.push('strokeStyle', strokeState.strokeStyle);
contextInstructions.push('lineWidth', strokeWidth);
contextInstructions.push('lineCap', strokeState.lineCap);
contextInstructions.push('lineJoin', strokeState.lineJoin);
contextInstructions.push('miterLimit', strokeState.miterLimit);
// eslint-disable-next-line
var Context = WORKER_OFFSCREEN_CANVAS ? OffscreenCanvasRenderingContext2D : CanvasRenderingContext2D;
if (Context.prototype.setLineDash) {
contextInstructions.push('setLineDash', [strokeState.lineDash]);
contextInstructions.push('lineDashOffset', strokeState.lineDashOffset);
}
}
if (fillKey) {
contextInstructions.push('fillStyle', fillState.fillStyle);
}
contextInstructions.push('textBaseline', 'middle');
contextInstructions.push('textAlign', 'center');
var leftRight = 0.5 - align;
var x = align * renderWidth + leftRight * strokeWidth;
var strokeInstructions = [];
var fillInstructions = [];
var lineHeight = 0;
var lineOffset = 0;
var widthHeightIndex = 0;
var lineWidthIndex = 0;
var previousFont;
for (var i = 0, ii = chunks.length; i < ii; i += 2) {
var text_1 = chunks[i];
if (text_1 === '\n') {
lineOffset += lineHeight;
lineHeight = 0;
x = align * renderWidth + leftRight * strokeWidth;
++lineWidthIndex;
continue;
}
var font = chunks[i + 1] || textState.font;
if (font !== previousFont) {
if (strokeKey) {
strokeInstructions.push('font', font);
}
if (fillKey) {
fillInstructions.push('font', font);
}
previousFont = font;
}
lineHeight = Math.max(lineHeight, heights[widthHeightIndex]);
var fillStrokeArgs = [
text_1,
x +
leftRight * widths[widthHeightIndex] +
align * (widths[widthHeightIndex] - lineWidths[lineWidthIndex]),
0.5 * (strokeWidth + lineHeight) + lineOffset,
];
x += widths[widthHeightIndex];
if (strokeKey) {
strokeInstructions.push('strokeText', fillStrokeArgs);
}
if (fillKey) {
fillInstructions.push('fillText', fillStrokeArgs);
}
++widthHeightIndex;
}
Array.prototype.push.apply(contextInstructions, strokeInstructions);
Array.prototype.push.apply(contextInstructions, fillInstructions);
this.labels_[key] = label;
return label;
};
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {import("../../coordinate.js").Coordinate} p1 1st point of the background box.
* @param {import("../../coordinate.js").Coordinate} p2 2nd point of the background box.
* @param {import("../../coordinate.js").Coordinate} p3 3rd point of the background box.
* @param {import("../../coordinate.js").Coordinate} p4 4th point of the background box.
* @param {Array<*>} fillInstruction Fill instruction.
* @param {Array<*>} strokeInstruction Stroke instruction.
*/
Executor.prototype.replayTextBackground_ = function (context, p1, p2, p3, p4, fillInstruction, strokeInstruction) {
context.beginPath();
context.moveTo.apply(context, p1);
context.lineTo.apply(context, p2);
context.lineTo.apply(context, p3);
context.lineTo.apply(context, p4);
context.lineTo.apply(context, p1);
if (fillInstruction) {
this.alignFill_ = /** @type {boolean} */ (fillInstruction[2]);
this.fill_(context);
}
if (strokeInstruction) {
this.setStrokeStyle_(context,
/** @type {Array<*>} */ (strokeInstruction));
context.stroke();
}
};
/**
* @private
* @param {number} sheetWidth Width of the sprite sheet.
* @param {number} sheetHeight Height of the sprite sheet.
* @param {number} centerX X.
* @param {number} centerY Y.
* @param {number} width Width.
* @param {number} height Height.
* @param {number} anchorX Anchor X.
* @param {number} anchorY Anchor Y.
* @param {number} originX Origin X.
* @param {number} originY Origin Y.
* @param {number} rotation Rotation.
* @param {import("../../size.js").Size} scale Scale.
* @param {boolean} snapToPixel Snap to pixel.
* @param {Array<number>} padding Padding.
* @param {boolean} fillStroke Background fill or stroke.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
* @return {ImageOrLabelDimensions} Dimensions for positioning and decluttering the image or label.
*/
Executor.prototype.calculateImageOrLabelDimensions_ = function (sheetWidth, sheetHeight, centerX, centerY, width, height, anchorX, anchorY, originX, originY, rotation, scale, snapToPixel, padding, fillStroke, feature) {
anchorX *= scale[0];
anchorY *= scale[1];
var x = centerX - anchorX;
var y = centerY - anchorY;
var w = width + originX > sheetWidth ? sheetWidth - originX : width;
var h = height + originY > sheetHeight ? sheetHeight - originY : height;
var boxW = padding[3] + w * scale[0] + padding[1];
var boxH = padding[0] + h * scale[1] + padding[2];
var boxX = x - padding[3];
var boxY = y - padding[0];
if (fillStroke || rotation !== 0) {
p1[0] = boxX;
p4[0] = boxX;
p1[1] = boxY;
p2[1] = boxY;
p2[0] = boxX + boxW;
p3[0] = p2[0];
p3[1] = boxY + boxH;
p4[1] = p3[1];
}
var transform;
if (rotation !== 0) {
transform = composeTransform(createTransform(), centerX, centerY, 1, 1, rotation, -centerX, -centerY);
applyTransform(transform, p1);
applyTransform(transform, p2);
applyTransform(transform, p3);
applyTransform(transform, p4);
createOrUpdate(Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1]), tmpExtent);
}
else {
createOrUpdate(Math.min(boxX, boxX + boxW), Math.min(boxY, boxY + boxH), Math.max(boxX, boxX + boxW), Math.max(boxY, boxY + boxH), tmpExtent);
}
if (snapToPixel) {
x = Math.round(x);
y = Math.round(y);
}
return {
drawImageX: x,
drawImageY: y,
drawImageW: w,
drawImageH: h,
originX: originX,
originY: originY,
declutterBox: {
minX: tmpExtent[0],
minY: tmpExtent[1],
maxX: tmpExtent[2],
maxY: tmpExtent[3],
value: feature,
},
canvasTransform: transform,
scale: scale,
};
};
/**
* @private
* @param {CanvasRenderingContext2D} context Context.
* @param {number} contextScale Scale of the context.
* @param {import("../canvas.js").Label|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} imageOrLabel Image.
* @param {ImageOrLabelDimensions} dimensions Dimensions.
* @param {number} opacity Opacity.
* @param {Array<*>} fillInstruction Fill instruction.
* @param {Array<*>} strokeInstruction Stroke instruction.
* @return {boolean} The image or label was rendered.
*/
Executor.prototype.replayImageOrLabel_ = function (context, contextScale, imageOrLabel, dimensions, opacity, fillInstruction, strokeInstruction) {
var fillStroke = !!(fillInstruction || strokeInstruction);
var box = dimensions.declutterBox;
var canvas = context.canvas;
var strokePadding = strokeInstruction
? (strokeInstruction[2] * dimensions.scale[0]) / 2
: 0;
var intersects = box.minX - strokePadding <= canvas.width / contextScale &&
box.maxX + strokePadding >= 0 &&
box.minY - strokePadding <= canvas.height / contextScale &&
box.maxY + strokePadding >= 0;
if (intersects) {
if (fillStroke) {
this.replayTextBackground_(context, p1, p2, p3, p4,
/** @type {Array<*>} */ (fillInstruction),
/** @type {Array<*>} */ (strokeInstruction));
}
drawImageOrLabel(context, dimensions.canvasTransform, opacity, imageOrLabel, dimensions.originX, dimensions.originY, dimensions.drawImageW, dimensions.drawImageH, dimensions.drawImageX, dimensions.drawImageY, dimensions.scale);
}
return true;
};
/**
* @private
* @param {CanvasRenderingContext2D} context Context.
*/
Executor.prototype.fill_ = function (context) {
if (this.alignFill_) {
var origin_1 = applyTransform(this.renderedTransform_, [0, 0]);
var repeatSize = 512 * this.pixelRatio;
context.save();
context.translate(origin_1[0] % repeatSize, origin_1[1] % repeatSize);
context.rotate(this.viewRotation_);
}
context.fill();
if (this.alignFill_) {
context.restore();
}
};
/**
* @private
* @param {CanvasRenderingContext2D} context Context.
* @param {Array<*>} instruction Instruction.
*/
Executor.prototype.setStrokeStyle_ = function (context, instruction) {
context['strokeStyle'] =
/** @type {import("../../colorlike.js").ColorLike} */ (instruction[1]);
context.lineWidth = /** @type {number} */ (instruction[2]);
context.lineCap = /** @type {CanvasLineCap} */ (instruction[3]);
context.lineJoin = /** @type {CanvasLineJoin} */ (instruction[4]);
context.miterLimit = /** @type {number} */ (instruction[5]);
if (context.setLineDash) {
context.lineDashOffset = /** @type {number} */ (instruction[7]);
context.setLineDash(/** @type {Array<number>} */ (instruction[6]));
}
};
/**
* @private
* @param {string|Array<string>} text The text to draw.
* @param {string} textKey The key of the text state.
* @param {string} strokeKey The key for the stroke state.
* @param {string} fillKey The key for the fill state.
* @return {{label: import("../canvas.js").Label, anchorX: number, anchorY: number}} The text image and its anchor.
*/
Executor.prototype.drawLabelWithPointPlacement_ = function (text, textKey, strokeKey, fillKey) {
var textState = this.textStates[textKey];
var label = this.createLabel(text, textKey, fillKey, strokeKey);
var strokeState = this.strokeStates[strokeKey];
var pixelRatio = this.pixelRatio;
var align = horizontalTextAlign(Array.isArray(text) ? text[0] : text, textState.textAlign || defaultTextAlign);
var baseline = TEXT_ALIGN[textState.textBaseline || defaultTextBaseline];
var strokeWidth = strokeState && strokeState.lineWidth ? strokeState.lineWidth : 0;
// Remove the 2 pixels we added in createLabel() for the anchor
var width = label.width / pixelRatio - 2 * textState.scale[0];
var anchorX = align * width + 2 * (0.5 - align) * strokeWidth;
var anchorY = (baseline * label.height) / pixelRatio +
2 * (0.5 - baseline) * strokeWidth;
return {
label: label,
anchorX: anchorX,
anchorY: anchorY,
};
};
/**
* @private
* @param {CanvasRenderingContext2D} context Context.
* @param {number} contextScale Scale of the context.
* @param {import("../../transform.js").Transform} transform Transform.
* @param {Array<*>} instructions Instructions array.
* @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
* @param {FeatureCallback<T>} [opt_featureCallback] Feature callback.
* @param {import("../../extent.js").Extent} [opt_hitExtent] Only check
* features that intersect this extent.
* @param {import("rbush").default} [opt_declutterTree] Declutter tree.
* @return {T|undefined} Callback result.
* @template T
*/
Executor.prototype.execute_ = function (context, contextScale, transform, instructions, snapToPixel, opt_featureCallback, opt_hitExtent, opt_declutterTree) {
/** @type {Array<number>} */
var pixelCoordinates;
if (this.pixelCoordinates_ && equals(transform, this.renderedTransform_)) {
pixelCoordinates = this.pixelCoordinates_;
}
else {
if (!this.pixelCoordinates_) {
this.pixelCoordinates_ = [];
}
pixelCoordinates = transform2D(this.coordinates, 0, this.coordinates.length, 2, transform, this.pixelCoordinates_);
transformSetFromArray(this.renderedTransform_, transform);
}
var i = 0; // instruction index
var ii = instructions.length; // end of instructions
var d = 0; // data index
var dd; // end of per-instruction data
var anchorX, anchorY, prevX, prevY, roundX, roundY, image, text, textKey, strokeKey, fillKey;
var pendingFill = 0;
var pendingStroke = 0;
var lastFillInstruction = null;
var lastStrokeInstruction = null;
var coordinateCache = this.coordinateCache_;
var viewRotation = this.viewRotation_;
var viewRotationFromTransform = Math.round(Math.atan2(-transform[1], transform[0]) * 1e12) / 1e12;
var state = /** @type {import("../../render.js").State} */ ({
context: context,
pixelRatio: this.pixelRatio,
resolution: this.resolution,
rotation: viewRotation,
});
// When the batch size gets too big, performance decreases. 200 is a good
// balance between batch size and number of fill/stroke instructions.
var batchSize = this.instructions != instructions || this.overlaps ? 0 : 200;
var /** @type {import("../../Feature.js").FeatureLike} */ feature;
var x, y, currentGeometry;
while (i < ii) {
var instruction = instructions[i];
var type = /** @type {import("./Instruction.js").default} */ (instruction[0]);
switch (type) {
case CanvasInstruction.BEGIN_GEOMETRY:
feature = /** @type {import("../../Feature.js").FeatureLike} */ (instruction[1]);
currentGeometry = instruction[3];
if (!feature.getGeometry()) {
i = /** @type {number} */ (instruction[2]);
}
else if (opt_hitExtent !== undefined &&
!intersects(opt_hitExtent, currentGeometry.getExtent())) {
i = /** @type {number} */ (instruction[2]) + 1;
}
else {
++i;
}
break;
case CanvasInstruction.BEGIN_PATH:
if (pendingFill > batchSize) {
this.fill_(context);
pendingFill = 0;
}
if (pendingStroke > batchSize) {
context.stroke();
pendingStroke = 0;
}
if (!pendingFill && !pendingStroke) {
context.beginPath();
prevX = NaN;
prevY = NaN;
}
++i;
break;
case CanvasInstruction.CIRCLE:
d = /** @type {number} */ (instruction[1]);
var x1 = pixelCoordinates[d];
var y1 = pixelCoordinates[d + 1];
var x2 = pixelCoordinates[d + 2];
var y2 = pixelCoordinates[d + 3];
var dx = x2 - x1;
var dy = y2 - y1;
var r = Math.sqrt(dx * dx + dy * dy);
context.moveTo(x1 + r, y1);
context.arc(x1, y1, r, 0, 2 * Math.PI, true);
++i;
break;
case CanvasInstruction.CLOSE_PATH:
context.closePath();
++i;
break;
case CanvasInstruction.CUSTOM:
d = /** @type {number} */ (instruction[1]);
dd = instruction[2];
var geometry =
/** @type {import("../../geom/SimpleGeometry.js").default} */ (instruction[3]);
var renderer = instruction[4];
var fn = instruction.length == 6 ? instruction[5] : undefined;
state.geometry = geometry;
state.feature = feature;
if (!(i in coordinateCache)) {
coordinateCache[i] = [];
}
var coords = coordinateCache[i];
if (fn) {
fn(pixelCoordinates, d, dd, 2, coords);
}
else {
coords[0] = pixelCoordinates[d];
coords[1] = pixelCoordinates[d + 1];
coords.length = 2;
}
renderer(coords, state);
++i;
break;
case CanvasInstruction.DRAW_IMAGE:
d = /** @type {number} */ (instruction[1]);
dd = /** @type {number} */ (instruction[2]);
image =
/** @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} */ (instruction[3]);
// Remaining arguments in DRAW_IMAGE are in alphabetical order
anchorX = /** @type {number} */ (instruction[4]);
anchorY = /** @type {number} */ (instruction[5]);
var height = /** @type {number} */ (instruction[6]);
var opacity = /** @type {number} */ (instruction[7]);
var originX = /** @type {number} */ (instruction[8]);
var originY = /** @type {number} */ (instruction[9]);
var rotateWithView = /** @type {boolean} */ (instruction[10]);
var rotation = /** @type {number} */ (instruction[11]);
var scale = /** @type {import("../../size.js").Size} */ (instruction[12]);
var width = /** @type {number} */ (instruction[13]);
var declutterMode =
/** @type {"declutter"|"obstacle"|"none"|undefined} */ (instruction[14]);
var declutterImageWithText =
/** @type {import("../canvas.js").DeclutterImageWithText} */ (instruction[15]);
if (!image && instruction.length >= 20) {
// create label images
text = /** @type {string} */ (instruction[19]);
textKey = /** @type {string} */ (instruction[20]);
strokeKey = /** @type {string} */ (instruction[21]);
fillKey = /** @type {string} */ (instruction[22]);
var labelWithAnchor = this.drawLabelWithPointPlacement_(text, textKey, strokeKey, fillKey);
image = labelWithAnchor.label;
instruction[3] = image;
var textOffsetX = /** @type {number} */ (instruction[23]);
anchorX = (labelWithAnchor.anchorX - textOffsetX) * this.pixelRatio;
instruction[4] = anchorX;
var textOffsetY = /** @type {number} */ (instruction[24]);
anchorY = (labelWithAnchor.anchorY - textOffsetY) * this.pixelRatio;
instruction[5] = anchorY;
height = image.height;
instruction[6] = height;
width = image.width;
instruction[13] = width;
}
var geometryWidths = void 0;
if (instruction.length > 25) {
geometryWidths = /** @type {number} */ (instruction[25]);
}
var padding = void 0, backgroundFill = void 0, backgroundStroke = void 0;
if (instruction.length > 17) {
padding = /** @type {Array<number>} */ (instruction[16]);
backgroundFill = /** @type {boolean} */ (instruction[17]);
backgroundStroke = /** @type {boolean} */ (instruction[18]);
}
else {
padding = defaultPadding;
backgroundFill = false;
backgroundStroke = false;
}
if (rotateWithView && viewRotationFromTransform) {
// Canvas is expected to be rotated to reverse view rotation.
rotation += viewRotation;
}
else if (!rotateWithView && !viewRotationFromTransform) {
// Canvas is not rotated, images need to be rotated back to be north-up.
rotation -= viewRotation;
}
var widthIndex = 0;
for (; d < dd; d += 2) {
if (geometryWidths &&
geometryWidths[widthIndex++] < width / this.pixelRatio) {
continue;
}
var dimensions = this.calculateImageOrLabelDimensions_(image.width, image.height, pixelCoordinates[d], pixelCoordinates[d + 1], width, height, anchorX, anchorY, originX, originY, rotation, scale, snapToPixel, padding, backgroundFill || backgroundStroke, feature);
/** @type {ReplayImageOrLabelArgs} */
var args = [
context,
contextScale,
image,
dimensions,
opacity,
backgroundFill
? /** @type {Array<*>} */ (lastFillInstruction)
: null,
backgroundStroke
? /** @type {Array<*>} */ (lastStrokeInstruction)
: null,
];
if (opt_declutterTree) {
if (declutterMode === 'none') {
// not rendered in declutter group
continue;
}
else if (declutterMode === 'obstacle') {
// will always be drawn, thus no collision detection, but insert as obstacle
opt_declutterTree.insert(dimensions.declutterBox);
continue;
}
else {
var imageArgs = void 0;
var imageDeclutterBox = void 0;
if (declutterImageWithText) {
var index = dd - d;
if (!declutterImageWithText[index]) {
// We now have the image for an image+text combination.
declutterImageWithText[index] = args;
// Don't render anything for now, wait for the text.
continue;
}
imageArgs = declutterImageWithText[index];
delete declutterImageWithText[index];
imageDeclutterBox = getDeclutterBox(imageArgs);
if (opt_declutterTree.collides(imageDeclutterBox)) {
continue;
}
}
if (opt_declutterTree.collides(dimensions.declutterBox)) {
continue;
}
if (imageArgs) {
// We now have image and text for an image+text combination.
opt_declutterTree.insert(imageDeclutterBox);
// Render the image before we render the text.
this.replayImageOrLabel_.apply(this, imageArgs);
}
opt_declutterTree.insert(dimensions.declutterBox);
}
}
this.replayImageOrLabel_.apply(this, args);
}
++i;
break;
case CanvasInstruction.DRAW_CHARS:
var begin = /** @type {number} */ (instruction[1]);
var end = /** @type {number} */ (instruction[2]);
var baseline = /** @type {number} */ (instruction[3]);
var overflow = /** @type {number} */ (instruction[4]);
fillKey = /** @type {string} */ (instruction[5]);
var maxAngle = /** @type {number} */ (instruction[6]);
var measurePixelRatio = /** @type {number} */ (instruction[7]);
var offsetY = /** @type {number} */ (instruction[8]);
strokeKey = /** @type {string} */ (instruction[9]);
var strokeWidth = /** @type {number} */ (instruction[10]);
text = /** @type {string} */ (instruction[11]);
textKey = /** @type {string} */ (instruction[12]);
var pixelRatioScale = [
/** @type {number} */ (instruction[13]),
/** @type {number} */ (instruction[13]),
];
var textState = this.textStates[textKey];
var font = textState.font;
var textScale = [
textState.scale[0] * measurePixelRatio,
textState.scale[1] * measurePixelRatio,
];
var cachedWidths = void 0;
if (font in this.widths_) {
cachedWidths = this.widths_[font];
}
else {
cachedWidths = {};
this.widths_[font] = cachedWidths;
}
var pathLength = lineStringLength(pixelCoordinates, begin, end, 2);
var textLength = Math.abs(textScale[0]) *
measureAndCacheTextWidth(font, text, cachedWidths);
if (overflow || textLength <= pathLength) {
var textAlign = this.textStates[textKey].textAlign;
var startM = (pathLength - textLength) * TEXT_ALIGN[textAlign];
var parts = drawTextOnPath(pixelCoordinates, begin, end, 2, text, startM, maxAngle, Math.abs(textScale[0]), measureAndCacheTextWidth, font, cachedWidths, viewRotationFromTransform ? 0 : this.viewRotation_);
drawChars: if (parts) {
/** @type {Array<ReplayImageOrLabelArgs>} */
var replayImageOrLabelArgs = [];
var c = void 0, cc = void 0, chars = void 0, label = void 0, part = void 0;
if (strokeKey) {
for (c = 0, cc = parts.length; c < cc; ++c) {
part = parts[c]; // x, y, anchorX, rotation, chunk
chars = /** @type {string} */ (part[4]);
label = this.createLabel(chars, textKey, '', strokeKey);
anchorX =
/** @type {number} */ (part[2]) +
(textScale[0] < 0 ? -strokeWidth : strokeWidth);
anchorY =
baseline * label.height +
((0.5 - baseline) * 2 * strokeWidth * textScale[1]) /
textScale[0] -
offsetY;
var dimensions = this.calculateImageOrLabelDimensions_(label.width, label.height, part[0], part[1], label.width, label.height, anchorX, anchorY, 0, 0, part[3], pixelRatioScale, false, defaultPadding, false, feature);
if (opt_declutterTree &&
opt_declutterTree.collides(dimensions.declutterBox)) {
break drawChars;
}
replayImageOrLabelArgs.push([
context,
contextScale,
label,
dimensions,
1,
null,
null,
]);
}
}
if (fillKey) {
for (c = 0, cc = parts.length; c < cc; ++c) {
part = parts[c]; // x, y, anchorX, rotation, chunk
chars = /** @type {string} */ (part[4]);
label = this.createLabel(chars, textKey, fillKey, '');
anchorX = /** @type {number} */ (part[2]);
anchorY = baseline * label.height - offsetY;
var dimensions = this.calculateImageOrLabelDimensions_(label.width, label.height, part[0], part[1], label.width, label.height, anchorX, anchorY, 0, 0, part[3], pixelRatioScale, false, defaultPadding, false, feature);
if (opt_declutterTree &&
opt_declutterTree.collides(dimensions.declutterBox)) {
break drawChars;
}
replayImageOrLabelArgs.push([
context,
contextScale,
label,
dimensions,
1,
null,
null,
]);
}
}
if (opt_declutterTree) {
opt_declutterTree.load(replayImageOrLabelArgs.map(getDeclutterBox));
}
for (var i_1 = 0, ii_1 = replayImageOrLabelArgs.length; i_1 < ii_1; ++i_1) {
this.replayImageOrLabel_.apply(this, replayImageOrLabelArgs[i_1]);
}
}
}
++i;
break;
case CanvasInstruction.END_GEOMETRY:
if (opt_featureCallback !== undefined) {
feature = /** @type {import("../../Feature.js").FeatureLike} */ (instruction[1]);
var result = opt_featureCallback(feature, currentGeometry);
if (result) {
return result;
}
}
++i;
break;
case CanvasInstruction.FILL:
if (batchSize) {
pendingFill++;
}
else {
this.fill_(context);
}
++i;
break;
case CanvasInstruction.MOVE_TO_LINE_TO:
d = /** @type {number} */ (instruction[1]);
dd = /** @type {number} */ (instruction[2]);
x = pixelCoordinates[d];
y = pixelCoordinates[d + 1];
roundX = (x + 0.5) | 0;
roundY = (y + 0.5) | 0;
if (roundX !== prevX || roundY !== prevY) {
context.moveTo(x, y);
prevX = roundX;
prevY = roundY;
}
for (d += 2; d < dd; d += 2) {
x = pixelCoordinates[d];
y = pixelCoordinates[d + 1];
roundX = (x + 0.5) | 0;
roundY = (y + 0.5) | 0;
if (d == dd - 2 || roundX !== prevX || roundY !== prevY) {
context.lineTo(x, y);
prevX = roundX;
prevY = roundY;
}
}
++i;
break;
case CanvasInstruction.SET_FILL_STYLE:
lastFillInstruction = instruction;
this.alignFill_ = instruction[2];
if (pendingFill) {
this.fill_(context);
pendingFill = 0;
if (pendingStroke) {
context.stroke();
pendingStroke = 0;
}
}
context.fillStyle =
/** @type {import("../../colorlike.js").ColorLike} */ (instruction[1]);
++i;
break;
case CanvasInstruction.SET_STROKE_STYLE:
lastStrokeInstruction = instruction;
if (pendingStroke) {
context.stroke();
pendingStroke = 0;
}
this.setStrokeStyle_(context, /** @type {Array<*>} */ (instruction));
++i;
break;
case CanvasInstruction.STROKE:
if (batchSize) {
pendingStroke++;
}
else {
context.stroke();
}
++i;
break;
default: // consume the instruction anyway, to avoid an infinite loop
++i;
break;
}
}
if (pendingFill) {
this.fill_(context);
}
if (pendingStroke) {
context.stroke();
}
return undefined;
};
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {number} contextScale Scale of the context.
* @param {import("../../transform.js").Transform} transform Transform.
* @param {number} viewRotation View rotation.
* @param {boolean} snapToPixel Snap point symbols and text to integer pixels.
* @param {import("rbush").default} [opt_declutterTree] Declutter tree.
*/
Executor.prototype.execute = function (context, contextScale, transform, viewRotation, snapToPixel, opt_declutterTree) {
this.viewRotation_ = viewRotation;
this.execute_(context, contextScale, transform, this.instructions, snapToPixel, undefined, undefined, opt_declutterTree);
};
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {import("../../transform.js").Transform} transform Transform.
* @param {number} viewRotation View rotation.
* @param {FeatureCallback<T>} [opt_featureCallback] Feature callback.
* @param {import("../../extent.js").Extent} [opt_hitExtent] Only check
* features that intersect this extent.
* @return {T|undefined} Callback result.
* @template T
*/
Executor.prototype.executeHitDetection = function (context, transform, viewRotation, opt_featureCallback, opt_hitExtent) {
this.viewRotation_ = viewRotation;
return this.execute_(context, 1, transform, this.hitDetectionInstructions, true, opt_featureCallback, opt_hitExtent);
};
return Executor;
}());
export default Executor;
//# sourceMappingURL=Executor.js.map

1
node_modules/ol/render/canvas/Executor.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

114
node_modules/ol/render/canvas/ExecutorGroup.d.ts generated vendored Normal file
View File

@@ -0,0 +1,114 @@
/**
* This methods creates an array with indexes of all pixels within a circle,
* ordered by how close they are to the center.
* A cache is used to increase performance.
* @param {number} radius Radius.
* @return {Array<number>} An array with indexes within a circle.
*/
export function getPixelIndexArray(radius: number): Array<number>;
export default ExecutorGroup;
declare class ExecutorGroup {
/**
* @param {import("../../extent.js").Extent} maxExtent Max extent for clipping. When a
* `maxExtent` was set on the Builder for this executor group, the same `maxExtent`
* should be set here, unless the target context does not exceed that extent (which
* can be the case when rendering to tiles).
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
* @param {boolean} overlaps The executor group can have overlapping geometries.
* @param {!Object<string, !Object<import("../canvas.js").BuilderType, import("../canvas.js").SerializableInstructions>>} allInstructions
* The serializable instructions.
* @param {number} [opt_renderBuffer] Optional rendering buffer.
*/
constructor(maxExtent: import("../../extent.js").Extent, resolution: number, pixelRatio: number, overlaps: boolean, allInstructions: {
[x: string]: any;
}, opt_renderBuffer?: number | undefined);
/**
* @private
* @type {import("../../extent.js").Extent}
*/
private maxExtent_;
/**
* @private
* @type {boolean}
*/
private overlaps_;
/**
* @private
* @type {number}
*/
private pixelRatio_;
/**
* @private
* @type {number}
*/
private resolution_;
/**
* @private
* @type {number|undefined}
*/
private renderBuffer_;
/**
* @private
* @type {!Object<string, !Object<import("../canvas.js").BuilderType, import("./Executor").default>>}
*/
private executorsByZIndex_;
/**
* @private
* @type {CanvasRenderingContext2D}
*/
private hitDetectionContext_;
/**
* @private
* @type {import("../../transform.js").Transform}
*/
private hitDetectionTransform_;
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {import("../../transform.js").Transform} transform Transform.
*/
clip(context: CanvasRenderingContext2D, transform: import("../../transform.js").Transform): void;
/**
* Create executors and populate them using the provided instructions.
* @private
* @param {!Object<string, !Object<import("../canvas.js").BuilderType, import("../canvas.js").SerializableInstructions>>} allInstructions The serializable instructions
*/
private createExecutors_;
/**
* @param {Array<import("../canvas.js").BuilderType>} executors Executors.
* @return {boolean} Has executors of the provided types.
*/
hasExecutors(executors: Array<import("../canvas.js").BuilderType>): boolean;
/**
* @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
* @param {number} resolution Resolution.
* @param {number} rotation Rotation.
* @param {number} hitTolerance Hit tolerance in pixels.
* @param {function(import("../../Feature.js").FeatureLike, import("../../geom/SimpleGeometry.js").default, number): T} callback Feature callback.
* @param {Array<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
* @return {T|undefined} Callback result.
* @template T
*/
forEachFeatureAtCoordinate<T>(coordinate: import("../../coordinate.js").Coordinate, resolution: number, rotation: number, hitTolerance: number, callback: (arg0: import("../../Feature.js").FeatureLike, arg1: import("../../geom/SimpleGeometry.js").default, arg2: number) => T, declutteredFeatures: Array<import("../../Feature.js").FeatureLike>): T | undefined;
/**
* @param {import("../../transform.js").Transform} transform Transform.
* @return {Array<number>|null} Clip coordinates.
*/
getClipCoords(transform: import("../../transform.js").Transform): Array<number> | null;
/**
* @return {boolean} Is empty.
*/
isEmpty(): boolean;
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {number} contextScale Scale of the context.
* @param {import("../../transform.js").Transform} transform Transform.
* @param {number} viewRotation View rotation.
* @param {boolean} snapToPixel Snap point symbols and test to integer pixel.
* @param {Array<import("../canvas.js").BuilderType>} [opt_builderTypes] Ordered replay types to replay.
* Default is {@link module:ol/render/replay~ORDER}
* @param {import("rbush").default} [opt_declutterTree] Declutter tree.
*/
execute(context: CanvasRenderingContext2D, contextScale: number, transform: import("../../transform.js").Transform, viewRotation: number, snapToPixel: boolean, opt_builderTypes?: import("../canvas.js").BuilderType[] | undefined, opt_declutterTree?: any): void;
}
//# sourceMappingURL=ExecutorGroup.d.ts.map

1
node_modules/ol/render/canvas/ExecutorGroup.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"ExecutorGroup.d.ts","sourceRoot":"","sources":["../../src/render/canvas/ExecutorGroup.js"],"names":[],"mappings":"AAmXA;;;;;;GAMG;AACH,2CAHW,MAAM,GACL,MAAM,MAAM,CAAC,CA2CxB;;AA9YD;IACE;;;;;;;;;;;OAWG;IACH,uBAXW,OAAO,iBAAiB,EAAE,MAAM,cAIhC,MAAM,cACN,MAAM,YACN,OAAO;YACC,MAAM;8CA6DxB;IAjDC;;;OAGG;IACH,mBAA2B;IAE3B;;;OAGG;IACH,kBAAyB;IAEzB;;;OAGG;IACH,oBAA6B;IAE7B;;;OAGG;IACH,oBAA6B;IAE7B;;;OAGG;IACH,sBAAqC;IAErC;;;OAGG;IACH,2BAA4B;IAE5B;;;OAGG;IACH,6BAAgC;IAEhC;;;OAGG;IACH,+BAA+C;IAKjD;;;OAGG;IACH,cAHW,wBAAwB,aACxB,OAAO,oBAAoB,EAAE,SAAS,QAUhD;IAED;;;;OAIG;IACH,yBAkBC;IAED;;;OAGG;IACH,wBAHW,MAAM,OAAO,cAAc,EAAE,WAAW,CAAC,GACxC,OAAO,CAYlB;IAED;;;;;;;;;OASG;IACH,0CATW,OAAO,qBAAqB,EAAE,UAAU,cACxC,MAAM,YACN,MAAM,gBACN,MAAM,mBACG,OAAO,kBAAkB,EAAE,WAAW,QAAE,OAAO,8BAA8B,EAAE,OAAO,QAAE,MAAM,6BACvG,MAAM,OAAO,kBAAkB,EAAE,WAAW,CAAC,iBA0HvD;IAED;;;OAGG;IACH,yBAHW,OAAO,oBAAoB,EAAE,SAAS,GACrC,MAAM,MAAM,CAAC,GAAC,IAAI,CAc7B;IAED;;OAEG;IACH,WAFY,OAAO,CAIlB;IAED;;;;;;;;;OASG;IACH,iBATW,wBAAwB,gBACxB,MAAM,aACN,OAAO,oBAAoB,EAAE,SAAS,gBACtC,MAAM,eACN,OAAO,sGAoDjB;CACF"}

322
node_modules/ol/render/canvas/ExecutorGroup.js generated vendored Normal file
View File

@@ -0,0 +1,322 @@
/**
* @module ol/render/canvas/ExecutorGroup
*/
import Executor from './Executor.js';
import { buffer, createEmpty, extendCoordinate } from '../../extent.js';
import { compose as composeTransform, create as createTransform, } from '../../transform.js';
import { createCanvasContext2D } from '../../dom.js';
import { isEmpty } from '../../obj.js';
import { numberSafeCompareFunction } from '../../array.js';
import { transform2D } from '../../geom/flat/transform.js';
/**
* @const
* @type {Array<import("../canvas.js").BuilderType>}
*/
var ORDER = ['Polygon', 'Circle', 'LineString', 'Image', 'Text', 'Default'];
var ExecutorGroup = /** @class */ (function () {
/**
* @param {import("../../extent.js").Extent} maxExtent Max extent for clipping. When a
* `maxExtent` was set on the Builder for this executor group, the same `maxExtent`
* should be set here, unless the target context does not exceed that extent (which
* can be the case when rendering to tiles).
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
* @param {boolean} overlaps The executor group can have overlapping geometries.
* @param {!Object<string, !Object<import("../canvas.js").BuilderType, import("../canvas.js").SerializableInstructions>>} allInstructions
* The serializable instructions.
* @param {number} [opt_renderBuffer] Optional rendering buffer.
*/
function ExecutorGroup(maxExtent, resolution, pixelRatio, overlaps, allInstructions, opt_renderBuffer) {
/**
* @private
* @type {import("../../extent.js").Extent}
*/
this.maxExtent_ = maxExtent;
/**
* @private
* @type {boolean}
*/
this.overlaps_ = overlaps;
/**
* @private
* @type {number}
*/
this.pixelRatio_ = pixelRatio;
/**
* @private
* @type {number}
*/
this.resolution_ = resolution;
/**
* @private
* @type {number|undefined}
*/
this.renderBuffer_ = opt_renderBuffer;
/**
* @private
* @type {!Object<string, !Object<import("../canvas.js").BuilderType, import("./Executor").default>>}
*/
this.executorsByZIndex_ = {};
/**
* @private
* @type {CanvasRenderingContext2D}
*/
this.hitDetectionContext_ = null;
/**
* @private
* @type {import("../../transform.js").Transform}
*/
this.hitDetectionTransform_ = createTransform();
this.createExecutors_(allInstructions);
}
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {import("../../transform.js").Transform} transform Transform.
*/
ExecutorGroup.prototype.clip = function (context, transform) {
var flatClipCoords = this.getClipCoords(transform);
context.beginPath();
context.moveTo(flatClipCoords[0], flatClipCoords[1]);
context.lineTo(flatClipCoords[2], flatClipCoords[3]);
context.lineTo(flatClipCoords[4], flatClipCoords[5]);
context.lineTo(flatClipCoords[6], flatClipCoords[7]);
context.clip();
};
/**
* Create executors and populate them using the provided instructions.
* @private
* @param {!Object<string, !Object<import("../canvas.js").BuilderType, import("../canvas.js").SerializableInstructions>>} allInstructions The serializable instructions
*/
ExecutorGroup.prototype.createExecutors_ = function (allInstructions) {
for (var zIndex in allInstructions) {
var executors = this.executorsByZIndex_[zIndex];
if (executors === undefined) {
executors = {};
this.executorsByZIndex_[zIndex] = executors;
}
var instructionByZindex = allInstructions[zIndex];
for (var builderType in instructionByZindex) {
var instructions = instructionByZindex[builderType];
executors[builderType] = new Executor(this.resolution_, this.pixelRatio_, this.overlaps_, instructions);
}
}
};
/**
* @param {Array<import("../canvas.js").BuilderType>} executors Executors.
* @return {boolean} Has executors of the provided types.
*/
ExecutorGroup.prototype.hasExecutors = function (executors) {
for (var zIndex in this.executorsByZIndex_) {
var candidates = this.executorsByZIndex_[zIndex];
for (var i = 0, ii = executors.length; i < ii; ++i) {
if (executors[i] in candidates) {
return true;
}
}
}
return false;
};
/**
* @param {import("../../coordinate.js").Coordinate} coordinate Coordinate.
* @param {number} resolution Resolution.
* @param {number} rotation Rotation.
* @param {number} hitTolerance Hit tolerance in pixels.
* @param {function(import("../../Feature.js").FeatureLike, import("../../geom/SimpleGeometry.js").default, number): T} callback Feature callback.
* @param {Array<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
* @return {T|undefined} Callback result.
* @template T
*/
ExecutorGroup.prototype.forEachFeatureAtCoordinate = function (coordinate, resolution, rotation, hitTolerance, callback, declutteredFeatures) {
hitTolerance = Math.round(hitTolerance);
var contextSize = hitTolerance * 2 + 1;
var transform = composeTransform(this.hitDetectionTransform_, hitTolerance + 0.5, hitTolerance + 0.5, 1 / resolution, -1 / resolution, -rotation, -coordinate[0], -coordinate[1]);
var newContext = !this.hitDetectionContext_;
if (newContext) {
this.hitDetectionContext_ = createCanvasContext2D(contextSize, contextSize);
}
var context = this.hitDetectionContext_;
if (context.canvas.width !== contextSize ||
context.canvas.height !== contextSize) {
context.canvas.width = contextSize;
context.canvas.height = contextSize;
}
else if (!newContext) {
context.clearRect(0, 0, contextSize, contextSize);
}
/**
* @type {import("../../extent.js").Extent}
*/
var hitExtent;
if (this.renderBuffer_ !== undefined) {
hitExtent = createEmpty();
extendCoordinate(hitExtent, coordinate);
buffer(hitExtent, resolution * (this.renderBuffer_ + hitTolerance), hitExtent);
}
var indexes = getPixelIndexArray(hitTolerance);
var builderType;
/**
* @param {import("../../Feature.js").FeatureLike} feature Feature.
* @param {import("../../geom/SimpleGeometry.js").default} geometry Geometry.
* @return {T|undefined} Callback result.
*/
function featureCallback(feature, geometry) {
var imageData = context.getImageData(0, 0, contextSize, contextSize).data;
for (var i_1 = 0, ii = indexes.length; i_1 < ii; i_1++) {
if (imageData[indexes[i_1]] > 0) {
if (!declutteredFeatures ||
(builderType !== 'Image' && builderType !== 'Text') ||
declutteredFeatures.indexOf(feature) !== -1) {
var idx = (indexes[i_1] - 3) / 4;
var x = hitTolerance - (idx % contextSize);
var y = hitTolerance - ((idx / contextSize) | 0);
var result_1 = callback(feature, geometry, x * x + y * y);
if (result_1) {
return result_1;
}
}
context.clearRect(0, 0, contextSize, contextSize);
break;
}
}
return undefined;
}
/** @type {Array<number>} */
var zs = Object.keys(this.executorsByZIndex_).map(Number);
zs.sort(numberSafeCompareFunction);
var i, j, executors, executor, result;
for (i = zs.length - 1; i >= 0; --i) {
var zIndexKey = zs[i].toString();
executors = this.executorsByZIndex_[zIndexKey];
for (j = ORDER.length - 1; j >= 0; --j) {
builderType = ORDER[j];
executor = executors[builderType];
if (executor !== undefined) {
result = executor.executeHitDetection(context, transform, rotation, featureCallback, hitExtent);
if (result) {
return result;
}
}
}
}
return undefined;
};
/**
* @param {import("../../transform.js").Transform} transform Transform.
* @return {Array<number>|null} Clip coordinates.
*/
ExecutorGroup.prototype.getClipCoords = function (transform) {
var maxExtent = this.maxExtent_;
if (!maxExtent) {
return null;
}
var minX = maxExtent[0];
var minY = maxExtent[1];
var maxX = maxExtent[2];
var maxY = maxExtent[3];
var flatClipCoords = [minX, minY, minX, maxY, maxX, maxY, maxX, minY];
transform2D(flatClipCoords, 0, 8, 2, transform, flatClipCoords);
return flatClipCoords;
};
/**
* @return {boolean} Is empty.
*/
ExecutorGroup.prototype.isEmpty = function () {
return isEmpty(this.executorsByZIndex_);
};
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {number} contextScale Scale of the context.
* @param {import("../../transform.js").Transform} transform Transform.
* @param {number} viewRotation View rotation.
* @param {boolean} snapToPixel Snap point symbols and test to integer pixel.
* @param {Array<import("../canvas.js").BuilderType>} [opt_builderTypes] Ordered replay types to replay.
* Default is {@link module:ol/render/replay~ORDER}
* @param {import("rbush").default} [opt_declutterTree] Declutter tree.
*/
ExecutorGroup.prototype.execute = function (context, contextScale, transform, viewRotation, snapToPixel, opt_builderTypes, opt_declutterTree) {
/** @type {Array<number>} */
var zs = Object.keys(this.executorsByZIndex_).map(Number);
zs.sort(numberSafeCompareFunction);
// setup clipping so that the parts of over-simplified geometries are not
// visible outside the current extent when panning
if (this.maxExtent_) {
context.save();
this.clip(context, transform);
}
var builderTypes = opt_builderTypes ? opt_builderTypes : ORDER;
var i, ii, j, jj, replays, replay;
if (opt_declutterTree) {
zs.reverse();
}
for (i = 0, ii = zs.length; i < ii; ++i) {
var zIndexKey = zs[i].toString();
replays = this.executorsByZIndex_[zIndexKey];
for (j = 0, jj = builderTypes.length; j < jj; ++j) {
var builderType = builderTypes[j];
replay = replays[builderType];
if (replay !== undefined) {
replay.execute(context, contextScale, transform, viewRotation, snapToPixel, opt_declutterTree);
}
}
}
if (this.maxExtent_) {
context.restore();
}
};
return ExecutorGroup;
}());
/**
* This cache is used to store arrays of indexes for calculated pixel circles
* to increase performance.
* It is a static property to allow each Replaygroup to access it.
* @type {Object<number, Array<number>>}
*/
var circlePixelIndexArrayCache = {};
/**
* This methods creates an array with indexes of all pixels within a circle,
* ordered by how close they are to the center.
* A cache is used to increase performance.
* @param {number} radius Radius.
* @return {Array<number>} An array with indexes within a circle.
*/
export function getPixelIndexArray(radius) {
if (circlePixelIndexArrayCache[radius] !== undefined) {
return circlePixelIndexArrayCache[radius];
}
var size = radius * 2 + 1;
var maxDistanceSq = radius * radius;
var distances = new Array(maxDistanceSq + 1);
for (var i = 0; i <= radius; ++i) {
for (var j = 0; j <= radius; ++j) {
var distanceSq = i * i + j * j;
if (distanceSq > maxDistanceSq) {
break;
}
var distance = distances[distanceSq];
if (!distance) {
distance = [];
distances[distanceSq] = distance;
}
distance.push(((radius + i) * size + (radius + j)) * 4 + 3);
if (i > 0) {
distance.push(((radius - i) * size + (radius + j)) * 4 + 3);
}
if (j > 0) {
distance.push(((radius + i) * size + (radius - j)) * 4 + 3);
if (i > 0) {
distance.push(((radius - i) * size + (radius - j)) * 4 + 3);
}
}
}
}
var pixelIndex = [];
for (var i = 0, ii = distances.length; i < ii; ++i) {
if (distances[i]) {
pixelIndex.push.apply(pixelIndex, distances[i]);
}
}
circlePixelIndexArrayCache[radius] = pixelIndex;
return pixelIndex;
}
export default ExecutorGroup;
//# sourceMappingURL=ExecutorGroup.js.map

1
node_modules/ol/render/canvas/ExecutorGroup.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

86
node_modules/ol/render/canvas/ImageBuilder.d.ts generated vendored Normal file
View File

@@ -0,0 +1,86 @@
export default CanvasImageBuilder;
declare class CanvasImageBuilder extends CanvasBuilder {
/**
* @private
* @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
*/
private hitDetectionImage_;
/**
* @private
* @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
*/
private image_;
/**
* @private
* @type {number|undefined}
*/
private imagePixelRatio_;
/**
* @private
* @type {number|undefined}
*/
private anchorX_;
/**
* @private
* @type {number|undefined}
*/
private anchorY_;
/**
* @private
* @type {number|undefined}
*/
private height_;
/**
* @private
* @type {number|undefined}
*/
private opacity_;
/**
* @private
* @type {number|undefined}
*/
private originX_;
/**
* @private
* @type {number|undefined}
*/
private originY_;
/**
* @private
* @type {boolean|undefined}
*/
private rotateWithView_;
/**
* @private
* @type {number|undefined}
*/
private rotation_;
/**
* @private
* @type {import("../../size.js").Size|undefined}
*/
private scale_;
/**
* @private
* @type {number|undefined}
*/
private width_;
/**
* @private
* @type {"declutter"|"obstacle"|"none"|undefined}
*/
private declutterMode_;
/**
* Data shared with a text builder for combined decluttering.
* @private
* @type {import("../canvas.js").DeclutterImageWithText}
*/
private declutterImageWithText_;
/**
* @param {import("../../style/Image.js").default} imageStyle Image style.
* @param {Object} [opt_sharedData] Shared data.
*/
setImageStyle(imageStyle: import("../../style/Image.js").default, opt_sharedData?: any): void;
}
import CanvasBuilder from "./Builder.js";
//# sourceMappingURL=ImageBuilder.d.ts.map

1
node_modules/ol/render/canvas/ImageBuilder.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"ImageBuilder.d.ts","sourceRoot":"","sources":["../../src/render/canvas/ImageBuilder.js"],"names":[],"mappings":";AAMA;IAUI;;;OAGG;IACH,2BAA8B;IAE9B;;;OAGG;IACH,eAAkB;IAElB;;;OAGG;IACH,yBAAiC;IAEjC;;;OAGG;IACH,iBAAyB;IAEzB;;;OAGG;IACH,iBAAyB;IAEzB;;;OAGG;IACH,gBAAwB;IAExB;;;OAGG;IACH,iBAAyB;IAEzB;;;OAGG;IACH,iBAAyB;IAEzB;;;OAGG;IACH,iBAAyB;IAEzB;;;OAGG;IACH,wBAAgC;IAEhC;;;OAGG;IACH,kBAA0B;IAE1B;;;OAGG;IACH,eAAuB;IAEvB;;;OAGG;IACH,eAAuB;IAEvB;;;OAGG;IACH,uBAA+B;IAE/B;;;;OAIG;IACH,gCAAwC;IA2I1C;;;OAGG;IACH,0BAHW,OAAO,sBAAsB,EAAE,OAAO,8BAsBhD;CACF"}

269
node_modules/ol/render/canvas/ImageBuilder.js generated vendored Normal file
View File

@@ -0,0 +1,269 @@
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/render/canvas/ImageBuilder
*/
import CanvasBuilder from './Builder.js';
import CanvasInstruction from './Instruction.js';
var CanvasImageBuilder = /** @class */ (function (_super) {
__extends(CanvasImageBuilder, _super);
/**
* @param {number} tolerance Tolerance.
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
*/
function CanvasImageBuilder(tolerance, maxExtent, resolution, pixelRatio) {
var _this = _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this;
/**
* @private
* @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
*/
_this.hitDetectionImage_ = null;
/**
* @private
* @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
*/
_this.image_ = null;
/**
* @private
* @type {number|undefined}
*/
_this.imagePixelRatio_ = undefined;
/**
* @private
* @type {number|undefined}
*/
_this.anchorX_ = undefined;
/**
* @private
* @type {number|undefined}
*/
_this.anchorY_ = undefined;
/**
* @private
* @type {number|undefined}
*/
_this.height_ = undefined;
/**
* @private
* @type {number|undefined}
*/
_this.opacity_ = undefined;
/**
* @private
* @type {number|undefined}
*/
_this.originX_ = undefined;
/**
* @private
* @type {number|undefined}
*/
_this.originY_ = undefined;
/**
* @private
* @type {boolean|undefined}
*/
_this.rotateWithView_ = undefined;
/**
* @private
* @type {number|undefined}
*/
_this.rotation_ = undefined;
/**
* @private
* @type {import("../../size.js").Size|undefined}
*/
_this.scale_ = undefined;
/**
* @private
* @type {number|undefined}
*/
_this.width_ = undefined;
/**
* @private
* @type {"declutter"|"obstacle"|"none"|undefined}
*/
_this.declutterMode_ = undefined;
/**
* Data shared with a text builder for combined decluttering.
* @private
* @type {import("../canvas.js").DeclutterImageWithText}
*/
_this.declutterImageWithText_ = undefined;
return _this;
}
/**
* @param {import("../../geom/Point.js").default|import("../Feature.js").default} pointGeometry Point geometry.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
*/
CanvasImageBuilder.prototype.drawPoint = function (pointGeometry, feature) {
if (!this.image_) {
return;
}
this.beginGeometry(pointGeometry, feature);
var flatCoordinates = pointGeometry.getFlatCoordinates();
var stride = pointGeometry.getStride();
var myBegin = this.coordinates.length;
var myEnd = this.appendFlatPointCoordinates(flatCoordinates, stride);
this.instructions.push([
CanvasInstruction.DRAW_IMAGE,
myBegin,
myEnd,
this.image_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_ * this.imagePixelRatio_,
this.anchorY_ * this.imagePixelRatio_,
Math.ceil(this.height_ * this.imagePixelRatio_),
this.opacity_,
this.originX_ * this.imagePixelRatio_,
this.originY_ * this.imagePixelRatio_,
this.rotateWithView_,
this.rotation_,
[
(this.scale_[0] * this.pixelRatio) / this.imagePixelRatio_,
(this.scale_[1] * this.pixelRatio) / this.imagePixelRatio_,
],
Math.ceil(this.width_ * this.imagePixelRatio_),
this.declutterMode_,
this.declutterImageWithText_,
]);
this.hitDetectionInstructions.push([
CanvasInstruction.DRAW_IMAGE,
myBegin,
myEnd,
this.hitDetectionImage_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_,
this.anchorY_,
this.height_,
this.opacity_,
this.originX_,
this.originY_,
this.rotateWithView_,
this.rotation_,
this.scale_,
this.width_,
this.declutterMode_,
this.declutterImageWithText_,
]);
this.endGeometry(feature);
};
/**
* @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} multiPointGeometry MultiPoint geometry.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
*/
CanvasImageBuilder.prototype.drawMultiPoint = function (multiPointGeometry, feature) {
if (!this.image_) {
return;
}
this.beginGeometry(multiPointGeometry, feature);
var flatCoordinates = multiPointGeometry.getFlatCoordinates();
var stride = multiPointGeometry.getStride();
var myBegin = this.coordinates.length;
var myEnd = this.appendFlatPointCoordinates(flatCoordinates, stride);
this.instructions.push([
CanvasInstruction.DRAW_IMAGE,
myBegin,
myEnd,
this.image_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_ * this.imagePixelRatio_,
this.anchorY_ * this.imagePixelRatio_,
Math.ceil(this.height_ * this.imagePixelRatio_),
this.opacity_,
this.originX_ * this.imagePixelRatio_,
this.originY_ * this.imagePixelRatio_,
this.rotateWithView_,
this.rotation_,
[
(this.scale_[0] * this.pixelRatio) / this.imagePixelRatio_,
(this.scale_[1] * this.pixelRatio) / this.imagePixelRatio_,
],
Math.ceil(this.width_ * this.imagePixelRatio_),
this.declutterMode_,
this.declutterImageWithText_,
]);
this.hitDetectionInstructions.push([
CanvasInstruction.DRAW_IMAGE,
myBegin,
myEnd,
this.hitDetectionImage_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_,
this.anchorY_,
this.height_,
this.opacity_,
this.originX_,
this.originY_,
this.rotateWithView_,
this.rotation_,
this.scale_,
this.width_,
this.declutterMode_,
this.declutterImageWithText_,
]);
this.endGeometry(feature);
};
/**
* @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
*/
CanvasImageBuilder.prototype.finish = function () {
this.reverseHitDetectionInstructions();
// FIXME this doesn't really protect us against further calls to draw*Geometry
this.anchorX_ = undefined;
this.anchorY_ = undefined;
this.hitDetectionImage_ = null;
this.image_ = null;
this.imagePixelRatio_ = undefined;
this.height_ = undefined;
this.scale_ = undefined;
this.opacity_ = undefined;
this.originX_ = undefined;
this.originY_ = undefined;
this.rotateWithView_ = undefined;
this.rotation_ = undefined;
this.width_ = undefined;
return _super.prototype.finish.call(this);
};
/**
* @param {import("../../style/Image.js").default} imageStyle Image style.
* @param {Object} [opt_sharedData] Shared data.
*/
CanvasImageBuilder.prototype.setImageStyle = function (imageStyle, opt_sharedData) {
var anchor = imageStyle.getAnchor();
var size = imageStyle.getSize();
var origin = imageStyle.getOrigin();
this.imagePixelRatio_ = imageStyle.getPixelRatio(this.pixelRatio);
this.anchorX_ = anchor[0];
this.anchorY_ = anchor[1];
this.hitDetectionImage_ = imageStyle.getHitDetectionImage();
this.image_ = imageStyle.getImage(this.pixelRatio);
this.height_ = size[1];
this.opacity_ = imageStyle.getOpacity();
this.originX_ = origin[0];
this.originY_ = origin[1];
this.rotateWithView_ = imageStyle.getRotateWithView();
this.rotation_ = imageStyle.getRotation();
this.scale_ = imageStyle.getScaleArray();
this.width_ = size[0];
this.declutterMode_ = imageStyle.getDeclutterMode();
this.declutterImageWithText_ = opt_sharedData;
};
return CanvasImageBuilder;
}(CanvasBuilder));
export default CanvasImageBuilder;
//# sourceMappingURL=ImageBuilder.js.map

1
node_modules/ol/render/canvas/ImageBuilder.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

326
node_modules/ol/render/canvas/Immediate.d.ts generated vendored Normal file
View File

@@ -0,0 +1,326 @@
export default CanvasImmediateRenderer;
/**
* @classdesc
* A concrete subclass of {@link module:ol/render/VectorContext~VectorContext VectorContext} that implements
* direct rendering of features and geometries to an HTML5 Canvas context.
* Instances of this class are created internally by the library and
* provided to application code as vectorContext member of the
* {@link module:ol/render/Event~RenderEvent RenderEvent} object associated with postcompose, precompose and
* render events emitted by layers and maps.
*/
declare class CanvasImmediateRenderer extends VectorContext {
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {number} pixelRatio Pixel ratio.
* @param {import("../../extent.js").Extent} extent Extent.
* @param {import("../../transform.js").Transform} transform Transform.
* @param {number} viewRotation View rotation.
* @param {number} [opt_squaredTolerance] Optional squared tolerance for simplification.
* @param {import("../../proj.js").TransformFunction} [opt_userTransform] Transform from user to view projection.
*/
constructor(context: CanvasRenderingContext2D, pixelRatio: number, extent: import("../../extent.js").Extent, transform: import("../../transform.js").Transform, viewRotation: number, opt_squaredTolerance?: number | undefined, opt_userTransform?: import("../../proj.js").TransformFunction | undefined);
/**
* @private
* @type {CanvasRenderingContext2D}
*/
private context_;
/**
* @private
* @type {number}
*/
private pixelRatio_;
/**
* @private
* @type {import("../../extent.js").Extent}
*/
private extent_;
/**
* @private
* @type {import("../../transform.js").Transform}
*/
private transform_;
/**
* @private
* @type {number}
*/
private viewRotation_;
/**
* @private
* @type {number}
*/
private squaredTolerance_;
/**
* @private
* @type {import("../../proj.js").TransformFunction}
*/
private userTransform_;
/**
* @private
* @type {?import("../canvas.js").FillState}
*/
private contextFillState_;
/**
* @private
* @type {?import("../canvas.js").StrokeState}
*/
private contextStrokeState_;
/**
* @private
* @type {?import("../canvas.js").TextState}
*/
private contextTextState_;
/**
* @private
* @type {?import("../canvas.js").FillState}
*/
private fillState_;
/**
* @private
* @type {?import("../canvas.js").StrokeState}
*/
private strokeState_;
/**
* @private
* @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
*/
private image_;
/**
* @private
* @type {number}
*/
private imageAnchorX_;
/**
* @private
* @type {number}
*/
private imageAnchorY_;
/**
* @private
* @type {number}
*/
private imageHeight_;
/**
* @private
* @type {number}
*/
private imageOpacity_;
/**
* @private
* @type {number}
*/
private imageOriginX_;
/**
* @private
* @type {number}
*/
private imageOriginY_;
/**
* @private
* @type {boolean}
*/
private imageRotateWithView_;
/**
* @private
* @type {number}
*/
private imageRotation_;
/**
* @private
* @type {import("../../size.js").Size}
*/
private imageScale_;
/**
* @private
* @type {number}
*/
private imageWidth_;
/**
* @private
* @type {string}
*/
private text_;
/**
* @private
* @type {number}
*/
private textOffsetX_;
/**
* @private
* @type {number}
*/
private textOffsetY_;
/**
* @private
* @type {boolean}
*/
private textRotateWithView_;
/**
* @private
* @type {number}
*/
private textRotation_;
/**
* @private
* @type {import("../../size.js").Size}
*/
private textScale_;
/**
* @private
* @type {?import("../canvas.js").FillState}
*/
private textFillState_;
/**
* @private
* @type {?import("../canvas.js").StrokeState}
*/
private textStrokeState_;
/**
* @private
* @type {?import("../canvas.js").TextState}
*/
private textState_;
/**
* @private
* @type {Array<number>}
*/
private pixelCoordinates_;
/**
* @private
* @type {import("../../transform.js").Transform}
*/
private tmpLocalTransform_;
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
* @private
*/
private drawImages_;
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
* @private
*/
private drawText_;
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
* @param {boolean} close Close.
* @private
* @return {number} end End.
*/
private moveToLineTo_;
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {Array<number>} ends Ends.
* @param {number} stride Stride.
* @private
* @return {number} End.
*/
private drawRings_;
/**
* Render a circle geometry into the canvas. Rendering is immediate and uses
* the current fill and stroke styles.
*
* @param {import("../../geom/Circle.js").default} geometry Circle geometry.
* @api
*/
drawCircle(geometry: import("../../geom/Circle.js").default): void;
/**
* @param {import("../../transform.js").Transform} transform Transform.
*/
setTransform(transform: import("../../transform.js").Transform): void;
/**
* Render a geometry into the canvas. Call
* {@link module:ol/render/canvas/Immediate~CanvasImmediateRenderer#setStyle renderer.setStyle()} first to set the rendering style.
*
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry The geometry to render.
* @api
*/
drawGeometry(geometry: import("../../geom/Geometry.js").default | import("../Feature.js").default): void;
/**
* Render a GeometryCollection to the canvas. Rendering is immediate and
* uses the current styles appropriate for each geometry in the collection.
*
* @param {import("../../geom/GeometryCollection.js").default} geometry Geometry collection.
*/
drawGeometryCollection(geometry: import("../../geom/GeometryCollection.js").default): void;
/**
* Render a Point geometry into the canvas. Rendering is immediate and uses
* the current style.
*
* @param {import("../../geom/Point.js").default|import("../Feature.js").default} geometry Point geometry.
*/
drawPoint(geometry: import("../../geom/Point.js").default | import("../Feature.js").default): void;
/**
* Render a MultiPoint geometry into the canvas. Rendering is immediate and
* uses the current style.
*
* @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} geometry MultiPoint geometry.
*/
drawMultiPoint(geometry: import("../../geom/MultiPoint.js").default | import("../Feature.js").default): void;
/**
* Render a LineString into the canvas. Rendering is immediate and uses
* the current style.
*
* @param {import("../../geom/LineString.js").default|import("../Feature.js").default} geometry LineString geometry.
*/
drawLineString(geometry: import("../../geom/LineString.js").default | import("../Feature.js").default): void;
/**
* Render a MultiLineString geometry into the canvas. Rendering is immediate
* and uses the current style.
*
* @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} geometry MultiLineString geometry.
*/
drawMultiLineString(geometry: import("../../geom/MultiLineString.js").default | import("../Feature.js").default): void;
/**
* Render a Polygon geometry into the canvas. Rendering is immediate and uses
* the current style.
*
* @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} geometry Polygon geometry.
*/
drawPolygon(geometry: import("../../geom/Polygon.js").default | import("../Feature.js").default): void;
/**
* Render MultiPolygon geometry into the canvas. Rendering is immediate and
* uses the current style.
* @param {import("../../geom/MultiPolygon.js").default} geometry MultiPolygon geometry.
*/
drawMultiPolygon(geometry: import("../../geom/MultiPolygon.js").default): void;
/**
* @param {import("../canvas.js").FillState} fillState Fill state.
* @private
*/
private setContextFillState_;
/**
* @param {import("../canvas.js").StrokeState} strokeState Stroke state.
* @private
*/
private setContextStrokeState_;
/**
* @param {import("../canvas.js").TextState} textState Text state.
* @private
*/
private setContextTextState_;
/**
* Set the image style for subsequent draw operations. Pass null to remove
* the image style.
*
* @param {import("../../style/Image.js").default} imageStyle Image style.
*/
setImageStyle(imageStyle: import("../../style/Image.js").default): void;
/**
* Set the text style for subsequent draw operations. Pass null to
* remove the text style.
*
* @param {import("../../style/Text.js").default} textStyle Text style.
*/
setTextStyle(textStyle: import("../../style/Text.js").default): void;
}
import VectorContext from "../VectorContext.js";
//# sourceMappingURL=Immediate.d.ts.map

1
node_modules/ol/render/canvas/Immediate.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Immediate.d.ts","sourceRoot":"","sources":["../../src/render/canvas/Immediate.js"],"names":[],"mappings":";AA+BA;;;;;;;;GAQG;AACH;IACE;;;;;;;;OAQG;IACH,qBARW,wBAAwB,cACxB,MAAM,UACN,OAAO,iBAAiB,EAAE,MAAM,aAChC,OAAO,oBAAoB,EAAE,SAAS,gBACtC,MAAM,wHA0NhB;IA3MC;;;OAGG;IACH,iBAAuB;IAEvB;;;OAGG;IACH,oBAA6B;IAE7B;;;OAGG;IACH,gBAAqB;IAErB;;;OAGG;IACH,mBAA2B;IAE3B;;;OAGG;IACH,sBAAiC;IAEjC;;;OAGG;IACH,0BAA6C;IAE7C;;;OAGG;IACH,uBAAuC;IAEvC;;;OAGG;IACH,0BAA6B;IAE7B;;;OAGG;IACH,4BAA+B;IAE/B;;;OAGG;IACH,0BAA6B;IAE7B;;;OAGG;IACH,mBAAsB;IAEtB;;;OAGG;IACH,qBAAwB;IAExB;;;OAGG;IACH,eAAkB;IAElB;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,qBAAqB;IAErB;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,6BAAiC;IAEjC;;;OAGG;IACH,uBAAuB;IAEvB;;;OAGG;IACH,oBAAyB;IAEzB;;;OAGG;IACH,oBAAoB;IAEpB;;;OAGG;IACH,cAAe;IAEf;;;OAGG;IACH,qBAAqB;IAErB;;;OAGG;IACH,qBAAqB;IAErB;;;OAGG;IACH,4BAAgC;IAEhC;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,mBAAwB;IAExB;;;OAGG;IACH,uBAA0B;IAE1B;;;OAGG;IACH,yBAA4B;IAE5B;;;OAGG;IACH,mBAAsB;IAEtB;;;OAGG;IACH,0BAA2B;IAE3B;;;OAGG;IACH,2BAA2C;IAG7C;;;;;;OAMG;IACH,oBA0EC;IAED;;;;;;OAMG;IACH,kBA6DC;IAED;;;;;;;;OAQG;IACH,sBAsBC;IAED;;;;;;;OAOG;IACH,mBAWC;IAED;;;;;;OAMG;IACH,qBAHW,OAAO,sBAAsB,EAAE,OAAO,QAyChD;IAeD;;OAEG;IACH,wBAFW,OAAO,oBAAoB,EAAE,SAAS,QAIhD;IAED;;;;;;OAMG;IACH,uBAHW,OAAO,wBAAwB,EAAE,OAAO,GAAC,OAAO,eAAe,EAAE,OAAO,QAoDlF;IAqBD;;;;;OAKG;IACH,iCAFW,OAAO,kCAAkC,EAAE,OAAO,QAO5D;IAED;;;;;OAKG;IACH,oBAFW,OAAO,qBAAqB,EAAE,OAAO,GAAC,OAAO,eAAe,EAAE,OAAO,QAmB/E;IAED;;;;;OAKG;IACH,yBAFW,OAAO,0BAA0B,EAAE,OAAO,GAAC,OAAO,eAAe,EAAE,OAAO,QAmBpF;IAED;;;;;OAKG;IACH,yBAFW,OAAO,0BAA0B,EAAE,OAAO,GAAC,OAAO,eAAe,EAAE,OAAO,QAgCpF;IAED;;;;;OAKG;IACH,8BAFW,OAAO,+BAA+B,EAAE,OAAO,GAAC,OAAO,eAAe,EAAE,OAAO,QAuCzF;IAED;;;;;OAKG;IACH,sBAFW,OAAO,uBAAuB,EAAE,OAAO,GAAC,OAAO,eAAe,EAAE,OAAO,QAwCjF;IAED;;;;OAIG;IACH,2BAFW,OAAO,4BAA4B,EAAE,OAAO,QA0CtD;IAED;;;OAGG;IACH,6BAcC;IAED;;;OAGG;IACH,+BAuDC;IAED;;;OAGG;IACH,6BAmCC;IAiED;;;;;OAKG;IACH,0BAFW,OAAO,sBAAsB,EAAE,OAAO,QAqBhD;IAED;;;;;OAKG;IACH,wBAFW,OAAO,qBAAqB,EAAE,OAAO,QA6F/C;CACF"}

951
node_modules/ol/render/canvas/Immediate.js generated vendored Normal file
View File

@@ -0,0 +1,951 @@
/**
* @module ol/render/canvas/Immediate
*/
// FIXME test, especially polygons with holes and multipolygons
// FIXME need to handle large thick features (where pixel size matters)
// FIXME add offset and end to ol/geom/flat/transform~transform2D?
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 VectorContext from '../VectorContext.js';
import { asColorLike } from '../../colorlike.js';
import { compose as composeTransform, create as createTransform, } from '../../transform.js';
import { defaultFillStyle, defaultFont, defaultLineCap, defaultLineDash, defaultLineDashOffset, defaultLineJoin, defaultLineWidth, defaultMiterLimit, defaultStrokeStyle, defaultTextAlign, defaultTextBaseline, } from '../canvas.js';
import { equals } from '../../array.js';
import { intersects } from '../../extent.js';
import { transform2D } from '../../geom/flat/transform.js';
import { transformGeom2D } from '../../geom/SimpleGeometry.js';
/**
* @classdesc
* A concrete subclass of {@link module:ol/render/VectorContext~VectorContext VectorContext} that implements
* direct rendering of features and geometries to an HTML5 Canvas context.
* Instances of this class are created internally by the library and
* provided to application code as vectorContext member of the
* {@link module:ol/render/Event~RenderEvent RenderEvent} object associated with postcompose, precompose and
* render events emitted by layers and maps.
*/
var CanvasImmediateRenderer = /** @class */ (function (_super) {
__extends(CanvasImmediateRenderer, _super);
/**
* @param {CanvasRenderingContext2D} context Context.
* @param {number} pixelRatio Pixel ratio.
* @param {import("../../extent.js").Extent} extent Extent.
* @param {import("../../transform.js").Transform} transform Transform.
* @param {number} viewRotation View rotation.
* @param {number} [opt_squaredTolerance] Optional squared tolerance for simplification.
* @param {import("../../proj.js").TransformFunction} [opt_userTransform] Transform from user to view projection.
*/
function CanvasImmediateRenderer(context, pixelRatio, extent, transform, viewRotation, opt_squaredTolerance, opt_userTransform) {
var _this = _super.call(this) || this;
/**
* @private
* @type {CanvasRenderingContext2D}
*/
_this.context_ = context;
/**
* @private
* @type {number}
*/
_this.pixelRatio_ = pixelRatio;
/**
* @private
* @type {import("../../extent.js").Extent}
*/
_this.extent_ = extent;
/**
* @private
* @type {import("../../transform.js").Transform}
*/
_this.transform_ = transform;
/**
* @private
* @type {number}
*/
_this.viewRotation_ = viewRotation;
/**
* @private
* @type {number}
*/
_this.squaredTolerance_ = opt_squaredTolerance;
/**
* @private
* @type {import("../../proj.js").TransformFunction}
*/
_this.userTransform_ = opt_userTransform;
/**
* @private
* @type {?import("../canvas.js").FillState}
*/
_this.contextFillState_ = null;
/**
* @private
* @type {?import("../canvas.js").StrokeState}
*/
_this.contextStrokeState_ = null;
/**
* @private
* @type {?import("../canvas.js").TextState}
*/
_this.contextTextState_ = null;
/**
* @private
* @type {?import("../canvas.js").FillState}
*/
_this.fillState_ = null;
/**
* @private
* @type {?import("../canvas.js").StrokeState}
*/
_this.strokeState_ = null;
/**
* @private
* @type {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement}
*/
_this.image_ = null;
/**
* @private
* @type {number}
*/
_this.imageAnchorX_ = 0;
/**
* @private
* @type {number}
*/
_this.imageAnchorY_ = 0;
/**
* @private
* @type {number}
*/
_this.imageHeight_ = 0;
/**
* @private
* @type {number}
*/
_this.imageOpacity_ = 0;
/**
* @private
* @type {number}
*/
_this.imageOriginX_ = 0;
/**
* @private
* @type {number}
*/
_this.imageOriginY_ = 0;
/**
* @private
* @type {boolean}
*/
_this.imageRotateWithView_ = false;
/**
* @private
* @type {number}
*/
_this.imageRotation_ = 0;
/**
* @private
* @type {import("../../size.js").Size}
*/
_this.imageScale_ = [0, 0];
/**
* @private
* @type {number}
*/
_this.imageWidth_ = 0;
/**
* @private
* @type {string}
*/
_this.text_ = '';
/**
* @private
* @type {number}
*/
_this.textOffsetX_ = 0;
/**
* @private
* @type {number}
*/
_this.textOffsetY_ = 0;
/**
* @private
* @type {boolean}
*/
_this.textRotateWithView_ = false;
/**
* @private
* @type {number}
*/
_this.textRotation_ = 0;
/**
* @private
* @type {import("../../size.js").Size}
*/
_this.textScale_ = [0, 0];
/**
* @private
* @type {?import("../canvas.js").FillState}
*/
_this.textFillState_ = null;
/**
* @private
* @type {?import("../canvas.js").StrokeState}
*/
_this.textStrokeState_ = null;
/**
* @private
* @type {?import("../canvas.js").TextState}
*/
_this.textState_ = null;
/**
* @private
* @type {Array<number>}
*/
_this.pixelCoordinates_ = [];
/**
* @private
* @type {import("../../transform.js").Transform}
*/
_this.tmpLocalTransform_ = createTransform();
return _this;
}
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
* @private
*/
CanvasImmediateRenderer.prototype.drawImages_ = function (flatCoordinates, offset, end, stride) {
if (!this.image_) {
return;
}
var pixelCoordinates = transform2D(flatCoordinates, offset, end, stride, this.transform_, this.pixelCoordinates_);
var context = this.context_;
var localTransform = this.tmpLocalTransform_;
var alpha = context.globalAlpha;
if (this.imageOpacity_ != 1) {
context.globalAlpha = alpha * this.imageOpacity_;
}
var rotation = this.imageRotation_;
if (this.imageRotateWithView_) {
rotation += this.viewRotation_;
}
for (var i = 0, ii = pixelCoordinates.length; i < ii; i += 2) {
var x = pixelCoordinates[i] - this.imageAnchorX_;
var y = pixelCoordinates[i + 1] - this.imageAnchorY_;
if (rotation !== 0 ||
this.imageScale_[0] != 1 ||
this.imageScale_[1] != 1) {
var centerX = x + this.imageAnchorX_;
var centerY = y + this.imageAnchorY_;
composeTransform(localTransform, centerX, centerY, 1, 1, rotation, -centerX, -centerY);
context.setTransform.apply(context, localTransform);
context.translate(centerX, centerY);
context.scale(this.imageScale_[0], this.imageScale_[1]);
context.drawImage(this.image_, this.imageOriginX_, this.imageOriginY_, this.imageWidth_, this.imageHeight_, -this.imageAnchorX_, -this.imageAnchorY_, this.imageWidth_, this.imageHeight_);
context.setTransform(1, 0, 0, 1, 0, 0);
}
else {
context.drawImage(this.image_, this.imageOriginX_, this.imageOriginY_, this.imageWidth_, this.imageHeight_, x, y, this.imageWidth_, this.imageHeight_);
}
}
if (this.imageOpacity_ != 1) {
context.globalAlpha = alpha;
}
};
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
* @private
*/
CanvasImmediateRenderer.prototype.drawText_ = function (flatCoordinates, offset, end, stride) {
if (!this.textState_ || this.text_ === '') {
return;
}
if (this.textFillState_) {
this.setContextFillState_(this.textFillState_);
}
if (this.textStrokeState_) {
this.setContextStrokeState_(this.textStrokeState_);
}
this.setContextTextState_(this.textState_);
var pixelCoordinates = transform2D(flatCoordinates, offset, end, stride, this.transform_, this.pixelCoordinates_);
var context = this.context_;
var rotation = this.textRotation_;
if (this.textRotateWithView_) {
rotation += this.viewRotation_;
}
for (; offset < end; offset += stride) {
var x = pixelCoordinates[offset] + this.textOffsetX_;
var y = pixelCoordinates[offset + 1] + this.textOffsetY_;
if (rotation !== 0 ||
this.textScale_[0] != 1 ||
this.textScale_[1] != 1) {
var localTransform = composeTransform(this.tmpLocalTransform_, x, y, 1, 1, rotation, -x, -y);
context.setTransform.apply(context, localTransform);
context.translate(x, y);
context.scale(this.textScale_[0], this.textScale_[1]);
if (this.textStrokeState_) {
context.strokeText(this.text_, 0, 0);
}
if (this.textFillState_) {
context.fillText(this.text_, 0, 0);
}
context.setTransform(1, 0, 0, 1, 0, 0);
}
else {
if (this.textStrokeState_) {
context.strokeText(this.text_, x, y);
}
if (this.textFillState_) {
context.fillText(this.text_, x, y);
}
}
}
};
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
* @param {boolean} close Close.
* @private
* @return {number} end End.
*/
CanvasImmediateRenderer.prototype.moveToLineTo_ = function (flatCoordinates, offset, end, stride, close) {
var context = this.context_;
var pixelCoordinates = transform2D(flatCoordinates, offset, end, stride, this.transform_, this.pixelCoordinates_);
context.moveTo(pixelCoordinates[0], pixelCoordinates[1]);
var length = pixelCoordinates.length;
if (close) {
length -= 2;
}
for (var i = 2; i < length; i += 2) {
context.lineTo(pixelCoordinates[i], pixelCoordinates[i + 1]);
}
if (close) {
context.closePath();
}
return end;
};
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {Array<number>} ends Ends.
* @param {number} stride Stride.
* @private
* @return {number} End.
*/
CanvasImmediateRenderer.prototype.drawRings_ = function (flatCoordinates, offset, ends, stride) {
for (var i = 0, ii = ends.length; i < ii; ++i) {
offset = this.moveToLineTo_(flatCoordinates, offset, ends[i], stride, true);
}
return offset;
};
/**
* Render a circle geometry into the canvas. Rendering is immediate and uses
* the current fill and stroke styles.
*
* @param {import("../../geom/Circle.js").default} geometry Circle geometry.
* @api
*/
CanvasImmediateRenderer.prototype.drawCircle = function (geometry) {
if (!intersects(this.extent_, geometry.getExtent())) {
return;
}
if (this.fillState_ || this.strokeState_) {
if (this.fillState_) {
this.setContextFillState_(this.fillState_);
}
if (this.strokeState_) {
this.setContextStrokeState_(this.strokeState_);
}
var pixelCoordinates = transformGeom2D(geometry, this.transform_, this.pixelCoordinates_);
var dx = pixelCoordinates[2] - pixelCoordinates[0];
var dy = pixelCoordinates[3] - pixelCoordinates[1];
var radius = Math.sqrt(dx * dx + dy * dy);
var context = this.context_;
context.beginPath();
context.arc(pixelCoordinates[0], pixelCoordinates[1], radius, 0, 2 * Math.PI);
if (this.fillState_) {
context.fill();
}
if (this.strokeState_) {
context.stroke();
}
}
if (this.text_ !== '') {
this.drawText_(geometry.getCenter(), 0, 2, 2);
}
};
/**
* Set the rendering style. Note that since this is an immediate rendering API,
* any `zIndex` on the provided style will be ignored.
*
* @param {import("../../style/Style.js").default} style The rendering style.
* @api
*/
CanvasImmediateRenderer.prototype.setStyle = function (style) {
this.setFillStrokeStyle(style.getFill(), style.getStroke());
this.setImageStyle(style.getImage());
this.setTextStyle(style.getText());
};
/**
* @param {import("../../transform.js").Transform} transform Transform.
*/
CanvasImmediateRenderer.prototype.setTransform = function (transform) {
this.transform_ = transform;
};
/**
* Render a geometry into the canvas. Call
* {@link module:ol/render/canvas/Immediate~CanvasImmediateRenderer#setStyle renderer.setStyle()} first to set the rendering style.
*
* @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry The geometry to render.
* @api
*/
CanvasImmediateRenderer.prototype.drawGeometry = function (geometry) {
var type = geometry.getType();
switch (type) {
case 'Point':
this.drawPoint(
/** @type {import("../../geom/Point.js").default} */ (geometry));
break;
case 'LineString':
this.drawLineString(
/** @type {import("../../geom/LineString.js").default} */ (geometry));
break;
case 'Polygon':
this.drawPolygon(
/** @type {import("../../geom/Polygon.js").default} */ (geometry));
break;
case 'MultiPoint':
this.drawMultiPoint(
/** @type {import("../../geom/MultiPoint.js").default} */ (geometry));
break;
case 'MultiLineString':
this.drawMultiLineString(
/** @type {import("../../geom/MultiLineString.js").default} */ (geometry));
break;
case 'MultiPolygon':
this.drawMultiPolygon(
/** @type {import("../../geom/MultiPolygon.js").default} */ (geometry));
break;
case 'GeometryCollection':
this.drawGeometryCollection(
/** @type {import("../../geom/GeometryCollection.js").default} */ (geometry));
break;
case 'Circle':
this.drawCircle(
/** @type {import("../../geom/Circle.js").default} */ (geometry));
break;
default:
}
};
/**
* Render a feature into the canvas. Note that any `zIndex` on the provided
* style will be ignored - features are rendered immediately in the order that
* this method is called. If you need `zIndex` support, you should be using an
* {@link module:ol/layer/Vector~VectorLayer VectorLayer} instead.
*
* @param {import("../../Feature.js").default} feature Feature.
* @param {import("../../style/Style.js").default} style Style.
* @api
*/
CanvasImmediateRenderer.prototype.drawFeature = function (feature, style) {
var geometry = style.getGeometryFunction()(feature);
if (!geometry || !intersects(this.extent_, geometry.getExtent())) {
return;
}
this.setStyle(style);
this.drawGeometry(geometry);
};
/**
* Render a GeometryCollection to the canvas. Rendering is immediate and
* uses the current styles appropriate for each geometry in the collection.
*
* @param {import("../../geom/GeometryCollection.js").default} geometry Geometry collection.
*/
CanvasImmediateRenderer.prototype.drawGeometryCollection = function (geometry) {
var geometries = geometry.getGeometriesArray();
for (var i = 0, ii = geometries.length; i < ii; ++i) {
this.drawGeometry(geometries[i]);
}
};
/**
* Render a Point geometry into the canvas. Rendering is immediate and uses
* the current style.
*
* @param {import("../../geom/Point.js").default|import("../Feature.js").default} geometry Point geometry.
*/
CanvasImmediateRenderer.prototype.drawPoint = function (geometry) {
if (this.squaredTolerance_) {
geometry = /** @type {import("../../geom/Point.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
}
var flatCoordinates = geometry.getFlatCoordinates();
var stride = geometry.getStride();
if (this.image_) {
this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);
}
if (this.text_ !== '') {
this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride);
}
};
/**
* Render a MultiPoint geometry into the canvas. Rendering is immediate and
* uses the current style.
*
* @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} geometry MultiPoint geometry.
*/
CanvasImmediateRenderer.prototype.drawMultiPoint = function (geometry) {
if (this.squaredTolerance_) {
geometry = /** @type {import("../../geom/MultiPoint.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
}
var flatCoordinates = geometry.getFlatCoordinates();
var stride = geometry.getStride();
if (this.image_) {
this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);
}
if (this.text_ !== '') {
this.drawText_(flatCoordinates, 0, flatCoordinates.length, stride);
}
};
/**
* Render a LineString into the canvas. Rendering is immediate and uses
* the current style.
*
* @param {import("../../geom/LineString.js").default|import("../Feature.js").default} geometry LineString geometry.
*/
CanvasImmediateRenderer.prototype.drawLineString = function (geometry) {
if (this.squaredTolerance_) {
geometry = /** @type {import("../../geom/LineString.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
}
if (!intersects(this.extent_, geometry.getExtent())) {
return;
}
if (this.strokeState_) {
this.setContextStrokeState_(this.strokeState_);
var context = this.context_;
var flatCoordinates = geometry.getFlatCoordinates();
context.beginPath();
this.moveToLineTo_(flatCoordinates, 0, flatCoordinates.length, geometry.getStride(), false);
context.stroke();
}
if (this.text_ !== '') {
var flatMidpoint = geometry.getFlatMidpoint();
this.drawText_(flatMidpoint, 0, 2, 2);
}
};
/**
* Render a MultiLineString geometry into the canvas. Rendering is immediate
* and uses the current style.
*
* @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} geometry MultiLineString geometry.
*/
CanvasImmediateRenderer.prototype.drawMultiLineString = function (geometry) {
if (this.squaredTolerance_) {
geometry =
/** @type {import("../../geom/MultiLineString.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
}
var geometryExtent = geometry.getExtent();
if (!intersects(this.extent_, geometryExtent)) {
return;
}
if (this.strokeState_) {
this.setContextStrokeState_(this.strokeState_);
var context = this.context_;
var flatCoordinates = geometry.getFlatCoordinates();
var offset = 0;
var ends = /** @type {Array<number>} */ (geometry.getEnds());
var stride = geometry.getStride();
context.beginPath();
for (var i = 0, ii = ends.length; i < ii; ++i) {
offset = this.moveToLineTo_(flatCoordinates, offset, ends[i], stride, false);
}
context.stroke();
}
if (this.text_ !== '') {
var flatMidpoints = geometry.getFlatMidpoints();
this.drawText_(flatMidpoints, 0, flatMidpoints.length, 2);
}
};
/**
* Render a Polygon geometry into the canvas. Rendering is immediate and uses
* the current style.
*
* @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} geometry Polygon geometry.
*/
CanvasImmediateRenderer.prototype.drawPolygon = function (geometry) {
if (this.squaredTolerance_) {
geometry = /** @type {import("../../geom/Polygon.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
}
if (!intersects(this.extent_, geometry.getExtent())) {
return;
}
if (this.strokeState_ || this.fillState_) {
if (this.fillState_) {
this.setContextFillState_(this.fillState_);
}
if (this.strokeState_) {
this.setContextStrokeState_(this.strokeState_);
}
var context = this.context_;
context.beginPath();
this.drawRings_(geometry.getOrientedFlatCoordinates(), 0,
/** @type {Array<number>} */ (geometry.getEnds()), geometry.getStride());
if (this.fillState_) {
context.fill();
}
if (this.strokeState_) {
context.stroke();
}
}
if (this.text_ !== '') {
var flatInteriorPoint = geometry.getFlatInteriorPoint();
this.drawText_(flatInteriorPoint, 0, 2, 2);
}
};
/**
* Render MultiPolygon geometry into the canvas. Rendering is immediate and
* uses the current style.
* @param {import("../../geom/MultiPolygon.js").default} geometry MultiPolygon geometry.
*/
CanvasImmediateRenderer.prototype.drawMultiPolygon = function (geometry) {
if (this.squaredTolerance_) {
geometry = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry.simplifyTransformed(this.squaredTolerance_, this.userTransform_));
}
if (!intersects(this.extent_, geometry.getExtent())) {
return;
}
if (this.strokeState_ || this.fillState_) {
if (this.fillState_) {
this.setContextFillState_(this.fillState_);
}
if (this.strokeState_) {
this.setContextStrokeState_(this.strokeState_);
}
var context = this.context_;
var flatCoordinates = geometry.getOrientedFlatCoordinates();
var offset = 0;
var endss = geometry.getEndss();
var stride = geometry.getStride();
context.beginPath();
for (var i = 0, ii = endss.length; i < ii; ++i) {
var ends = endss[i];
offset = this.drawRings_(flatCoordinates, offset, ends, stride);
}
if (this.fillState_) {
context.fill();
}
if (this.strokeState_) {
context.stroke();
}
}
if (this.text_ !== '') {
var flatInteriorPoints = geometry.getFlatInteriorPoints();
this.drawText_(flatInteriorPoints, 0, flatInteriorPoints.length, 2);
}
};
/**
* @param {import("../canvas.js").FillState} fillState Fill state.
* @private
*/
CanvasImmediateRenderer.prototype.setContextFillState_ = function (fillState) {
var context = this.context_;
var contextFillState = this.contextFillState_;
if (!contextFillState) {
context.fillStyle = fillState.fillStyle;
this.contextFillState_ = {
fillStyle: fillState.fillStyle,
};
}
else {
if (contextFillState.fillStyle != fillState.fillStyle) {
contextFillState.fillStyle = fillState.fillStyle;
context.fillStyle = fillState.fillStyle;
}
}
};
/**
* @param {import("../canvas.js").StrokeState} strokeState Stroke state.
* @private
*/
CanvasImmediateRenderer.prototype.setContextStrokeState_ = function (strokeState) {
var context = this.context_;
var contextStrokeState = this.contextStrokeState_;
if (!contextStrokeState) {
context.lineCap = strokeState.lineCap;
if (context.setLineDash) {
context.setLineDash(strokeState.lineDash);
context.lineDashOffset = strokeState.lineDashOffset;
}
context.lineJoin = strokeState.lineJoin;
context.lineWidth = strokeState.lineWidth;
context.miterLimit = strokeState.miterLimit;
context.strokeStyle = strokeState.strokeStyle;
this.contextStrokeState_ = {
lineCap: strokeState.lineCap,
lineDash: strokeState.lineDash,
lineDashOffset: strokeState.lineDashOffset,
lineJoin: strokeState.lineJoin,
lineWidth: strokeState.lineWidth,
miterLimit: strokeState.miterLimit,
strokeStyle: strokeState.strokeStyle,
};
}
else {
if (contextStrokeState.lineCap != strokeState.lineCap) {
contextStrokeState.lineCap = strokeState.lineCap;
context.lineCap = strokeState.lineCap;
}
if (context.setLineDash) {
if (!equals(contextStrokeState.lineDash, strokeState.lineDash)) {
context.setLineDash((contextStrokeState.lineDash = strokeState.lineDash));
}
if (contextStrokeState.lineDashOffset != strokeState.lineDashOffset) {
contextStrokeState.lineDashOffset = strokeState.lineDashOffset;
context.lineDashOffset = strokeState.lineDashOffset;
}
}
if (contextStrokeState.lineJoin != strokeState.lineJoin) {
contextStrokeState.lineJoin = strokeState.lineJoin;
context.lineJoin = strokeState.lineJoin;
}
if (contextStrokeState.lineWidth != strokeState.lineWidth) {
contextStrokeState.lineWidth = strokeState.lineWidth;
context.lineWidth = strokeState.lineWidth;
}
if (contextStrokeState.miterLimit != strokeState.miterLimit) {
contextStrokeState.miterLimit = strokeState.miterLimit;
context.miterLimit = strokeState.miterLimit;
}
if (contextStrokeState.strokeStyle != strokeState.strokeStyle) {
contextStrokeState.strokeStyle = strokeState.strokeStyle;
context.strokeStyle = strokeState.strokeStyle;
}
}
};
/**
* @param {import("../canvas.js").TextState} textState Text state.
* @private
*/
CanvasImmediateRenderer.prototype.setContextTextState_ = function (textState) {
var context = this.context_;
var contextTextState = this.contextTextState_;
var textAlign = textState.textAlign
? textState.textAlign
: defaultTextAlign;
if (!contextTextState) {
context.font = textState.font;
context.textAlign = /** @type {CanvasTextAlign} */ (textAlign);
context.textBaseline = /** @type {CanvasTextBaseline} */ (textState.textBaseline);
this.contextTextState_ = {
font: textState.font,
textAlign: textAlign,
textBaseline: textState.textBaseline,
};
}
else {
if (contextTextState.font != textState.font) {
contextTextState.font = textState.font;
context.font = textState.font;
}
if (contextTextState.textAlign != textAlign) {
contextTextState.textAlign = /** @type {CanvasTextAlign} */ (textAlign);
context.textAlign = /** @type {CanvasTextAlign} */ (textAlign);
}
if (contextTextState.textBaseline != textState.textBaseline) {
contextTextState.textBaseline = /** @type {CanvasTextBaseline} */ (textState.textBaseline);
context.textBaseline = /** @type {CanvasTextBaseline} */ (textState.textBaseline);
}
}
};
/**
* Set the fill and stroke style for subsequent draw operations. To clear
* either fill or stroke styles, pass null for the appropriate parameter.
*
* @param {import("../../style/Fill.js").default} fillStyle Fill style.
* @param {import("../../style/Stroke.js").default} strokeStyle Stroke style.
*/
CanvasImmediateRenderer.prototype.setFillStrokeStyle = function (fillStyle, strokeStyle) {
var _this = this;
if (!fillStyle) {
this.fillState_ = null;
}
else {
var fillStyleColor = fillStyle.getColor();
this.fillState_ = {
fillStyle: asColorLike(fillStyleColor ? fillStyleColor : defaultFillStyle),
};
}
if (!strokeStyle) {
this.strokeState_ = null;
}
else {
var strokeStyleColor = strokeStyle.getColor();
var strokeStyleLineCap = strokeStyle.getLineCap();
var strokeStyleLineDash = strokeStyle.getLineDash();
var strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();
var strokeStyleLineJoin = strokeStyle.getLineJoin();
var strokeStyleWidth = strokeStyle.getWidth();
var strokeStyleMiterLimit = strokeStyle.getMiterLimit();
var lineDash = strokeStyleLineDash
? strokeStyleLineDash
: defaultLineDash;
this.strokeState_ = {
lineCap: strokeStyleLineCap !== undefined
? strokeStyleLineCap
: defaultLineCap,
lineDash: this.pixelRatio_ === 1
? lineDash
: lineDash.map(function (n) { return n * _this.pixelRatio_; }),
lineDashOffset: (strokeStyleLineDashOffset
? strokeStyleLineDashOffset
: defaultLineDashOffset) * this.pixelRatio_,
lineJoin: strokeStyleLineJoin !== undefined
? strokeStyleLineJoin
: defaultLineJoin,
lineWidth: (strokeStyleWidth !== undefined
? strokeStyleWidth
: defaultLineWidth) * this.pixelRatio_,
miterLimit: strokeStyleMiterLimit !== undefined
? strokeStyleMiterLimit
: defaultMiterLimit,
strokeStyle: asColorLike(strokeStyleColor ? strokeStyleColor : defaultStrokeStyle),
};
}
};
/**
* Set the image style for subsequent draw operations. Pass null to remove
* the image style.
*
* @param {import("../../style/Image.js").default} imageStyle Image style.
*/
CanvasImmediateRenderer.prototype.setImageStyle = function (imageStyle) {
var imageSize;
if (!imageStyle || !(imageSize = imageStyle.getSize())) {
this.image_ = null;
return;
}
var imageAnchor = imageStyle.getAnchor();
var imageOrigin = imageStyle.getOrigin();
this.image_ = imageStyle.getImage(this.pixelRatio_);
this.imageAnchorX_ = imageAnchor[0] * this.pixelRatio_;
this.imageAnchorY_ = imageAnchor[1] * this.pixelRatio_;
this.imageHeight_ = imageSize[1] * this.pixelRatio_;
this.imageOpacity_ = imageStyle.getOpacity();
this.imageOriginX_ = imageOrigin[0];
this.imageOriginY_ = imageOrigin[1];
this.imageRotateWithView_ = imageStyle.getRotateWithView();
this.imageRotation_ = imageStyle.getRotation();
this.imageScale_ = imageStyle.getScaleArray();
this.imageWidth_ = imageSize[0] * this.pixelRatio_;
};
/**
* Set the text style for subsequent draw operations. Pass null to
* remove the text style.
*
* @param {import("../../style/Text.js").default} textStyle Text style.
*/
CanvasImmediateRenderer.prototype.setTextStyle = function (textStyle) {
if (!textStyle) {
this.text_ = '';
}
else {
var textFillStyle = textStyle.getFill();
if (!textFillStyle) {
this.textFillState_ = null;
}
else {
var textFillStyleColor = textFillStyle.getColor();
this.textFillState_ = {
fillStyle: asColorLike(textFillStyleColor ? textFillStyleColor : defaultFillStyle),
};
}
var textStrokeStyle = textStyle.getStroke();
if (!textStrokeStyle) {
this.textStrokeState_ = null;
}
else {
var textStrokeStyleColor = textStrokeStyle.getColor();
var textStrokeStyleLineCap = textStrokeStyle.getLineCap();
var textStrokeStyleLineDash = textStrokeStyle.getLineDash();
var textStrokeStyleLineDashOffset = textStrokeStyle.getLineDashOffset();
var textStrokeStyleLineJoin = textStrokeStyle.getLineJoin();
var textStrokeStyleWidth = textStrokeStyle.getWidth();
var textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit();
this.textStrokeState_ = {
lineCap: textStrokeStyleLineCap !== undefined
? textStrokeStyleLineCap
: defaultLineCap,
lineDash: textStrokeStyleLineDash
? textStrokeStyleLineDash
: defaultLineDash,
lineDashOffset: textStrokeStyleLineDashOffset
? textStrokeStyleLineDashOffset
: defaultLineDashOffset,
lineJoin: textStrokeStyleLineJoin !== undefined
? textStrokeStyleLineJoin
: defaultLineJoin,
lineWidth: textStrokeStyleWidth !== undefined
? textStrokeStyleWidth
: defaultLineWidth,
miterLimit: textStrokeStyleMiterLimit !== undefined
? textStrokeStyleMiterLimit
: defaultMiterLimit,
strokeStyle: asColorLike(textStrokeStyleColor ? textStrokeStyleColor : defaultStrokeStyle),
};
}
var textFont = textStyle.getFont();
var textOffsetX = textStyle.getOffsetX();
var textOffsetY = textStyle.getOffsetY();
var textRotateWithView = textStyle.getRotateWithView();
var textRotation = textStyle.getRotation();
var textScale = textStyle.getScaleArray();
var textText = textStyle.getText();
var textTextAlign = textStyle.getTextAlign();
var textTextBaseline = textStyle.getTextBaseline();
this.textState_ = {
font: textFont !== undefined ? textFont : defaultFont,
textAlign: textTextAlign !== undefined ? textTextAlign : defaultTextAlign,
textBaseline: textTextBaseline !== undefined
? textTextBaseline
: defaultTextBaseline,
};
this.text_ =
textText !== undefined
? Array.isArray(textText)
? textText.reduce(function (acc, t, i) { return (acc += i % 2 ? ' ' : t); }, '')
: textText
: '';
this.textOffsetX_ =
textOffsetX !== undefined ? this.pixelRatio_ * textOffsetX : 0;
this.textOffsetY_ =
textOffsetY !== undefined ? this.pixelRatio_ * textOffsetY : 0;
this.textRotateWithView_ =
textRotateWithView !== undefined ? textRotateWithView : false;
this.textRotation_ = textRotation !== undefined ? textRotation : 0;
this.textScale_ = [
this.pixelRatio_ * textScale[0],
this.pixelRatio_ * textScale[1],
];
}
};
return CanvasImmediateRenderer;
}(VectorContext));
export default CanvasImmediateRenderer;
//# sourceMappingURL=Immediate.js.map

1
node_modules/ol/render/canvas/Immediate.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

34
node_modules/ol/render/canvas/Instruction.d.ts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
/**
* @type {Array<Instruction>}
*/
export const fillInstruction: Array<Instruction>;
/**
* @type {Array<Instruction>}
*/
export const strokeInstruction: Array<Instruction>;
/**
* @type {Array<Instruction>}
*/
export const beginPathInstruction: Array<Instruction>;
/**
* @type {Array<Instruction>}
*/
export const closePathInstruction: Array<Instruction>;
export default Instruction;
type Instruction = number;
declare namespace Instruction {
const BEGIN_GEOMETRY: number;
const BEGIN_PATH: number;
const CIRCLE: number;
const CLOSE_PATH: number;
const CUSTOM: number;
const DRAW_CHARS: number;
const DRAW_IMAGE: number;
const END_GEOMETRY: number;
const FILL: number;
const MOVE_TO_LINE_TO: number;
const SET_FILL_STYLE: number;
const SET_STROKE_STYLE: number;
const STROKE: number;
}
//# sourceMappingURL=Instruction.d.ts.map

1
node_modules/ol/render/canvas/Instruction.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Instruction.d.ts","sourceRoot":"","sources":["../../src/render/canvas/Instruction.js"],"names":[],"mappings":"AAuBA;;GAEG;AACH,8BAFU,MAAM,WAAW,CAAC,CAEsB;AAElD;;GAEG;AACH,gCAFU,MAAM,WAAW,CAAC,CAE0B;AAEtD;;GAEG;AACH,mCAFU,MAAM,WAAW,CAAC,CAEiC;AAE7D;;GAEG;AACH,mCAFU,MAAM,WAAW,CAAC,CAEiC;;mBApCnD,MAAM"}

39
node_modules/ol/render/canvas/Instruction.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
/**
* @module ol/render/canvas/Instruction
*/
/**
* @enum {number}
*/
var Instruction = {
BEGIN_GEOMETRY: 0,
BEGIN_PATH: 1,
CIRCLE: 2,
CLOSE_PATH: 3,
CUSTOM: 4,
DRAW_CHARS: 5,
DRAW_IMAGE: 6,
END_GEOMETRY: 7,
FILL: 8,
MOVE_TO_LINE_TO: 9,
SET_FILL_STYLE: 10,
SET_STROKE_STYLE: 11,
STROKE: 12,
};
/**
* @type {Array<Instruction>}
*/
export var fillInstruction = [Instruction.FILL];
/**
* @type {Array<Instruction>}
*/
export var strokeInstruction = [Instruction.STROKE];
/**
* @type {Array<Instruction>}
*/
export var beginPathInstruction = [Instruction.BEGIN_PATH];
/**
* @type {Array<Instruction>}
*/
export var closePathInstruction = [Instruction.CLOSE_PATH];
export default Instruction;
//# sourceMappingURL=Instruction.js.map

1
node_modules/ol/render/canvas/Instruction.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"Instruction.js","sourceRoot":"","sources":["../../src/render/canvas/Instruction.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,IAAM,WAAW,GAAG;IAClB,cAAc,EAAE,CAAC;IACjB,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,CAAC;IACT,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,CAAC;IACT,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,CAAC;IACb,YAAY,EAAE,CAAC;IACf,IAAI,EAAE,CAAC;IACP,eAAe,EAAE,CAAC;IAClB,cAAc,EAAE,EAAE;IAClB,gBAAgB,EAAE,EAAE;IACpB,MAAM,EAAE,EAAE;CACX,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,IAAM,iBAAiB,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAEtD;;GAEG;AACH,MAAM,CAAC,IAAM,oBAAoB,GAAG,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,CAAC,IAAM,oBAAoB,GAAG,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAE7D,eAAe,WAAW,CAAC"}

14
node_modules/ol/render/canvas/LineStringBuilder.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
export default CanvasLineStringBuilder;
declare class CanvasLineStringBuilder extends CanvasBuilder {
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
* @private
* @return {number} end.
*/
private drawFlatCoordinates_;
}
import CanvasBuilder from "./Builder.js";
//# sourceMappingURL=LineStringBuilder.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LineStringBuilder.d.ts","sourceRoot":"","sources":["../../src/render/canvas/LineStringBuilder.js"],"names":[],"mappings":";AAUA;IAWE;;;;;;;OAOG;IACH,6BAkBC;CAiHF"}

145
node_modules/ol/render/canvas/LineStringBuilder.js generated vendored Normal file
View File

@@ -0,0 +1,145 @@
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/render/canvas/LineStringBuilder
*/
import CanvasBuilder from './Builder.js';
import CanvasInstruction, { beginPathInstruction, strokeInstruction, } from './Instruction.js';
import { defaultLineDash, defaultLineDashOffset } from '../canvas.js';
var CanvasLineStringBuilder = /** @class */ (function (_super) {
__extends(CanvasLineStringBuilder, _super);
/**
* @param {number} tolerance Tolerance.
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
*/
function CanvasLineStringBuilder(tolerance, maxExtent, resolution, pixelRatio) {
return _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this;
}
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
* @private
* @return {number} end.
*/
CanvasLineStringBuilder.prototype.drawFlatCoordinates_ = function (flatCoordinates, offset, end, stride) {
var myBegin = this.coordinates.length;
var myEnd = this.appendFlatLineCoordinates(flatCoordinates, offset, end, stride, false, false);
var moveToLineToInstruction = [
CanvasInstruction.MOVE_TO_LINE_TO,
myBegin,
myEnd,
];
this.instructions.push(moveToLineToInstruction);
this.hitDetectionInstructions.push(moveToLineToInstruction);
return end;
};
/**
* @param {import("../../geom/LineString.js").default|import("../Feature.js").default} lineStringGeometry Line string geometry.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
*/
CanvasLineStringBuilder.prototype.drawLineString = function (lineStringGeometry, feature) {
var state = this.state;
var strokeStyle = state.strokeStyle;
var lineWidth = state.lineWidth;
if (strokeStyle === undefined || lineWidth === undefined) {
return;
}
this.updateStrokeStyle(state, this.applyStroke);
this.beginGeometry(lineStringGeometry, feature);
this.hitDetectionInstructions.push([
CanvasInstruction.SET_STROKE_STYLE,
state.strokeStyle,
state.lineWidth,
state.lineCap,
state.lineJoin,
state.miterLimit,
defaultLineDash,
defaultLineDashOffset,
], beginPathInstruction);
var flatCoordinates = lineStringGeometry.getFlatCoordinates();
var stride = lineStringGeometry.getStride();
this.drawFlatCoordinates_(flatCoordinates, 0, flatCoordinates.length, stride);
this.hitDetectionInstructions.push(strokeInstruction);
this.endGeometry(feature);
};
/**
* @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} multiLineStringGeometry MultiLineString geometry.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
*/
CanvasLineStringBuilder.prototype.drawMultiLineString = function (multiLineStringGeometry, feature) {
var state = this.state;
var strokeStyle = state.strokeStyle;
var lineWidth = state.lineWidth;
if (strokeStyle === undefined || lineWidth === undefined) {
return;
}
this.updateStrokeStyle(state, this.applyStroke);
this.beginGeometry(multiLineStringGeometry, feature);
this.hitDetectionInstructions.push([
CanvasInstruction.SET_STROKE_STYLE,
state.strokeStyle,
state.lineWidth,
state.lineCap,
state.lineJoin,
state.miterLimit,
state.lineDash,
state.lineDashOffset,
], beginPathInstruction);
var ends = multiLineStringGeometry.getEnds();
var flatCoordinates = multiLineStringGeometry.getFlatCoordinates();
var stride = multiLineStringGeometry.getStride();
var offset = 0;
for (var i = 0, ii = ends.length; i < ii; ++i) {
offset = this.drawFlatCoordinates_(flatCoordinates, offset,
/** @type {number} */ (ends[i]), stride);
}
this.hitDetectionInstructions.push(strokeInstruction);
this.endGeometry(feature);
};
/**
* @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
*/
CanvasLineStringBuilder.prototype.finish = function () {
var state = this.state;
if (state.lastStroke != undefined &&
state.lastStroke != this.coordinates.length) {
this.instructions.push(strokeInstruction);
}
this.reverseHitDetectionInstructions();
this.state = null;
return _super.prototype.finish.call(this);
};
/**
* @param {import("../canvas.js").FillStrokeState} state State.
*/
CanvasLineStringBuilder.prototype.applyStroke = function (state) {
if (state.lastStroke != undefined &&
state.lastStroke != this.coordinates.length) {
this.instructions.push(strokeInstruction);
state.lastStroke = this.coordinates.length;
}
state.lastStroke = 0;
_super.prototype.applyStroke.call(this, state);
this.instructions.push(beginPathInstruction);
};
return CanvasLineStringBuilder;
}(CanvasBuilder));
export default CanvasLineStringBuilder;
//# sourceMappingURL=LineStringBuilder.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"LineStringBuilder.js","sourceRoot":"","sources":["../../src/render/canvas/LineStringBuilder.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,aAAa,MAAM,cAAc,CAAC;AACzC,OAAO,iBAAiB,EAAE,EACxB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,eAAe,EAAE,qBAAqB,EAAC,MAAM,cAAc,CAAC;AAEpE;IAAsC,2CAAa;IACjD;;;;;OAKG;IACH,iCAAY,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU;eACtD,kBAAM,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC;IACrD,CAAC;IAED;;;;;;;OAOG;IACH,sDAAoB,GAApB,UAAqB,eAAe,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;QACvD,IAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;QACxC,IAAM,KAAK,GAAG,IAAI,CAAC,yBAAyB,CAC1C,eAAe,EACf,MAAM,EACN,GAAG,EACH,MAAM,EACN,KAAK,EACL,KAAK,CACN,CAAC;QACF,IAAM,uBAAuB,GAAG;YAC9B,iBAAiB,CAAC,eAAe;YACjC,OAAO;YACP,KAAK;SACN,CAAC;QACF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAChD,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAC5D,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;OAGG;IACH,gDAAc,GAAd,UAAe,kBAAkB,EAAE,OAAO;QACxC,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACtC,IAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QAClC,IAAI,WAAW,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,EAAE;YACxD,OAAO;SACR;QACD,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAChD,IAAI,CAAC,aAAa,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAChC;YACE,iBAAiB,CAAC,gBAAgB;YAClC,KAAK,CAAC,WAAW;YACjB,KAAK,CAAC,SAAS;YACf,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,QAAQ;YACd,KAAK,CAAC,UAAU;YAChB,eAAe;YACf,qBAAqB;SACtB,EACD,oBAAoB,CACrB,CAAC;QACF,IAAM,eAAe,GAAG,kBAAkB,CAAC,kBAAkB,EAAE,CAAC;QAChE,IAAM,MAAM,GAAG,kBAAkB,CAAC,SAAS,EAAE,CAAC;QAC9C,IAAI,CAAC,oBAAoB,CACvB,eAAe,EACf,CAAC,EACD,eAAe,CAAC,MAAM,EACtB,MAAM,CACP,CAAC;QACF,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACtD,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,qDAAmB,GAAnB,UAAoB,uBAAuB,EAAE,OAAO;QAClD,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACtC,IAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QAClC,IAAI,WAAW,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,EAAE;YACxD,OAAO;SACR;QACD,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAChD,IAAI,CAAC,aAAa,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;QACrD,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAChC;YACE,iBAAiB,CAAC,gBAAgB;YAClC,KAAK,CAAC,WAAW;YACjB,KAAK,CAAC,SAAS;YACf,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,QAAQ;YACd,KAAK,CAAC,UAAU;YAChB,KAAK,CAAC,QAAQ;YACd,KAAK,CAAC,cAAc;SACrB,EACD,oBAAoB,CACrB,CAAC;QACF,IAAM,IAAI,GAAG,uBAAuB,CAAC,OAAO,EAAE,CAAC;QAC/C,IAAM,eAAe,GAAG,uBAAuB,CAAC,kBAAkB,EAAE,CAAC;QACrE,IAAM,MAAM,GAAG,uBAAuB,CAAC,SAAS,EAAE,CAAC;QACnD,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE;YAC7C,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAChC,eAAe,EACf,MAAM;YACN,qBAAqB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAC/B,MAAM,CACP,CAAC;SACH;QACD,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACtD,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,wCAAM,GAAN;QACE,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IACE,KAAK,CAAC,UAAU,IAAI,SAAS;YAC7B,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,EAC3C;YACA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;SAC3C;QACD,IAAI,CAAC,+BAA+B,EAAE,CAAC;QACvC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,OAAO,iBAAM,MAAM,WAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,6CAAW,GAAX,UAAY,KAAK;QACf,IACE,KAAK,CAAC,UAAU,IAAI,SAAS;YAC7B,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,EAC3C;YACA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAC1C,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;SAC5C;QACD,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC;QACrB,iBAAM,WAAW,YAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAC/C,CAAC;IACH,8BAAC;AAAD,CAAC,AAtJD,CAAsC,aAAa,GAsJlD;AAED,eAAe,uBAAuB,CAAC"}

18
node_modules/ol/render/canvas/PolygonBuilder.d.ts generated vendored Normal file
View File

@@ -0,0 +1,18 @@
export default CanvasPolygonBuilder;
declare class CanvasPolygonBuilder extends CanvasBuilder {
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {Array<number>} ends Ends.
* @param {number} stride Stride.
* @private
* @return {number} End.
*/
private drawFlatCoordinatess_;
/**
* @private
*/
private setFillStrokeStyles_;
}
import CanvasBuilder from "./Builder.js";
//# sourceMappingURL=PolygonBuilder.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PolygonBuilder.d.ts","sourceRoot":"","sources":["../../src/render/canvas/PolygonBuilder.js"],"names":[],"mappings":";AAaA;IAWE;;;;;;;OAOG;IACH,8BA0CC;IAuKD;;OAEG;IACH,6BASC;CACF"}

239
node_modules/ol/render/canvas/PolygonBuilder.js generated vendored Normal file
View File

@@ -0,0 +1,239 @@
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/render/canvas/PolygonBuilder
*/
import CanvasBuilder from './Builder.js';
import CanvasInstruction, { beginPathInstruction, closePathInstruction, fillInstruction, strokeInstruction, } from './Instruction.js';
import { defaultFillStyle } from '../canvas.js';
import { snap } from '../../geom/flat/simplify.js';
var CanvasPolygonBuilder = /** @class */ (function (_super) {
__extends(CanvasPolygonBuilder, _super);
/**
* @param {number} tolerance Tolerance.
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
*/
function CanvasPolygonBuilder(tolerance, maxExtent, resolution, pixelRatio) {
return _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this;
}
/**
* @param {Array<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {Array<number>} ends Ends.
* @param {number} stride Stride.
* @private
* @return {number} End.
*/
CanvasPolygonBuilder.prototype.drawFlatCoordinatess_ = function (flatCoordinates, offset, ends, stride) {
var state = this.state;
var fill = state.fillStyle !== undefined;
var stroke = state.strokeStyle !== undefined;
var numEnds = ends.length;
this.instructions.push(beginPathInstruction);
this.hitDetectionInstructions.push(beginPathInstruction);
for (var i = 0; i < numEnds; ++i) {
var end = ends[i];
var myBegin = this.coordinates.length;
var myEnd = this.appendFlatLineCoordinates(flatCoordinates, offset, end, stride, true, !stroke);
var moveToLineToInstruction = [
CanvasInstruction.MOVE_TO_LINE_TO,
myBegin,
myEnd,
];
this.instructions.push(moveToLineToInstruction);
this.hitDetectionInstructions.push(moveToLineToInstruction);
if (stroke) {
// Performance optimization: only call closePath() when we have a stroke.
// Otherwise the ring is closed already (see appendFlatLineCoordinates above).
this.instructions.push(closePathInstruction);
this.hitDetectionInstructions.push(closePathInstruction);
}
offset = end;
}
if (fill) {
this.instructions.push(fillInstruction);
this.hitDetectionInstructions.push(fillInstruction);
}
if (stroke) {
this.instructions.push(strokeInstruction);
this.hitDetectionInstructions.push(strokeInstruction);
}
return offset;
};
/**
* @param {import("../../geom/Circle.js").default} circleGeometry Circle geometry.
* @param {import("../../Feature.js").default} feature Feature.
*/
CanvasPolygonBuilder.prototype.drawCircle = function (circleGeometry, feature) {
var state = this.state;
var fillStyle = state.fillStyle;
var strokeStyle = state.strokeStyle;
if (fillStyle === undefined && strokeStyle === undefined) {
return;
}
this.setFillStrokeStyles_();
this.beginGeometry(circleGeometry, feature);
if (state.fillStyle !== undefined) {
this.hitDetectionInstructions.push([
CanvasInstruction.SET_FILL_STYLE,
defaultFillStyle,
]);
}
if (state.strokeStyle !== undefined) {
this.hitDetectionInstructions.push([
CanvasInstruction.SET_STROKE_STYLE,
state.strokeStyle,
state.lineWidth,
state.lineCap,
state.lineJoin,
state.miterLimit,
state.lineDash,
state.lineDashOffset,
]);
}
var flatCoordinates = circleGeometry.getFlatCoordinates();
var stride = circleGeometry.getStride();
var myBegin = this.coordinates.length;
this.appendFlatLineCoordinates(flatCoordinates, 0, flatCoordinates.length, stride, false, false);
var circleInstruction = [CanvasInstruction.CIRCLE, myBegin];
this.instructions.push(beginPathInstruction, circleInstruction);
this.hitDetectionInstructions.push(beginPathInstruction, circleInstruction);
if (state.fillStyle !== undefined) {
this.instructions.push(fillInstruction);
this.hitDetectionInstructions.push(fillInstruction);
}
if (state.strokeStyle !== undefined) {
this.instructions.push(strokeInstruction);
this.hitDetectionInstructions.push(strokeInstruction);
}
this.endGeometry(feature);
};
/**
* @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} polygonGeometry Polygon geometry.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
*/
CanvasPolygonBuilder.prototype.drawPolygon = function (polygonGeometry, feature) {
var state = this.state;
var fillStyle = state.fillStyle;
var strokeStyle = state.strokeStyle;
if (fillStyle === undefined && strokeStyle === undefined) {
return;
}
this.setFillStrokeStyles_();
this.beginGeometry(polygonGeometry, feature);
if (state.fillStyle !== undefined) {
this.hitDetectionInstructions.push([
CanvasInstruction.SET_FILL_STYLE,
defaultFillStyle,
]);
}
if (state.strokeStyle !== undefined) {
this.hitDetectionInstructions.push([
CanvasInstruction.SET_STROKE_STYLE,
state.strokeStyle,
state.lineWidth,
state.lineCap,
state.lineJoin,
state.miterLimit,
state.lineDash,
state.lineDashOffset,
]);
}
var ends = polygonGeometry.getEnds();
var flatCoordinates = polygonGeometry.getOrientedFlatCoordinates();
var stride = polygonGeometry.getStride();
this.drawFlatCoordinatess_(flatCoordinates, 0,
/** @type {Array<number>} */ (ends), stride);
this.endGeometry(feature);
};
/**
* @param {import("../../geom/MultiPolygon.js").default} multiPolygonGeometry MultiPolygon geometry.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
*/
CanvasPolygonBuilder.prototype.drawMultiPolygon = function (multiPolygonGeometry, feature) {
var state = this.state;
var fillStyle = state.fillStyle;
var strokeStyle = state.strokeStyle;
if (fillStyle === undefined && strokeStyle === undefined) {
return;
}
this.setFillStrokeStyles_();
this.beginGeometry(multiPolygonGeometry, feature);
if (state.fillStyle !== undefined) {
this.hitDetectionInstructions.push([
CanvasInstruction.SET_FILL_STYLE,
defaultFillStyle,
]);
}
if (state.strokeStyle !== undefined) {
this.hitDetectionInstructions.push([
CanvasInstruction.SET_STROKE_STYLE,
state.strokeStyle,
state.lineWidth,
state.lineCap,
state.lineJoin,
state.miterLimit,
state.lineDash,
state.lineDashOffset,
]);
}
var endss = multiPolygonGeometry.getEndss();
var flatCoordinates = multiPolygonGeometry.getOrientedFlatCoordinates();
var stride = multiPolygonGeometry.getStride();
var offset = 0;
for (var i = 0, ii = endss.length; i < ii; ++i) {
offset = this.drawFlatCoordinatess_(flatCoordinates, offset, endss[i], stride);
}
this.endGeometry(feature);
};
/**
* @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
*/
CanvasPolygonBuilder.prototype.finish = function () {
this.reverseHitDetectionInstructions();
this.state = null;
// We want to preserve topology when drawing polygons. Polygons are
// simplified using quantization and point elimination. However, we might
// have received a mix of quantized and non-quantized geometries, so ensure
// that all are quantized by quantizing all coordinates in the batch.
var tolerance = this.tolerance;
if (tolerance !== 0) {
var coordinates = this.coordinates;
for (var i = 0, ii = coordinates.length; i < ii; ++i) {
coordinates[i] = snap(coordinates[i], tolerance);
}
}
return _super.prototype.finish.call(this);
};
/**
* @private
*/
CanvasPolygonBuilder.prototype.setFillStrokeStyles_ = function () {
var state = this.state;
var fillStyle = state.fillStyle;
if (fillStyle !== undefined) {
this.updateFillStyle(state, this.createFill);
}
if (state.strokeStyle !== undefined) {
this.updateStrokeStyle(state, this.applyStroke);
}
};
return CanvasPolygonBuilder;
}(CanvasBuilder));
export default CanvasPolygonBuilder;
//# sourceMappingURL=PolygonBuilder.js.map

1
node_modules/ol/render/canvas/PolygonBuilder.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

118
node_modules/ol/render/canvas/TextBuilder.d.ts generated vendored Normal file
View File

@@ -0,0 +1,118 @@
export type TEXT_ALIGN = number;
export namespace TEXT_ALIGN {
const left: number;
const end: number;
const center: number;
const right: number;
const start: number;
const top: number;
const middle: number;
const hanging: number;
const alphabetic: number;
const ideographic: number;
const bottom: number;
}
export default CanvasTextBuilder;
declare class CanvasTextBuilder extends CanvasBuilder {
/**
* @private
* @type {Array<HTMLCanvasElement>}
*/
private labels_;
/**
* @private
* @type {string|Array<string>}
*/
private text_;
/**
* @private
* @type {number}
*/
private textOffsetX_;
/**
* @private
* @type {number}
*/
private textOffsetY_;
/**
* @private
* @type {boolean|undefined}
*/
private textRotateWithView_;
/**
* @private
* @type {number}
*/
private textRotation_;
/**
* @private
* @type {?import("../canvas.js").FillState}
*/
private textFillState_;
/**
* @type {!Object<string, import("../canvas.js").FillState>}
*/
fillStates: {
[x: string]: import("../canvas.js").FillState;
};
/**
* @private
* @type {?import("../canvas.js").StrokeState}
*/
private textStrokeState_;
/**
* @type {!Object<string, import("../canvas.js").StrokeState>}
*/
strokeStates: {
[x: string]: import("../canvas.js").StrokeState;
};
/**
* @private
* @type {import("../canvas.js").TextState}
*/
private textState_;
/**
* @type {!Object<string, import("../canvas.js").TextState>}
*/
textStates: {
[x: string]: import("../canvas.js").TextState;
};
/**
* @private
* @type {string}
*/
private textKey_;
/**
* @private
* @type {string}
*/
private fillKey_;
/**
* @private
* @type {string}
*/
private strokeKey_;
/**
* Data shared with an image builder for combined decluttering.
* @private
* @type {import("../canvas.js").DeclutterImageWithText}
*/
private declutterImageWithText_;
/**
* @private
*/
private saveTextStates_;
/**
* @private
* @param {number} begin Begin.
* @param {number} end End.
*/
private drawChars_;
/**
* @param {import("../../style/Text.js").default} textStyle Text style.
* @param {Object} [opt_sharedData] Shared data.
*/
setTextStyle(textStyle: import("../../style/Text.js").default, opt_sharedData?: any): void;
}
import CanvasBuilder from "./Builder.js";
//# sourceMappingURL=TextBuilder.d.ts.map

1
node_modules/ol/render/canvas/TextBuilder.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"TextBuilder.d.ts","sourceRoot":"","sources":["../../src/render/canvas/TextBuilder.js"],"names":[],"mappings":"yBA2BU,MAAM;;;;;;;;;;;;;;;AAgBhB;IAUI;;;OAGG;IACH,gBAAmB;IAEnB;;;OAGG;IACH,cAAe;IAEf;;;OAGG;IACH,qBAAqB;IAErB;;;OAGG;IACH,qBAAqB;IAErB;;;OAGG;IACH,4BAAoC;IAEpC;;;OAGG;IACH,sBAAsB;IAEtB;;;OAGG;IACH,uBAA0B;IAE1B;;OAEG;IACH;YAFkB,MAAM,GAAE,OAAO,cAAc,EAAE,SAAS;MAEtC;IAEpB;;;OAGG;IACH,yBAA4B;IAE5B;;OAEG;IACH;YAFkB,MAAM,GAAE,OAAO,cAAc,EAAE,WAAW;MAEtC;IAEtB;;;OAGG;IACH,mBAAsE;IAEtE;;OAEG;IACH;YAFkB,MAAM,GAAE,OAAO,cAAc,EAAE,SAAS;MAEtC;IAEpB;;;OAGG;IACH,iBAAkB;IAElB;;;OAGG;IACH,iBAAkB;IAElB;;;OAGG;IACH,mBAAoB;IAEpB;;;;OAIG;IACH,gCAAwC;IAyR1C;;OAEG;IACH,wBAqCC;IAED;;;;OAIG;IACH,mBAkDC;IAED;;;OAGG;IACH,wBAHW,OAAO,qBAAqB,EAAE,OAAO,8BA0G/C;CACF"}

572
node_modules/ol/render/canvas/TextBuilder.js generated vendored Normal file
View File

@@ -0,0 +1,572 @@
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/render/canvas/TextBuilder
*/
import CanvasBuilder from './Builder.js';
import CanvasInstruction from './Instruction.js';
import TextPlacement from '../../style/TextPlacement.js';
import { asColorLike } from '../../colorlike.js';
import { defaultFillStyle, defaultFont, defaultLineCap, defaultLineDash, defaultLineDashOffset, defaultLineJoin, defaultLineWidth, defaultMiterLimit, defaultPadding, defaultStrokeStyle, defaultTextAlign, defaultTextBaseline, registerFont, } from '../canvas.js';
import { getUid } from '../../util.js';
import { intersects } from '../../extent.js';
import { matchingChunk } from '../../geom/flat/straightchunk.js';
/**
* @const
* @enum {number}
*/
export var TEXT_ALIGN = {
'left': 0,
'end': 0,
'center': 0.5,
'right': 1,
'start': 1,
'top': 0,
'middle': 0.5,
'hanging': 0.2,
'alphabetic': 0.8,
'ideographic': 0.8,
'bottom': 1,
};
var CanvasTextBuilder = /** @class */ (function (_super) {
__extends(CanvasTextBuilder, _super);
/**
* @param {number} tolerance Tolerance.
* @param {import("../../extent.js").Extent} maxExtent Maximum extent.
* @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
*/
function CanvasTextBuilder(tolerance, maxExtent, resolution, pixelRatio) {
var _this = _super.call(this, tolerance, maxExtent, resolution, pixelRatio) || this;
/**
* @private
* @type {Array<HTMLCanvasElement>}
*/
_this.labels_ = null;
/**
* @private
* @type {string|Array<string>}
*/
_this.text_ = '';
/**
* @private
* @type {number}
*/
_this.textOffsetX_ = 0;
/**
* @private
* @type {number}
*/
_this.textOffsetY_ = 0;
/**
* @private
* @type {boolean|undefined}
*/
_this.textRotateWithView_ = undefined;
/**
* @private
* @type {number}
*/
_this.textRotation_ = 0;
/**
* @private
* @type {?import("../canvas.js").FillState}
*/
_this.textFillState_ = null;
/**
* @type {!Object<string, import("../canvas.js").FillState>}
*/
_this.fillStates = {};
/**
* @private
* @type {?import("../canvas.js").StrokeState}
*/
_this.textStrokeState_ = null;
/**
* @type {!Object<string, import("../canvas.js").StrokeState>}
*/
_this.strokeStates = {};
/**
* @private
* @type {import("../canvas.js").TextState}
*/
_this.textState_ = /** @type {import("../canvas.js").TextState} */ ({});
/**
* @type {!Object<string, import("../canvas.js").TextState>}
*/
_this.textStates = {};
/**
* @private
* @type {string}
*/
_this.textKey_ = '';
/**
* @private
* @type {string}
*/
_this.fillKey_ = '';
/**
* @private
* @type {string}
*/
_this.strokeKey_ = '';
/**
* Data shared with an image builder for combined decluttering.
* @private
* @type {import("../canvas.js").DeclutterImageWithText}
*/
_this.declutterImageWithText_ = undefined;
return _this;
}
/**
* @return {import("../canvas.js").SerializableInstructions} the serializable instructions.
*/
CanvasTextBuilder.prototype.finish = function () {
var instructions = _super.prototype.finish.call(this);
instructions.textStates = this.textStates;
instructions.fillStates = this.fillStates;
instructions.strokeStates = this.strokeStates;
return instructions;
};
/**
* @param {import("../../geom/SimpleGeometry.js").default|import("../Feature.js").default} geometry Geometry.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
*/
CanvasTextBuilder.prototype.drawText = function (geometry, feature) {
var fillState = this.textFillState_;
var strokeState = this.textStrokeState_;
var textState = this.textState_;
if (this.text_ === '' || !textState || (!fillState && !strokeState)) {
return;
}
var coordinates = this.coordinates;
var begin = coordinates.length;
var geometryType = geometry.getType();
var flatCoordinates = null;
var stride = geometry.getStride();
if (textState.placement === TextPlacement.LINE &&
(geometryType == 'LineString' ||
geometryType == 'MultiLineString' ||
geometryType == 'Polygon' ||
geometryType == 'MultiPolygon')) {
if (!intersects(this.getBufferedMaxExtent(), geometry.getExtent())) {
return;
}
var ends = void 0;
flatCoordinates = geometry.getFlatCoordinates();
if (geometryType == 'LineString') {
ends = [flatCoordinates.length];
}
else if (geometryType == 'MultiLineString') {
ends = /** @type {import("../../geom/MultiLineString.js").default} */ (geometry).getEnds();
}
else if (geometryType == 'Polygon') {
ends = /** @type {import("../../geom/Polygon.js").default} */ (geometry)
.getEnds()
.slice(0, 1);
}
else if (geometryType == 'MultiPolygon') {
var endss =
/** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getEndss();
ends = [];
for (var i = 0, ii = endss.length; i < ii; ++i) {
ends.push(endss[i][0]);
}
}
this.beginGeometry(geometry, feature);
var textAlign = textState.textAlign;
// No `justify` support for line placement.
var flatOffset = 0;
var flatEnd = void 0;
for (var o = 0, oo = ends.length; o < oo; ++o) {
if (textAlign == undefined) {
var range = matchingChunk(textState.maxAngle, flatCoordinates, flatOffset, ends[o], stride);
flatOffset = range[0];
flatEnd = range[1];
}
else {
flatEnd = ends[o];
}
for (var i = flatOffset; i < flatEnd; i += stride) {
coordinates.push(flatCoordinates[i], flatCoordinates[i + 1]);
}
var end = coordinates.length;
flatOffset = ends[o];
this.drawChars_(begin, end);
begin = end;
}
this.endGeometry(feature);
}
else {
var geometryWidths = textState.overflow ? null : [];
switch (geometryType) {
case 'Point':
case 'MultiPoint':
flatCoordinates =
/** @type {import("../../geom/MultiPoint.js").default} */ (geometry).getFlatCoordinates();
break;
case 'LineString':
flatCoordinates =
/** @type {import("../../geom/LineString.js").default} */ (geometry).getFlatMidpoint();
break;
case 'Circle':
flatCoordinates =
/** @type {import("../../geom/Circle.js").default} */ (geometry).getCenter();
break;
case 'MultiLineString':
flatCoordinates =
/** @type {import("../../geom/MultiLineString.js").default} */ (geometry).getFlatMidpoints();
stride = 2;
break;
case 'Polygon':
flatCoordinates =
/** @type {import("../../geom/Polygon.js").default} */ (geometry).getFlatInteriorPoint();
if (!textState.overflow) {
geometryWidths.push(flatCoordinates[2] / this.resolution);
}
stride = 3;
break;
case 'MultiPolygon':
var interiorPoints =
/** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getFlatInteriorPoints();
flatCoordinates = [];
for (var i = 0, ii = interiorPoints.length; i < ii; i += 3) {
if (!textState.overflow) {
geometryWidths.push(interiorPoints[i + 2] / this.resolution);
}
flatCoordinates.push(interiorPoints[i], interiorPoints[i + 1]);
}
if (flatCoordinates.length === 0) {
return;
}
stride = 2;
break;
default:
}
var end = this.appendFlatPointCoordinates(flatCoordinates, stride);
if (end === begin) {
return;
}
if (geometryWidths &&
(end - begin) / 2 !== flatCoordinates.length / stride) {
var beg_1 = begin / 2;
geometryWidths = geometryWidths.filter(function (w, i) {
var keep = coordinates[(beg_1 + i) * 2] === flatCoordinates[i * stride] &&
coordinates[(beg_1 + i) * 2 + 1] === flatCoordinates[i * stride + 1];
if (!keep) {
--beg_1;
}
return keep;
});
}
this.saveTextStates_();
if (textState.backgroundFill || textState.backgroundStroke) {
this.setFillStrokeStyle(textState.backgroundFill, textState.backgroundStroke);
if (textState.backgroundFill) {
this.updateFillStyle(this.state, this.createFill);
this.hitDetectionInstructions.push(this.createFill(this.state));
}
if (textState.backgroundStroke) {
this.updateStrokeStyle(this.state, this.applyStroke);
this.hitDetectionInstructions.push(this.createStroke(this.state));
}
}
this.beginGeometry(geometry, feature);
// adjust padding for negative scale
var padding = textState.padding;
if (padding != defaultPadding &&
(textState.scale[0] < 0 || textState.scale[1] < 0)) {
var p0 = textState.padding[0];
var p1 = textState.padding[1];
var p2 = textState.padding[2];
var p3 = textState.padding[3];
if (textState.scale[0] < 0) {
p1 = -p1;
p3 = -p3;
}
if (textState.scale[1] < 0) {
p0 = -p0;
p2 = -p2;
}
padding = [p0, p1, p2, p3];
}
// The image is unknown at this stage so we pass null; it will be computed at render time.
// For clarity, we pass NaN for offsetX, offsetY, width and height, which will be computed at
// render time.
var pixelRatio_1 = this.pixelRatio;
this.instructions.push([
CanvasInstruction.DRAW_IMAGE,
begin,
end,
null,
NaN,
NaN,
NaN,
1,
0,
0,
this.textRotateWithView_,
this.textRotation_,
[1, 1],
NaN,
undefined,
this.declutterImageWithText_,
padding == defaultPadding
? defaultPadding
: padding.map(function (p) {
return p * pixelRatio_1;
}),
!!textState.backgroundFill,
!!textState.backgroundStroke,
this.text_,
this.textKey_,
this.strokeKey_,
this.fillKey_,
this.textOffsetX_,
this.textOffsetY_,
geometryWidths,
]);
var scale = 1 / pixelRatio_1;
this.hitDetectionInstructions.push([
CanvasInstruction.DRAW_IMAGE,
begin,
end,
null,
NaN,
NaN,
NaN,
1,
0,
0,
this.textRotateWithView_,
this.textRotation_,
[scale, scale],
NaN,
undefined,
this.declutterImageWithText_,
padding,
!!textState.backgroundFill,
!!textState.backgroundStroke,
this.text_,
this.textKey_,
this.strokeKey_,
this.fillKey_,
this.textOffsetX_,
this.textOffsetY_,
geometryWidths,
]);
this.endGeometry(feature);
}
};
/**
* @private
*/
CanvasTextBuilder.prototype.saveTextStates_ = function () {
var strokeState = this.textStrokeState_;
var textState = this.textState_;
var fillState = this.textFillState_;
var strokeKey = this.strokeKey_;
if (strokeState) {
if (!(strokeKey in this.strokeStates)) {
this.strokeStates[strokeKey] = {
strokeStyle: strokeState.strokeStyle,
lineCap: strokeState.lineCap,
lineDashOffset: strokeState.lineDashOffset,
lineWidth: strokeState.lineWidth,
lineJoin: strokeState.lineJoin,
miterLimit: strokeState.miterLimit,
lineDash: strokeState.lineDash,
};
}
}
var textKey = this.textKey_;
if (!(textKey in this.textStates)) {
this.textStates[textKey] = {
font: textState.font,
textAlign: textState.textAlign || defaultTextAlign,
justify: textState.justify,
textBaseline: textState.textBaseline || defaultTextBaseline,
scale: textState.scale,
};
}
var fillKey = this.fillKey_;
if (fillState) {
if (!(fillKey in this.fillStates)) {
this.fillStates[fillKey] = {
fillStyle: fillState.fillStyle,
};
}
}
};
/**
* @private
* @param {number} begin Begin.
* @param {number} end End.
*/
CanvasTextBuilder.prototype.drawChars_ = function (begin, end) {
var strokeState = this.textStrokeState_;
var textState = this.textState_;
var strokeKey = this.strokeKey_;
var textKey = this.textKey_;
var fillKey = this.fillKey_;
this.saveTextStates_();
var pixelRatio = this.pixelRatio;
var baseline = TEXT_ALIGN[textState.textBaseline];
var offsetY = this.textOffsetY_ * pixelRatio;
var text = this.text_;
var strokeWidth = strokeState
? (strokeState.lineWidth * Math.abs(textState.scale[0])) / 2
: 0;
this.instructions.push([
CanvasInstruction.DRAW_CHARS,
begin,
end,
baseline,
textState.overflow,
fillKey,
textState.maxAngle,
pixelRatio,
offsetY,
strokeKey,
strokeWidth * pixelRatio,
text,
textKey,
1,
]);
this.hitDetectionInstructions.push([
CanvasInstruction.DRAW_CHARS,
begin,
end,
baseline,
textState.overflow,
fillKey,
textState.maxAngle,
1,
offsetY,
strokeKey,
strokeWidth,
text,
textKey,
1 / pixelRatio,
]);
};
/**
* @param {import("../../style/Text.js").default} textStyle Text style.
* @param {Object} [opt_sharedData] Shared data.
*/
CanvasTextBuilder.prototype.setTextStyle = function (textStyle, opt_sharedData) {
var textState, fillState, strokeState;
if (!textStyle) {
this.text_ = '';
}
else {
var textFillStyle = textStyle.getFill();
if (!textFillStyle) {
fillState = null;
this.textFillState_ = fillState;
}
else {
fillState = this.textFillState_;
if (!fillState) {
fillState = /** @type {import("../canvas.js").FillState} */ ({});
this.textFillState_ = fillState;
}
fillState.fillStyle = asColorLike(textFillStyle.getColor() || defaultFillStyle);
}
var textStrokeStyle = textStyle.getStroke();
if (!textStrokeStyle) {
strokeState = null;
this.textStrokeState_ = strokeState;
}
else {
strokeState = this.textStrokeState_;
if (!strokeState) {
strokeState = /** @type {import("../canvas.js").StrokeState} */ ({});
this.textStrokeState_ = strokeState;
}
var lineDash = textStrokeStyle.getLineDash();
var lineDashOffset = textStrokeStyle.getLineDashOffset();
var lineWidth = textStrokeStyle.getWidth();
var miterLimit = textStrokeStyle.getMiterLimit();
strokeState.lineCap = textStrokeStyle.getLineCap() || defaultLineCap;
strokeState.lineDash = lineDash ? lineDash.slice() : defaultLineDash;
strokeState.lineDashOffset =
lineDashOffset === undefined ? defaultLineDashOffset : lineDashOffset;
strokeState.lineJoin = textStrokeStyle.getLineJoin() || defaultLineJoin;
strokeState.lineWidth =
lineWidth === undefined ? defaultLineWidth : lineWidth;
strokeState.miterLimit =
miterLimit === undefined ? defaultMiterLimit : miterLimit;
strokeState.strokeStyle = asColorLike(textStrokeStyle.getColor() || defaultStrokeStyle);
}
textState = this.textState_;
var font = textStyle.getFont() || defaultFont;
registerFont(font);
var textScale = textStyle.getScaleArray();
textState.overflow = textStyle.getOverflow();
textState.font = font;
textState.maxAngle = textStyle.getMaxAngle();
textState.placement = textStyle.getPlacement();
textState.textAlign = textStyle.getTextAlign();
textState.justify = textStyle.getJustify();
textState.textBaseline =
textStyle.getTextBaseline() || defaultTextBaseline;
textState.backgroundFill = textStyle.getBackgroundFill();
textState.backgroundStroke = textStyle.getBackgroundStroke();
textState.padding = textStyle.getPadding() || defaultPadding;
textState.scale = textScale === undefined ? [1, 1] : textScale;
var textOffsetX = textStyle.getOffsetX();
var textOffsetY = textStyle.getOffsetY();
var textRotateWithView = textStyle.getRotateWithView();
var textRotation = textStyle.getRotation();
this.text_ = textStyle.getText() || '';
this.textOffsetX_ = textOffsetX === undefined ? 0 : textOffsetX;
this.textOffsetY_ = textOffsetY === undefined ? 0 : textOffsetY;
this.textRotateWithView_ =
textRotateWithView === undefined ? false : textRotateWithView;
this.textRotation_ = textRotation === undefined ? 0 : textRotation;
this.strokeKey_ = strokeState
? (typeof strokeState.strokeStyle == 'string'
? strokeState.strokeStyle
: getUid(strokeState.strokeStyle)) +
strokeState.lineCap +
strokeState.lineDashOffset +
'|' +
strokeState.lineWidth +
strokeState.lineJoin +
strokeState.miterLimit +
'[' +
strokeState.lineDash.join() +
']'
: '';
this.textKey_ =
textState.font +
textState.scale +
(textState.textAlign || '?') +
(textState.justify || '?') +
(textState.textBaseline || '?');
this.fillKey_ = fillState
? typeof fillState.fillStyle == 'string'
? fillState.fillStyle
: '|' + getUid(fillState.fillStyle)
: '';
}
this.declutterImageWithText_ = opt_sharedData;
};
return CanvasTextBuilder;
}(CanvasBuilder));
export default CanvasTextBuilder;
//# sourceMappingURL=TextBuilder.js.map

1
node_modules/ol/render/canvas/TextBuilder.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

27
node_modules/ol/render/canvas/hitdetect.d.ts generated vendored Normal file
View File

@@ -0,0 +1,27 @@
/**
* @param {import("../../size.js").Size} size Canvas size in css pixels.
* @param {Array<import("../../transform.js").Transform>} transforms Transforms
* for rendering features to all worlds of the viewport, from coordinates to css
* pixels.
* @param {Array<import("../../Feature.js").FeatureLike>} features
* Features to consider for hit detection.
* @param {import("../../style/Style.js").StyleFunction|undefined} styleFunction
* Layer style function.
* @param {import("../../extent.js").Extent} extent Extent.
* @param {number} resolution Resolution.
* @param {number} rotation Rotation.
* @return {ImageData} Hit detection image data.
*/
export function createHitDetectionImageData(size: import("../../size.js").Size, transforms: Array<import("../../transform.js").Transform>, features: Array<import("../../Feature.js").FeatureLike>, styleFunction: import("../../style/Style.js").StyleFunction | undefined, extent: import("../../extent.js").Extent, resolution: number, rotation: number): ImageData;
/**
* @param {import("../../pixel").Pixel} pixel Pixel coordinate on the hit
* detection canvas in css pixels.
* @param {Array<import("../../Feature").FeatureLike>} features Features. Has to
* match the `features` array that was passed to `createHitDetectionImageData()`.
* @param {ImageData} imageData Hit detection image data generated by
* `createHitDetectionImageData()`.
* @return {Array<import("../../Feature").FeatureLike>} features Features.
*/
export function hitDetect(pixel: import("../../pixel").Pixel, features: Array<import("../../Feature").FeatureLike>, imageData: ImageData): Array<import("../../Feature").FeatureLike>;
export const HIT_DETECT_RESOLUTION: 0.5;
//# sourceMappingURL=hitdetect.d.ts.map

1
node_modules/ol/render/canvas/hitdetect.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"hitdetect.d.ts","sourceRoot":"","sources":["../../src/render/canvas/hitdetect.js"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;GAaG;AACH,kDAbW,OAAO,eAAe,EAAE,IAAI,cAC5B,MAAM,OAAO,oBAAoB,EAAE,SAAS,CAAC,YAG7C,MAAM,OAAO,kBAAkB,EAAE,WAAW,CAAC,iBAE7C,OAAO,sBAAsB,EAAE,aAAa,GAAC,SAAS,UAEtD,OAAO,iBAAiB,EAAE,MAAM,cAChC,MAAM,YACN,MAAM,GACL,SAAS,CA6HpB;AAED;;;;;;;;GAQG;AACH,iCARW,OAAO,aAAa,EAAE,KAAK,YAE3B,MAAM,OAAO,eAAe,EAAE,WAAW,CAAC,aAE1C,SAAS,GAER,MAAM,OAAO,eAAe,EAAE,WAAW,CAAC,CAwBrD;AA5KD,wCAAyC"}

155
node_modules/ol/render/canvas/hitdetect.js generated vendored Normal file
View File

@@ -0,0 +1,155 @@
/**
* @module ol/render/canvas/hitdetect
*/
import CanvasImmediateRenderer from './Immediate.js';
import IconAnchorUnits from '../../style/IconAnchorUnits.js';
import { Icon } from '../../style.js';
import { clamp } from '../../math.js';
import { createCanvasContext2D } from '../../dom.js';
import { intersects } from '../../extent.js';
import { numberSafeCompareFunction } from '../../array.js';
export var HIT_DETECT_RESOLUTION = 0.5;
/**
* @param {import("../../size.js").Size} size Canvas size in css pixels.
* @param {Array<import("../../transform.js").Transform>} transforms Transforms
* for rendering features to all worlds of the viewport, from coordinates to css
* pixels.
* @param {Array<import("../../Feature.js").FeatureLike>} features
* Features to consider for hit detection.
* @param {import("../../style/Style.js").StyleFunction|undefined} styleFunction
* Layer style function.
* @param {import("../../extent.js").Extent} extent Extent.
* @param {number} resolution Resolution.
* @param {number} rotation Rotation.
* @return {ImageData} Hit detection image data.
*/
export function createHitDetectionImageData(size, transforms, features, styleFunction, extent, resolution, rotation) {
var width = size[0] * HIT_DETECT_RESOLUTION;
var height = size[1] * HIT_DETECT_RESOLUTION;
var context = createCanvasContext2D(width, height);
context.imageSmoothingEnabled = false;
var canvas = context.canvas;
var renderer = new CanvasImmediateRenderer(context, HIT_DETECT_RESOLUTION, extent, null, rotation);
var featureCount = features.length;
// Stretch hit detection index to use the whole available color range
var indexFactor = Math.floor((256 * 256 * 256 - 1) / featureCount);
var featuresByZIndex = {};
for (var i = 1; i <= featureCount; ++i) {
var feature = features[i - 1];
var featureStyleFunction = feature.getStyleFunction() || styleFunction;
if (!styleFunction) {
continue;
}
var styles = featureStyleFunction(feature, resolution);
if (!styles) {
continue;
}
if (!Array.isArray(styles)) {
styles = [styles];
}
var index = i * indexFactor;
var color = '#' + ('000000' + index.toString(16)).slice(-6);
for (var j = 0, jj = styles.length; j < jj; ++j) {
var originalStyle = styles[j];
var geometry = originalStyle.getGeometryFunction()(feature);
if (!geometry || !intersects(extent, geometry.getExtent())) {
continue;
}
var style = originalStyle.clone();
var fill = style.getFill();
if (fill) {
fill.setColor(color);
}
var stroke = style.getStroke();
if (stroke) {
stroke.setColor(color);
stroke.setLineDash(null);
}
style.setText(undefined);
var image = originalStyle.getImage();
if (image && image.getOpacity() !== 0) {
var imgSize = image.getImageSize();
if (!imgSize) {
continue;
}
var imgContext = createCanvasContext2D(imgSize[0], imgSize[1], undefined, { alpha: false });
var img = imgContext.canvas;
imgContext.fillStyle = color;
imgContext.fillRect(0, 0, img.width, img.height);
style.setImage(new Icon({
img: img,
imgSize: imgSize,
anchor: image.getAnchor(),
anchorXUnits: IconAnchorUnits.PIXELS,
anchorYUnits: IconAnchorUnits.PIXELS,
offset: image.getOrigin(),
opacity: 1,
size: image.getSize(),
scale: image.getScale(),
rotation: image.getRotation(),
rotateWithView: image.getRotateWithView(),
}));
}
var zIndex = style.getZIndex() || 0;
var byGeometryType = featuresByZIndex[zIndex];
if (!byGeometryType) {
byGeometryType = {};
featuresByZIndex[zIndex] = byGeometryType;
byGeometryType['Polygon'] = [];
byGeometryType['Circle'] = [];
byGeometryType['LineString'] = [];
byGeometryType['Point'] = [];
}
byGeometryType[geometry.getType().replace('Multi', '')].push(geometry, style);
}
}
var zIndexKeys = Object.keys(featuresByZIndex)
.map(Number)
.sort(numberSafeCompareFunction);
for (var i = 0, ii = zIndexKeys.length; i < ii; ++i) {
var byGeometryType = featuresByZIndex[zIndexKeys[i]];
for (var type in byGeometryType) {
var geomAndStyle = byGeometryType[type];
for (var j = 0, jj = geomAndStyle.length; j < jj; j += 2) {
renderer.setStyle(geomAndStyle[j + 1]);
for (var k = 0, kk = transforms.length; k < kk; ++k) {
renderer.setTransform(transforms[k]);
renderer.drawGeometry(geomAndStyle[j]);
}
}
}
}
return context.getImageData(0, 0, canvas.width, canvas.height);
}
/**
* @param {import("../../pixel").Pixel} pixel Pixel coordinate on the hit
* detection canvas in css pixels.
* @param {Array<import("../../Feature").FeatureLike>} features Features. Has to
* match the `features` array that was passed to `createHitDetectionImageData()`.
* @param {ImageData} imageData Hit detection image data generated by
* `createHitDetectionImageData()`.
* @return {Array<import("../../Feature").FeatureLike>} features Features.
*/
export function hitDetect(pixel, features, imageData) {
var resultFeatures = [];
if (imageData) {
var x = Math.floor(Math.round(pixel[0]) * HIT_DETECT_RESOLUTION);
var y = Math.floor(Math.round(pixel[1]) * HIT_DETECT_RESOLUTION);
// The pixel coordinate is clamped down to the hit-detect canvas' size to account
// for browsers returning coordinates slightly larger than the actual canvas size
// due to a non-integer pixel ratio.
var index = (clamp(x, 0, imageData.width - 1) +
clamp(y, 0, imageData.height - 1) * imageData.width) *
4;
var r = imageData.data[index];
var g = imageData.data[index + 1];
var b = imageData.data[index + 2];
var i = b + 256 * (g + 256 * r);
var indexFactor = Math.floor((256 * 256 * 256 - 1) / features.length);
if (i && i % indexFactor === 0) {
resultFeatures.push(features[i / indexFactor - 1]);
}
}
return resultFeatures;
}
//# sourceMappingURL=hitdetect.js.map

1
node_modules/ol/render/canvas/hitdetect.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long