diff --git a/web/client/assets/js/OlMap/OlMapTool.common.js b/web/client/assets/js/OlMap/OlMapTool.common.js new file mode 100644 index 00000000..c3e638f4 --- /dev/null +++ b/web/client/assets/js/OlMap/OlMapTool.common.js @@ -0,0 +1,76588 @@ +module.exports = +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "fb15"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ 0: +/***/ (function(module, exports) { + +/* (ignored) */ + +/***/ }), + +/***/ "00bb": +/***/ (function(module, exports, __webpack_require__) { + +;(function (root, factory, undef) { + if (true) { + // CommonJS + module.exports = exports = factory(__webpack_require__("21bf"), __webpack_require__("38ba")); + } + else {} +}(this, function (CryptoJS) { + + /** + * Cipher Feedback block mode. + */ + CryptoJS.mode.CFB = (function () { + var CFB = CryptoJS.lib.BlockCipherMode.extend(); + + CFB.Encryptor = CFB.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); + + // Remember this block to use with next block + this._prevBlock = words.slice(offset, offset + blockSize); + } + }); + + CFB.Decryptor = CFB.extend({ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // Remember this block to use with next block + var thisBlock = words.slice(offset, offset + blockSize); + + generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); + + // This block becomes the previous block + this._prevBlock = thisBlock; + } + }); + + function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { + var keystream; + + // Shortcut + var iv = this._iv; + + // Generate keystream + if (iv) { + keystream = iv.slice(0); + + // Remove IV for subsequent blocks + this._iv = undefined; + } else { + keystream = this._prevBlock; + } + cipher.encryptBlock(keystream, 0); + + // Encrypt + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= keystream[i]; + } + } + + return CFB; + }()); + + + return CryptoJS.mode.CFB; + +})); + +/***/ }), + +/***/ "00ee": +/***/ (function(module, exports, __webpack_require__) { + +var wellKnownSymbol = __webpack_require__("b622"); + +var TO_STRING_TAG = wellKnownSymbol('toStringTag'); +var test = {}; + +test[TO_STRING_TAG] = 'z'; + +module.exports = String(test) === '[object z]'; + + +/***/ }), + +/***/ "01d4": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/** + * @module ol/events/EventType + */ +/** + * @enum {string} + * @const + */ +/* harmony default export */ __webpack_exports__["a"] = ({ + /** + * Generic change event. Triggered when the revision counter is increased. + * @event module:ol/events/Event~BaseEvent#change + * @api + */ + CHANGE: 'change', + /** + * Generic error event. Triggered when an error occurs. + * @event module:ol/events/Event~BaseEvent#error + * @api + */ + ERROR: 'error', + BLUR: 'blur', + CLEAR: 'clear', + CONTEXTMENU: 'contextmenu', + CLICK: 'click', + DBLCLICK: 'dblclick', + DRAGENTER: 'dragenter', + DRAGOVER: 'dragover', + DROP: 'drop', + FOCUS: 'focus', + KEYDOWN: 'keydown', + KEYPRESS: 'keypress', + LOAD: 'load', + RESIZE: 'resize', + TOUCHMOVE: 'touchmove', + WHEEL: 'wheel', +}); +//# sourceMappingURL=EventType.js.map + +/***/ }), + +/***/ "0414": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DEFAULT_MAX_ZOOM; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return DEFAULT_TILE_SIZE; }); +/** + * @module ol/tilegrid/common + */ +/** + * Default maximum zoom for default tile grids. + * @type {number} + */ +var DEFAULT_MAX_ZOOM = 42; +/** + * Default tile size. + * @type {number} + */ +var DEFAULT_TILE_SIZE = 256; +//# sourceMappingURL=common.js.map + +/***/ }), + +/***/ "045d": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/** + * @module ol/extent/Relationship + */ +/** + * Relationship to an extent. + * @enum {number} + */ +/* harmony default export */ __webpack_exports__["a"] = ({ + UNKNOWN: 0, + INTERSECTING: 1, + ABOVE: 2, + RIGHT: 4, + BELOW: 8, + LEFT: 16, +}); +//# sourceMappingURL=Relationship.js.map + +/***/ }), + +/***/ "049d": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("521b"); +/* harmony import */ var _SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("9abc"); +/* harmony import */ var _flat_closest_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("9769"); +/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("0af5"); +/* harmony import */ var _flat_deflate_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("abb7"); +/* harmony import */ var _flat_simplify_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("1c48"); +/* harmony import */ var _flat_inflate_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("bb6c"); +/* harmony import */ var _flat_area_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("b589"); +var __extends = (undefined && undefined.__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/geom/LinearRing + */ + + + + + + + + +/** + * @classdesc + * Linear ring geometry. Only used as part of polygon; cannot be rendered + * on its own. + * + * @api + */ +var LinearRing = /** @class */ (function (_super) { + __extends(LinearRing, _super); + /** + * @param {Array|Array} coordinates Coordinates. + * For internal use, flat coordinates in combination with `opt_layout` are also accepted. + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + */ + function LinearRing(coordinates, opt_layout) { + var _this = _super.call(this) || this; + /** + * @private + * @type {number} + */ + _this.maxDelta_ = -1; + /** + * @private + * @type {number} + */ + _this.maxDeltaRevision_ = -1; + if (opt_layout !== undefined && !Array.isArray(coordinates[0])) { + _this.setFlatCoordinates(opt_layout, + /** @type {Array} */ (coordinates)); + } + else { + _this.setCoordinates( + /** @type {Array} */ (coordinates), opt_layout); + } + return _this; + } + /** + * Make a complete copy of the geometry. + * @return {!LinearRing} Clone. + * @api + */ + LinearRing.prototype.clone = function () { + return new LinearRing(this.flatCoordinates.slice(), this.layout); + }; + /** + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. + */ + LinearRing.prototype.closestPointXY = function (x, y, closestPoint, minSquaredDistance) { + if (minSquaredDistance < Object(_extent_js__WEBPACK_IMPORTED_MODULE_3__[/* closestSquaredDistanceXY */ "e"])(this.getExtent(), x, y)) { + return minSquaredDistance; + } + if (this.maxDeltaRevision_ != this.getRevision()) { + this.maxDelta_ = Math.sqrt(Object(_flat_closest_js__WEBPACK_IMPORTED_MODULE_2__[/* maxSquaredDelta */ "e"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, 0)); + this.maxDeltaRevision_ = this.getRevision(); + } + return Object(_flat_closest_js__WEBPACK_IMPORTED_MODULE_2__[/* assignClosestPoint */ "d"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, this.maxDelta_, true, x, y, closestPoint, minSquaredDistance); + }; + /** + * Return the area of the linear ring on projected plane. + * @return {number} Area (on projected plane). + * @api + */ + LinearRing.prototype.getArea = function () { + return Object(_flat_area_js__WEBPACK_IMPORTED_MODULE_7__[/* linearRing */ "a"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); + }; + /** + * Return the coordinates of the linear ring. + * @return {Array} Coordinates. + * @api + */ + LinearRing.prototype.getCoordinates = function () { + return Object(_flat_inflate_js__WEBPACK_IMPORTED_MODULE_6__[/* inflateCoordinates */ "a"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride); + }; + /** + * @param {number} squaredTolerance Squared tolerance. + * @return {LinearRing} Simplified LinearRing. + * @protected + */ + LinearRing.prototype.getSimplifiedGeometryInternal = function (squaredTolerance) { + var simplifiedFlatCoordinates = []; + simplifiedFlatCoordinates.length = Object(_flat_simplify_js__WEBPACK_IMPORTED_MODULE_5__[/* douglasPeucker */ "a"])(this.flatCoordinates, 0, this.flatCoordinates.length, this.stride, squaredTolerance, simplifiedFlatCoordinates, 0); + return new LinearRing(simplifiedFlatCoordinates, _GeometryLayout_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].XY); + }; + /** + * Get the type of this geometry. + * @return {import("./Geometry.js").Type} Geometry type. + * @api + */ + LinearRing.prototype.getType = function () { + return 'LinearRing'; + }; + /** + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. + * @api + */ + LinearRing.prototype.intersectsExtent = function (extent) { + return false; + }; + /** + * Set the coordinates of the linear ring. + * @param {!Array} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default} [opt_layout] Layout. + * @api + */ + LinearRing.prototype.setCoordinates = function (coordinates, opt_layout) { + this.setLayout(opt_layout, coordinates, 1); + if (!this.flatCoordinates) { + this.flatCoordinates = []; + } + this.flatCoordinates.length = Object(_flat_deflate_js__WEBPACK_IMPORTED_MODULE_4__[/* deflateCoordinates */ "b"])(this.flatCoordinates, 0, coordinates, this.stride); + this.changed(); + }; + return LinearRing; +}(_SimpleGeometry_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])); +/* harmony default export */ __webpack_exports__["a"] = (LinearRing); +//# sourceMappingURL=LinearRing.js.map + +/***/ }), + +/***/ "04f8": +/***/ (function(module, exports, __webpack_require__) { + +/* eslint-disable es/no-symbol -- required for testing */ +var V8_VERSION = __webpack_require__("2d00"); +var fails = __webpack_require__("d039"); + +// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing +module.exports = !!Object.getOwnPropertySymbols && !fails(function () { + var symbol = Symbol(); + // Chrome 38 Symbol has incorrect toString conversion + // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances + return !String(symbol) || !(Object(symbol) instanceof Symbol) || + // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances + !Symbol.sham && V8_VERSION && V8_VERSION < 41; +}); + + +/***/ }), + +/***/ "06cf": +/***/ (function(module, exports, __webpack_require__) { + +var DESCRIPTORS = __webpack_require__("83ab"); +var call = __webpack_require__("c65b"); +var propertyIsEnumerableModule = __webpack_require__("d1e7"); +var createPropertyDescriptor = __webpack_require__("5c6c"); +var toIndexedObject = __webpack_require__("fc6a"); +var toPropertyKey = __webpack_require__("a04b"); +var hasOwn = __webpack_require__("1a2d"); +var IE8_DOM_DEFINE = __webpack_require__("0cfb"); + +// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe +var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; + +// `Object.getOwnPropertyDescriptor` method +// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor +exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { + O = toIndexedObject(O); + P = toPropertyKey(P); + if (IE8_DOM_DEFINE) try { + return $getOwnPropertyDescriptor(O, P); + } catch (error) { /* empty */ } + if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]); +}; + + +/***/ }), + +/***/ "06f8": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return all; }); +/* unused harmony export altKeyOnly */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return altShiftKeysOnly; }); +/* unused harmony export focus */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return focusWithTabindex; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return always; }); +/* unused harmony export click */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return mouseActionButton; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return never; }); +/* unused harmony export pointerMove */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return singleClick; }); +/* unused harmony export doubleClick */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return noModifierKeys; }); +/* unused harmony export platformModifierKeyOnly */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return shiftKeyOnly; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return targetNotEditable; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return mouseOnly; }); +/* unused harmony export touchOnly */ +/* unused harmony export penOnly */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return primaryAction; }); +/* harmony import */ var _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("0b2d"); +/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("57cb"); +/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("617d"); +/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("92fa"); +/** + * @module ol/events/condition + */ + + + + +/** + * A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a + * `{boolean}`. If the condition is met, true should be returned. + * + * @typedef {function(this: ?, import("../MapBrowserEvent.js").default): boolean} Condition + */ +/** + * Creates a condition function that passes when all provided conditions pass. + * @param {...Condition} var_args Conditions to check. + * @return {Condition} Condition function. + */ +function all(var_args) { + var conditions = arguments; + /** + * @param {import("../MapBrowserEvent.js").default} event Event. + * @return {boolean} All conditions passed. + */ + return function (event) { + var pass = true; + for (var i = 0, ii = conditions.length; i < ii; ++i) { + pass = pass && conditions[i](event); + if (!pass) { + break; + } + } + return pass; + }; +} +/** + * Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when + * additionally the shift-key is pressed). + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True if only the alt key is pressed. + * @api + */ +var altKeyOnly = function (mapBrowserEvent) { + var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent); + return (originalEvent.altKey && + !(originalEvent.metaKey || originalEvent.ctrlKey) && + !originalEvent.shiftKey); +}; +/** + * Return `true` if only the alt-key and shift-key is pressed, `false` otherwise + * (e.g. when additionally the platform-modifier-key is pressed). + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True if only the alt and shift keys are pressed. + * @api + */ +var altShiftKeysOnly = function (mapBrowserEvent) { + var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent); + return (originalEvent.altKey && + !(originalEvent.metaKey || originalEvent.ctrlKey) && + originalEvent.shiftKey); +}; +/** + * Return `true` if the map has the focus. This condition requires a map target + * element with a `tabindex` attribute, e.g. `
`. + * + * @param {import("../MapBrowserEvent.js").default} event Map browser event. + * @return {boolean} The map has the focus. + * @api + */ +var focus = function (event) { + var targetElement = event.map.getTargetElement(); + var activeElement = event.map.getOwnerDocument().activeElement; + return targetElement.contains(activeElement); +}; +/** + * Return `true` if the map has the focus or no 'tabindex' attribute set. + * + * @param {import("../MapBrowserEvent.js").default} event Map browser event. + * @return {boolean} The map container has the focus or no 'tabindex' attribute. + */ +var focusWithTabindex = function (event) { + return event.map.getTargetElement().hasAttribute('tabindex') + ? focus(event) + : true; +}; +/** + * Return always true. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True. + * @api + */ +var always = _functions_js__WEBPACK_IMPORTED_MODULE_1__[/* TRUE */ "b"]; +/** + * Return `true` if the event is a `click` event, `false` otherwise. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True if the event is a map `click` event. + * @api + */ +var click = function (mapBrowserEvent) { + return mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].CLICK; +}; +/** + * Return `true` if the event has an "action"-producing mouse button. + * + * By definition, this includes left-click on windows/linux, and left-click + * without the ctrl key on Macs. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} The result. + */ +var mouseActionButton = function (mapBrowserEvent) { + var originalEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent); + return originalEvent.button == 0 && !(_has_js__WEBPACK_IMPORTED_MODULE_2__[/* WEBKIT */ "g"] && _has_js__WEBPACK_IMPORTED_MODULE_2__[/* MAC */ "d"] && originalEvent.ctrlKey); +}; +/** + * Return always false. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} False. + * @api + */ +var never = _functions_js__WEBPACK_IMPORTED_MODULE_1__[/* FALSE */ "a"]; +/** + * Return `true` if the browser event is a `pointermove` event, `false` + * otherwise. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True if the browser event is a `pointermove` event. + * @api + */ +var pointerMove = function (mapBrowserEvent) { + return mapBrowserEvent.type == 'pointermove'; +}; +/** + * Return `true` if the event is a map `singleclick` event, `false` otherwise. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True if the event is a map `singleclick` event. + * @api + */ +var singleClick = function (mapBrowserEvent) { + return mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].SINGLECLICK; +}; +/** + * Return `true` if the event is a map `dblclick` event, `false` otherwise. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True if the event is a map `dblclick` event. + * @api + */ +var doubleClick = function (mapBrowserEvent) { + return mapBrowserEvent.type == _MapBrowserEventType_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].DBLCLICK; +}; +/** + * Return `true` if no modifier key (alt-, shift- or platform-modifier-key) is + * pressed. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True only if there no modifier keys are pressed. + * @api + */ +var noModifierKeys = function (mapBrowserEvent) { + var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent); + return (!originalEvent.altKey && + !(originalEvent.metaKey || originalEvent.ctrlKey) && + !originalEvent.shiftKey); +}; +/** + * Return `true` if only the platform-modifier-key (the meta-key on Mac, + * ctrl-key otherwise) is pressed, `false` otherwise (e.g. when additionally + * the shift-key is pressed). + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True if only the platform modifier key is pressed. + * @api + */ +var platformModifierKeyOnly = function (mapBrowserEvent) { + var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent); + return (!originalEvent.altKey && + (_has_js__WEBPACK_IMPORTED_MODULE_2__[/* MAC */ "d"] ? originalEvent.metaKey : originalEvent.ctrlKey) && + !originalEvent.shiftKey); +}; +/** + * Return `true` if only the shift-key is pressed, `false` otherwise (e.g. when + * additionally the alt-key is pressed). + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True if only the shift key is pressed. + * @api + */ +var shiftKeyOnly = function (mapBrowserEvent) { + var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent); + return (!originalEvent.altKey && + !(originalEvent.metaKey || originalEvent.ctrlKey) && + originalEvent.shiftKey); +}; +/** + * Return `true` if the target element is not editable, i.e. not an `input`, + * `select`, or `textarea` element and no `contenteditable` attribute is + * set or inherited, `false` otherwise. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True only if the target element is not editable. + * @api + */ +var targetNotEditable = function (mapBrowserEvent) { + var originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (mapBrowserEvent.originalEvent); + var tagName = /** @type {Element} */ (originalEvent.target).tagName; + return (tagName !== 'INPUT' && + tagName !== 'SELECT' && + tagName !== 'TEXTAREA' && + // `isContentEditable` is only available on `HTMLElement`, but it may also be a + // different type like `SVGElement`. + // @ts-ignore + !originalEvent.target.isContentEditable); +}; +/** + * Return `true` if the event originates from a mouse device. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True if the event originates from a mouse device. + * @api + */ +var mouseOnly = function (mapBrowserEvent) { + var pointerEvent = /** @type {import("../MapBrowserEvent").default} */ (mapBrowserEvent).originalEvent; + Object(_asserts_js__WEBPACK_IMPORTED_MODULE_3__[/* assert */ "a"])(pointerEvent !== undefined, 56); // mapBrowserEvent must originate from a pointer event + // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType + return pointerEvent.pointerType == 'mouse'; +}; +/** + * Return `true` if the event originates from a touchable device. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True if the event originates from a touchable device. + * @api + */ +var touchOnly = function (mapBrowserEvent) { + var pointerEvt = /** @type {import("../MapBrowserEvent").default} */ (mapBrowserEvent).originalEvent; + Object(_asserts_js__WEBPACK_IMPORTED_MODULE_3__[/* assert */ "a"])(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event + // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType + return pointerEvt.pointerType === 'touch'; +}; +/** + * Return `true` if the event originates from a digital pen. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True if the event originates from a digital pen. + * @api + */ +var penOnly = function (mapBrowserEvent) { + var pointerEvt = /** @type {import("../MapBrowserEvent").default} */ (mapBrowserEvent).originalEvent; + Object(_asserts_js__WEBPACK_IMPORTED_MODULE_3__[/* assert */ "a"])(pointerEvt !== undefined, 56); // mapBrowserEvent must originate from a pointer event + // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType + return pointerEvt.pointerType === 'pen'; +}; +/** + * Return `true` if the event originates from a primary pointer in + * contact with the surface or if the left mouse button is pressed. + * See https://www.w3.org/TR/pointerevents/#button-states. + * + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} True if the event originates from a primary pointer. + * @api + */ +var primaryAction = function (mapBrowserEvent) { + var pointerEvent = /** @type {import("../MapBrowserEvent").default} */ (mapBrowserEvent).originalEvent; + Object(_asserts_js__WEBPACK_IMPORTED_MODULE_3__[/* assert */ "a"])(pointerEvent !== undefined, 56); // mapBrowserEvent must originate from a pointer event + return pointerEvent.isPrimary && pointerEvent.button === 0; +}; +//# sourceMappingURL=condition.js.map + +/***/ }), + +/***/ "070d": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/** + * @module ol/render/EventType + */ +/** + * @enum {string} + */ +/* harmony default export */ __webpack_exports__["a"] = ({ + /** + * 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 + +/***/ }), + +/***/ "0710": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var _Object_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("e269"); +/* harmony import */ var _MapEventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("592d"); +/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("cd7e"); +/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("0af5"); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("1e8d"); +/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("0999"); +var __extends = (undefined && undefined.__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/Overlay + */ + + + + + + +/** + * @typedef {'bottom-left' | 'bottom-center' | 'bottom-right' | 'center-left' | 'center-center' | 'center-right' | 'top-left' | 'top-center' | 'top-right'} Positioning + * The overlay position: `'bottom-left'`, `'bottom-center'`, `'bottom-right'`, + * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`, + * `'top-center'`, or `'top-right'`. + */ +/** + * @typedef {Object} Options + * @property {number|string} [id] Set the overlay id. The overlay id can be used + * with the {@link module:ol/Map~Map#getOverlayById} method. + * @property {HTMLElement} [element] The overlay element. + * @property {Array} [offset=[0, 0]] Offsets in pixels used when positioning + * the overlay. The first element in the + * array is the horizontal offset. A positive value shifts the overlay right. + * The second element in the array is the vertical offset. A positive value + * shifts the overlay down. + * @property {import("./coordinate.js").Coordinate} [position] The overlay position + * in map projection. + * @property {Positioning} [positioning='top-left'] Defines how + * the overlay is actually positioned with respect to its `position` property. + * Possible values are `'bottom-left'`, `'bottom-center'`, `'bottom-right'`, + * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`, + * `'top-center'`, and `'top-right'`. + * @property {boolean} [stopEvent=true] Whether event propagation to the map + * viewport should be stopped. If `true` the overlay is placed in the same + * container as that of the controls (CSS class name + * `ol-overlaycontainer-stopevent`); if `false` it is placed in the container + * with CSS class name specified by the `className` property. + * @property {boolean} [insertFirst=true] Whether the overlay is inserted first + * in the overlay container, or appended. If the overlay is placed in the same + * container as that of the controls (see the `stopEvent` option) you will + * probably set `insertFirst` to `true` so the overlay is displayed below the + * controls. + * @property {PanIntoViewOptions|boolean} [autoPan=false] Pan the map when calling + * `setPosition`, so that the overlay is entirely visible in the current viewport? + * If `true` (deprecated), then `autoPanAnimation` and `autoPanMargin` will be + * used to determine the panning parameters; if an object is supplied then other + * parameters are ignored. + * @property {PanOptions} [autoPanAnimation] The animation options used to pan + * the overlay into view. This animation is only used when `autoPan` is enabled. + * A `duration` and `easing` may be provided to customize the animation. + * Deprecated and ignored if `autoPan` is supplied as an object. + * @property {number} [autoPanMargin=20] The margin (in pixels) between the + * overlay and the borders of the map when autopanning. Deprecated and ignored + * if `autoPan` is supplied as an object. + * @property {PanIntoViewOptions} [autoPanOptions] The options to use for the + * autoPan. This is only used when `autoPan` is enabled and has preference over + * the individual `autoPanMargin` and `autoPanOptions`. + * @property {string} [className='ol-overlay-container ol-selectable'] CSS class + * name. + */ +/** + * @typedef {Object} PanOptions + * @property {number} [duration=1000] The duration of the animation in + * milliseconds. + * @property {function(number):number} [easing] The easing function to use. Can + * be one from {@link module:ol/easing} or a custom function. + * Default is {@link module:ol/easing.inAndOut}. + */ +/** + * @typedef {Object} PanIntoViewOptions + * @property {PanOptions} [animation={}] The animation parameters for the pan + * @property {number} [margin=20] The margin (in pixels) between the + * overlay and the borders of the map when panning into view. + */ +/** + * @enum {string} + * @protected + */ +var Property = { + ELEMENT: 'element', + MAP: 'map', + OFFSET: 'offset', + POSITION: 'position', + POSITIONING: 'positioning', +}; +/** + * @typedef {import("./ObjectEventType").Types|'change:element'|'change:map'|'change:offset'|'change:position'| + * 'change:positioning'} OverlayObjectEventTypes + */ +/*** + * @template Return + * @typedef {import("./Observable").OnSignature & + * import("./Observable").OnSignature & + * import("./Observable").CombinedOnSignature} OverlayOnSignature + */ +/** + * @classdesc + * An element to be displayed over the map and attached to a single map + * location. Like {@link module:ol/control/Control~Control}, Overlays are + * visible widgets. Unlike Controls, they are not in a fixed position on the + * screen, but are tied to a geographical coordinate, so panning the map will + * move an Overlay but not a Control. + * + * Example: + * + * import Overlay from 'ol/Overlay'; + * + * var popup = new Overlay({ + * element: document.getElementById('popup') + * }); + * popup.setPosition(coordinate); + * map.addOverlay(popup); + * + * @api + */ +var Overlay = /** @class */ (function (_super) { + __extends(Overlay, _super); + /** + * @param {Options} options Overlay options. + */ + function Overlay(options) { + var _this = _super.call(this) || this; + /*** + * @type {OverlayOnSignature} + */ + _this.on; + /*** + * @type {OverlayOnSignature} + */ + _this.once; + /*** + * @type {OverlayOnSignature} + */ + _this.un; + /** + * @protected + * @type {Options} + */ + _this.options = options; + /** + * @protected + * @type {number|string|undefined} + */ + _this.id = options.id; + /** + * @protected + * @type {boolean} + */ + _this.insertFirst = + options.insertFirst !== undefined ? options.insertFirst : true; + /** + * @protected + * @type {boolean} + */ + _this.stopEvent = options.stopEvent !== undefined ? options.stopEvent : true; + /** + * @protected + * @type {HTMLElement} + */ + _this.element = document.createElement('div'); + _this.element.className = + options.className !== undefined + ? options.className + : 'ol-overlay-container ' + _css_js__WEBPACK_IMPORTED_MODULE_2__[/* CLASS_SELECTABLE */ "d"]; + _this.element.style.position = 'absolute'; + _this.element.style.pointerEvents = 'auto'; + var autoPan = options.autoPan; + if (autoPan && 'object' !== typeof autoPan) { + autoPan = { + animation: options.autoPanAnimation, + margin: options.autoPanMargin, + }; + } + /** + * @protected + * @type {PanIntoViewOptions|false} + */ + _this.autoPan = /** @type {PanIntoViewOptions} */ (autoPan) || false; + /** + * @protected + * @type {{transform_: string, + * visible: boolean}} + */ + _this.rendered = { + transform_: '', + visible: true, + }; + /** + * @protected + * @type {?import("./events.js").EventsKey} + */ + _this.mapPostrenderListenerKey = null; + _this.addChangeListener(Property.ELEMENT, _this.handleElementChanged); + _this.addChangeListener(Property.MAP, _this.handleMapChanged); + _this.addChangeListener(Property.OFFSET, _this.handleOffsetChanged); + _this.addChangeListener(Property.POSITION, _this.handlePositionChanged); + _this.addChangeListener(Property.POSITIONING, _this.handlePositioningChanged); + if (options.element !== undefined) { + _this.setElement(options.element); + } + _this.setOffset(options.offset !== undefined ? options.offset : [0, 0]); + _this.setPositioning(options.positioning || 'top-left'); + if (options.position !== undefined) { + _this.setPosition(options.position); + } + return _this; + } + /** + * Get the DOM element of this overlay. + * @return {HTMLElement|undefined} The Element containing the overlay. + * @observable + * @api + */ + Overlay.prototype.getElement = function () { + return /** @type {HTMLElement|undefined} */ (this.get(Property.ELEMENT)); + }; + /** + * Get the overlay identifier which is set on constructor. + * @return {number|string|undefined} Id. + * @api + */ + Overlay.prototype.getId = function () { + return this.id; + }; + /** + * Get the map associated with this overlay. + * @return {import("./PluggableMap.js").default|null} The map that the + * overlay is part of. + * @observable + * @api + */ + Overlay.prototype.getMap = function () { + return /** @type {import("./PluggableMap.js").default|null} */ (this.get(Property.MAP) || null); + }; + /** + * Get the offset of this overlay. + * @return {Array} The offset. + * @observable + * @api + */ + Overlay.prototype.getOffset = function () { + return /** @type {Array} */ (this.get(Property.OFFSET)); + }; + /** + * Get the current position of this overlay. + * @return {import("./coordinate.js").Coordinate|undefined} The spatial point that the overlay is + * anchored at. + * @observable + * @api + */ + Overlay.prototype.getPosition = function () { + return /** @type {import("./coordinate.js").Coordinate|undefined} */ (this.get(Property.POSITION)); + }; + /** + * Get the current positioning of this overlay. + * @return {Positioning} How the overlay is positioned + * relative to its point on the map. + * @observable + * @api + */ + Overlay.prototype.getPositioning = function () { + return /** @type {Positioning} */ (this.get(Property.POSITIONING)); + }; + /** + * @protected + */ + Overlay.prototype.handleElementChanged = function () { + Object(_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* removeChildren */ "e"])(this.element); + var element = this.getElement(); + if (element) { + this.element.appendChild(element); + } + }; + /** + * @protected + */ + Overlay.prototype.handleMapChanged = function () { + if (this.mapPostrenderListenerKey) { + Object(_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* removeNode */ "f"])(this.element); + Object(_events_js__WEBPACK_IMPORTED_MODULE_4__[/* unlistenByKey */ "c"])(this.mapPostrenderListenerKey); + this.mapPostrenderListenerKey = null; + } + var map = this.getMap(); + if (map) { + this.mapPostrenderListenerKey = Object(_events_js__WEBPACK_IMPORTED_MODULE_4__[/* listen */ "a"])(map, _MapEventType_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].POSTRENDER, this.render, this); + this.updatePixelPosition(); + var container = this.stopEvent + ? map.getOverlayContainerStopEvent() + : map.getOverlayContainer(); + if (this.insertFirst) { + container.insertBefore(this.element, container.childNodes[0] || null); + } + else { + container.appendChild(this.element); + } + this.performAutoPan(); + } + }; + /** + * @protected + */ + Overlay.prototype.render = function () { + this.updatePixelPosition(); + }; + /** + * @protected + */ + Overlay.prototype.handleOffsetChanged = function () { + this.updatePixelPosition(); + }; + /** + * @protected + */ + Overlay.prototype.handlePositionChanged = function () { + this.updatePixelPosition(); + this.performAutoPan(); + }; + /** + * @protected + */ + Overlay.prototype.handlePositioningChanged = function () { + this.updatePixelPosition(); + }; + /** + * Set the DOM element to be associated with this overlay. + * @param {HTMLElement|undefined} element The Element containing the overlay. + * @observable + * @api + */ + Overlay.prototype.setElement = function (element) { + this.set(Property.ELEMENT, element); + }; + /** + * Set the map to be associated with this overlay. + * @param {import("./PluggableMap.js").default|null} map The map that the + * overlay is part of. Pass `null` to just remove the overlay from the current map. + * @observable + * @api + */ + Overlay.prototype.setMap = function (map) { + this.set(Property.MAP, map); + }; + /** + * Set the offset for this overlay. + * @param {Array} offset Offset. + * @observable + * @api + */ + Overlay.prototype.setOffset = function (offset) { + this.set(Property.OFFSET, offset); + }; + /** + * Set the position for this overlay. If the position is `undefined` the + * overlay is hidden. + * @param {import("./coordinate.js").Coordinate|undefined} position The spatial point that the overlay + * is anchored at. + * @observable + * @api + */ + Overlay.prototype.setPosition = function (position) { + this.set(Property.POSITION, position); + }; + /** + * Pan the map so that the overlay is entirely visible in the current viewport + * (if necessary) using the configured autoPan parameters + * @protected + */ + Overlay.prototype.performAutoPan = function () { + if (this.autoPan) { + this.panIntoView(this.autoPan); + } + }; + /** + * Pan the map so that the overlay is entirely visible in the current viewport + * (if necessary). + * @param {PanIntoViewOptions} [opt_panIntoViewOptions] Options for the pan action + * @api + */ + Overlay.prototype.panIntoView = function (opt_panIntoViewOptions) { + var map = this.getMap(); + if (!map || !map.getTargetElement() || !this.get(Property.POSITION)) { + return; + } + var mapRect = this.getRect(map.getTargetElement(), map.getSize()); + var element = this.getElement(); + var overlayRect = this.getRect(element, [ + Object(_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* outerWidth */ "c"])(element), + Object(_dom_js__WEBPACK_IMPORTED_MODULE_5__[/* outerHeight */ "b"])(element), + ]); + var panIntoViewOptions = opt_panIntoViewOptions || {}; + var myMargin = panIntoViewOptions.margin === undefined ? 20 : panIntoViewOptions.margin; + if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_3__[/* containsExtent */ "g"])(mapRect, overlayRect)) { + // the overlay is not completely inside the viewport, so pan the map + var offsetLeft = overlayRect[0] - mapRect[0]; + var offsetRight = mapRect[2] - overlayRect[2]; + var offsetTop = overlayRect[1] - mapRect[1]; + var offsetBottom = mapRect[3] - overlayRect[3]; + var delta = [0, 0]; + if (offsetLeft < 0) { + // move map to the left + delta[0] = offsetLeft - myMargin; + } + else if (offsetRight < 0) { + // move map to the right + delta[0] = Math.abs(offsetRight) + myMargin; + } + if (offsetTop < 0) { + // move map up + delta[1] = offsetTop - myMargin; + } + else if (offsetBottom < 0) { + // move map down + delta[1] = Math.abs(offsetBottom) + myMargin; + } + if (delta[0] !== 0 || delta[1] !== 0) { + var center = /** @type {import("./coordinate.js").Coordinate} */ (map.getView().getCenterInternal()); + var centerPx = map.getPixelFromCoordinateInternal(center); + if (!centerPx) { + return; + } + var newCenterPx = [centerPx[0] + delta[0], centerPx[1] + delta[1]]; + var panOptions = panIntoViewOptions.animation || {}; + map.getView().animateInternal({ + center: map.getCoordinateFromPixelInternal(newCenterPx), + duration: panOptions.duration, + easing: panOptions.easing, + }); + } + } + }; + /** + * Get the extent of an element relative to the document + * @param {HTMLElement} element The element. + * @param {import("./size.js").Size} size The size of the element. + * @return {import("./extent.js").Extent} The extent. + * @protected + */ + Overlay.prototype.getRect = function (element, size) { + var box = element.getBoundingClientRect(); + var offsetX = box.left + window.pageXOffset; + var offsetY = box.top + window.pageYOffset; + return [offsetX, offsetY, offsetX + size[0], offsetY + size[1]]; + }; + /** + * Set the positioning for this overlay. + * @param {Positioning} positioning how the overlay is + * positioned relative to its point on the map. + * @observable + * @api + */ + Overlay.prototype.setPositioning = function (positioning) { + this.set(Property.POSITIONING, positioning); + }; + /** + * Modify the visibility of the element. + * @param {boolean} visible Element visibility. + * @protected + */ + Overlay.prototype.setVisible = function (visible) { + if (this.rendered.visible !== visible) { + this.element.style.display = visible ? '' : 'none'; + this.rendered.visible = visible; + } + }; + /** + * Update pixel position. + * @protected + */ + Overlay.prototype.updatePixelPosition = function () { + var map = this.getMap(); + var position = this.getPosition(); + if (!map || !map.isRendered() || !position) { + this.setVisible(false); + return; + } + var pixel = map.getPixelFromCoordinate(position); + var mapSize = map.getSize(); + this.updateRenderedPosition(pixel, mapSize); + }; + /** + * @param {import("./pixel.js").Pixel} pixel The pixel location. + * @param {import("./size.js").Size|undefined} mapSize The map size. + * @protected + */ + Overlay.prototype.updateRenderedPosition = function (pixel, mapSize) { + var style = this.element.style; + var offset = this.getOffset(); + var positioning = this.getPositioning(); + this.setVisible(true); + var x = Math.round(pixel[0] + offset[0]) + 'px'; + var y = Math.round(pixel[1] + offset[1]) + 'px'; + var posX = '0%'; + var posY = '0%'; + if (positioning == 'bottom-right' || + positioning == 'center-right' || + positioning == 'top-right') { + posX = '-100%'; + } + else if (positioning == 'bottom-center' || + positioning == 'center-center' || + positioning == 'top-center') { + posX = '-50%'; + } + if (positioning == 'bottom-left' || + positioning == 'bottom-center' || + positioning == 'bottom-right') { + posY = '-100%'; + } + else if (positioning == 'center-left' || + positioning == 'center-center' || + positioning == 'center-right') { + posY = '-50%'; + } + var transform = "translate(".concat(posX, ", ").concat(posY, ") translate(").concat(x, ", ").concat(y, ")"); + if (this.rendered.transform_ != transform) { + this.rendered.transform_ = transform; + style.transform = transform; + // @ts-ignore IE9 + style.msTransform = transform; + } + }; + /** + * returns the options this Overlay has been created with + * @return {Options} overlay options + */ + Overlay.prototype.getOptions = function () { + return this.options; + }; + return Overlay; +}(_Object_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])); +/* harmony default export */ __webpack_exports__["a"] = (Overlay); +//# sourceMappingURL=Overlay.js.map + +/***/ }), + +/***/ "07fa": +/***/ (function(module, exports, __webpack_require__) { + +var toLength = __webpack_require__("50c4"); + +// `LengthOfArrayLike` abstract operation +// https://tc39.es/ecma262/#sec-lengthofarraylike +module.exports = function (obj) { + return toLength(obj.length); +}; + + +/***/ }), + +/***/ "089b": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getForProjection; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return wrapX; }); +/* unused harmony export createForExtent */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createXYZ; }); +/* unused harmony export createForProjection */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return extentFromProjection; }); +/* harmony import */ var _tilegrid_TileGrid_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("78db"); +/* harmony import */ var _proj_Units_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("fced"); +/* harmony import */ var _tilegrid_common_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("0414"); +/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("256f"); +/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("0af5"); +/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("345d"); +/** + * @module ol/tilegrid + */ + + + + + + +/** + * @param {import("./proj/Projection.js").default} projection Projection. + * @return {!TileGrid} Default tile grid for the + * passed projection. + */ +function getForProjection(projection) { + var tileGrid = projection.getDefaultTileGrid(); + if (!tileGrid) { + tileGrid = createForProjection(projection); + projection.setDefaultTileGrid(tileGrid); + } + return tileGrid; +} +/** + * @param {TileGrid} tileGrid Tile grid. + * @param {import("./tilecoord.js").TileCoord} tileCoord Tile coordinate. + * @param {import("./proj/Projection.js").default} projection Projection. + * @return {import("./tilecoord.js").TileCoord} Tile coordinate. + */ +function wrapX(tileGrid, tileCoord, projection) { + var z = tileCoord[0]; + var center = tileGrid.getTileCoordCenter(tileCoord); + var projectionExtent = extentFromProjection(projection); + if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__[/* containsCoordinate */ "f"])(projectionExtent, center)) { + var worldWidth = Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__[/* getWidth */ "E"])(projectionExtent); + var worldsAway = Math.ceil((projectionExtent[0] - center[0]) / worldWidth); + center[0] += worldWidth * worldsAway; + return tileGrid.getTileCoordForCoordAndZ(center, z); + } + else { + return tileCoord; + } +} +/** + * @param {import("./extent.js").Extent} extent Extent. + * @param {number} [opt_maxZoom] Maximum zoom level (default is + * DEFAULT_MAX_ZOOM). + * @param {number|import("./size.js").Size} [opt_tileSize] Tile size (default uses + * DEFAULT_TILE_SIZE). + * @param {import("./extent.js").Corner} [opt_corner] Extent corner (default is `'top-left'`). + * @return {!TileGrid} TileGrid instance. + */ +function createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner) { + var corner = opt_corner !== undefined ? opt_corner : 'top-left'; + var resolutions = resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize); + return new _tilegrid_TileGrid_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]({ + extent: extent, + origin: Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__[/* getCorner */ "x"])(extent, corner), + resolutions: resolutions, + tileSize: opt_tileSize, + }); +} +/** + * @typedef {Object} XYZOptions + * @property {import("./extent.js").Extent} [extent] Extent for the tile grid. The origin for an XYZ tile grid is the + * top-left corner of the extent. If `maxResolution` is not provided the zero level of the grid is defined by the resolution + * at which one tile fits in the provided extent. If not provided, the extent of the EPSG:3857 projection is used. + * @property {number} [maxResolution] Resolution at level zero. + * @property {number} [maxZoom] Maximum zoom. The default is `42`. This determines the number of levels + * in the grid set. For example, a `maxZoom` of 21 means there are 22 levels in the grid set. + * @property {number} [minZoom=0] Minimum zoom. + * @property {number|import("./size.js").Size} [tileSize=[256, 256]] Tile size in pixels. + */ +/** + * Creates a tile grid with a standard XYZ tiling scheme. + * @param {XYZOptions} [opt_options] Tile grid options. + * @return {!TileGrid} Tile grid instance. + * @api + */ +function createXYZ(opt_options) { + var xyzOptions = opt_options || {}; + var extent = xyzOptions.extent || Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__[/* get */ "h"])('EPSG:3857').getExtent(); + var gridOptions = { + extent: extent, + minZoom: xyzOptions.minZoom, + tileSize: xyzOptions.tileSize, + resolutions: resolutionsFromExtent(extent, xyzOptions.maxZoom, xyzOptions.tileSize, xyzOptions.maxResolution), + }; + return new _tilegrid_TileGrid_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](gridOptions); +} +/** + * Create a resolutions array from an extent. A zoom factor of 2 is assumed. + * @param {import("./extent.js").Extent} extent Extent. + * @param {number} [opt_maxZoom] Maximum zoom level (default is + * DEFAULT_MAX_ZOOM). + * @param {number|import("./size.js").Size} [opt_tileSize] Tile size (default uses + * DEFAULT_TILE_SIZE). + * @param {number} [opt_maxResolution] Resolution at level zero. + * @return {!Array} Resolutions array. + */ +function resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize, opt_maxResolution) { + var maxZoom = opt_maxZoom !== undefined ? opt_maxZoom : _tilegrid_common_js__WEBPACK_IMPORTED_MODULE_2__[/* DEFAULT_MAX_ZOOM */ "a"]; + var height = Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__[/* getHeight */ "z"])(extent); + var width = Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__[/* getWidth */ "E"])(extent); + var tileSize = Object(_size_js__WEBPACK_IMPORTED_MODULE_5__[/* toSize */ "c"])(opt_tileSize !== undefined ? opt_tileSize : _tilegrid_common_js__WEBPACK_IMPORTED_MODULE_2__[/* DEFAULT_TILE_SIZE */ "b"]); + var maxResolution = opt_maxResolution > 0 + ? opt_maxResolution + : Math.max(width / tileSize[0], height / tileSize[1]); + var length = maxZoom + 1; + var resolutions = new Array(length); + for (var z = 0; z < length; ++z) { + resolutions[z] = maxResolution / Math.pow(2, z); + } + return resolutions; +} +/** + * @param {import("./proj.js").ProjectionLike} projection Projection. + * @param {number} [opt_maxZoom] Maximum zoom level (default is + * DEFAULT_MAX_ZOOM). + * @param {number|import("./size.js").Size} [opt_tileSize] Tile size (default uses + * DEFAULT_TILE_SIZE). + * @param {import("./extent.js").Corner} [opt_corner] Extent corner (default is `'top-left'`). + * @return {!TileGrid} TileGrid instance. + */ +function createForProjection(projection, opt_maxZoom, opt_tileSize, opt_corner) { + var extent = extentFromProjection(projection); + return createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner); +} +/** + * Generate a tile grid extent from a projection. If the projection has an + * extent, it is used. If not, a global extent is assumed. + * @param {import("./proj.js").ProjectionLike} projection Projection. + * @return {import("./extent.js").Extent} Extent. + */ +function extentFromProjection(projection) { + projection = Object(_proj_js__WEBPACK_IMPORTED_MODULE_3__[/* get */ "h"])(projection); + var extent = projection.getExtent(); + if (!extent) { + var half = (180 * _proj_js__WEBPACK_IMPORTED_MODULE_3__[/* METERS_PER_UNIT */ "a"][_proj_Units_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "b"].DEGREES]) / projection.getMetersPerUnit(); + extent = Object(_extent_js__WEBPACK_IMPORTED_MODULE_4__[/* createOrUpdate */ "k"])(-half, -half, half, half); + } + return extent; +} +//# sourceMappingURL=tilegrid.js.map + +/***/ }), + +/***/ "0999": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createCanvasContext2D; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return releaseCanvas; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return outerWidth; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return outerHeight; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return replaceNode; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return removeNode; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return removeChildren; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return replaceChildren; }); +/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("617d"); + +/** + * @module ol/dom + */ +//FIXME Move this function to the canvas module +/** + * Create an html canvas element and returns its 2d context. + * @param {number} [opt_width] Canvas width. + * @param {number} [opt_height] Canvas height. + * @param {Array} [opt_canvasPool] Canvas pool to take existing canvas from. + * @param {CanvasRenderingContext2DSettings} [opt_Context2DSettings] CanvasRenderingContext2DSettings + * @return {CanvasRenderingContext2D} The context. + */ +function createCanvasContext2D(opt_width, opt_height, opt_canvasPool, opt_Context2DSettings) { + /** @type {HTMLCanvasElement|OffscreenCanvas} */ + var canvas; + if (opt_canvasPool && opt_canvasPool.length) { + canvas = opt_canvasPool.shift(); + } + else if (_has_js__WEBPACK_IMPORTED_MODULE_0__[/* WORKER_OFFSCREEN_CANVAS */ "h"]) { + canvas = new OffscreenCanvas(opt_width || 300, opt_height || 300); + } + else { + canvas = document.createElement('canvas'); + } + if (opt_width) { + canvas.width = opt_width; + } + if (opt_height) { + canvas.height = opt_height; + } + //FIXME Allow OffscreenCanvasRenderingContext2D as return type + return /** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d', opt_Context2DSettings)); +} +/** + * Releases canvas memory to avoid exceeding memory limits in Safari. + * See https://pqina.nl/blog/total-canvas-memory-use-exceeds-the-maximum-limit/ + * @param {CanvasRenderingContext2D} context Context. + */ +function releaseCanvas(context) { + var canvas = context.canvas; + canvas.width = 1; + canvas.height = 1; + context.clearRect(0, 0, 1, 1); +} +/** + * Get the current computed width for the given element including margin, + * padding and border. + * Equivalent to jQuery's `$(el).outerWidth(true)`. + * @param {!HTMLElement} element Element. + * @return {number} The width. + */ +function outerWidth(element) { + var width = element.offsetWidth; + var style = getComputedStyle(element); + width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10); + return width; +} +/** + * Get the current computed height for the given element including margin, + * padding and border. + * Equivalent to jQuery's `$(el).outerHeight(true)`. + * @param {!HTMLElement} element Element. + * @return {number} The height. + */ +function outerHeight(element) { + var height = element.offsetHeight; + var style = getComputedStyle(element); + height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10); + return height; +} +/** + * @param {Node} newNode Node to replace old node + * @param {Node} oldNode The node to be replaced + */ +function replaceNode(newNode, oldNode) { + var parent = oldNode.parentNode; + if (parent) { + parent.replaceChild(newNode, oldNode); + } +} +/** + * @param {Node} node The node to remove. + * @return {Node|null} The node that was removed or null. + */ +function removeNode(node) { + return node && node.parentNode ? node.parentNode.removeChild(node) : null; +} +/** + * @param {Node} node The node to remove the children from. + */ +function removeChildren(node) { + while (node.lastChild) { + node.removeChild(node.lastChild); + } +} +/** + * Transform the children of a parent node so they match the + * provided list of children. This function aims to efficiently + * remove, add, and reorder child nodes while maintaining a simple + * implementation (it is not guaranteed to minimize DOM operations). + * @param {Node} node The parent node whose children need reworking. + * @param {Array} children The desired children. + */ +function replaceChildren(node, children) { + var oldChildren = node.childNodes; + for (var i = 0; true; ++i) { + var oldChild = oldChildren[i]; + var newChild = children[i]; + // check if our work is done + if (!oldChild && !newChild) { + break; + } + // check if children match + if (oldChild === newChild) { + continue; + } + // check if a new child needs to be added + if (!oldChild) { + node.appendChild(newChild); + continue; + } + // check if an old child needs to be removed + if (!newChild) { + node.removeChild(oldChild); + --i; + continue; + } + // reorder + node.insertBefore(newChild, oldChild); + } +} +//# sourceMappingURL=dom.js.map + +/***/ }), + +/***/ "0a9d": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getInteriorPointOfArray; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getInteriorPointsOfMultiArray; }); +/* harmony import */ var _contains_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("25f1"); +/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("9f5e"); +/** + * @module ol/geom/flat/interiorpoint + */ + + +/** + * Calculates a point that is likely to lie in the interior of the linear rings. + * Inspired by JTS's com.vividsolutions.jts.geom.Geometry#getInteriorPoint. + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {Array} flatCenters Flat centers. + * @param {number} flatCentersOffset Flat center offset. + * @param {Array} [opt_dest] Destination. + * @return {Array} Destination point as XYM coordinate, where M is the + * length of the horizontal intersection that the point belongs to. + */ +function getInteriorPointOfArray(flatCoordinates, offset, ends, stride, flatCenters, flatCentersOffset, opt_dest) { + var i, ii, x, x1, x2, y1, y2; + var y = flatCenters[flatCentersOffset + 1]; + /** @type {Array} */ + var intersections = []; + // Calculate intersections with the horizontal line + for (var r = 0, rr = ends.length; r < rr; ++r) { + var end = ends[r]; + x1 = flatCoordinates[end - stride]; + y1 = flatCoordinates[end - stride + 1]; + for (i = offset; i < end; i += stride) { + x2 = flatCoordinates[i]; + y2 = flatCoordinates[i + 1]; + if ((y <= y1 && y2 <= y) || (y1 <= y && y <= y2)) { + x = ((y - y1) / (y2 - y1)) * (x2 - x1) + x1; + intersections.push(x); + } + x1 = x2; + y1 = y2; + } + } + // Find the longest segment of the horizontal line that has its center point + // inside the linear ring. + var pointX = NaN; + var maxSegmentLength = -Infinity; + intersections.sort(_array_js__WEBPACK_IMPORTED_MODULE_1__[/* numberSafeCompareFunction */ "i"]); + x1 = intersections[0]; + for (i = 1, ii = intersections.length; i < ii; ++i) { + x2 = intersections[i]; + var segmentLength = Math.abs(x2 - x1); + if (segmentLength > maxSegmentLength) { + x = (x1 + x2) / 2; + if (Object(_contains_js__WEBPACK_IMPORTED_MODULE_0__[/* linearRingsContainsXY */ "c"])(flatCoordinates, offset, ends, stride, x, y)) { + pointX = x; + maxSegmentLength = segmentLength; + } + } + x1 = x2; + } + if (isNaN(pointX)) { + // There is no horizontal line that has its center point inside the linear + // ring. Use the center of the the linear ring's extent. + pointX = flatCenters[flatCentersOffset]; + } + if (opt_dest) { + opt_dest.push(pointX, y, maxSegmentLength); + return opt_dest; + } + else { + return [pointX, y, maxSegmentLength]; + } +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Endss. + * @param {number} stride Stride. + * @param {Array} flatCenters Flat centers. + * @return {Array} Interior points as XYM coordinates, where M is the + * length of the horizontal intersection that the point belongs to. + */ +function getInteriorPointsOfMultiArray(flatCoordinates, offset, endss, stride, flatCenters) { + var interiorPoints = []; + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + interiorPoints = getInteriorPointOfArray(flatCoordinates, offset, ends, stride, flatCenters, 2 * i, interiorPoints); + offset = ends[ends.length - 1]; + } + return interiorPoints; +} +//# sourceMappingURL=interiorpoint.js.map + +/***/ }), + +/***/ "0af5": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return boundingExtent; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return buffer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return clone; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return closestSquaredDistanceXY; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return containsCoordinate; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return containsExtent; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return containsXY; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return coordinateRelationship; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return createEmpty; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return createOrUpdate; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return createOrUpdateEmpty; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return createOrUpdateFromCoordinate; }); +/* unused harmony export createOrUpdateFromCoordinates */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return createOrUpdateFromFlatCoordinates; }); +/* unused harmony export createOrUpdateFromRings */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return equals; }); +/* unused harmony export approximatelyEquals */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return extend; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return extendCoordinate; }); +/* unused harmony export extendCoordinates */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return extendFlatCoordinates; }); +/* unused harmony export extendRings */ +/* unused harmony export extendXY */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return forEachCorner; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return getArea; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return getBottomLeft; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return getBottomRight; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return getCenter; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return getCorner; }); +/* unused harmony export getEnlargedArea */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return getForViewAndSize; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return getRotatedViewport; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return getHeight; }); +/* unused harmony export getIntersectionArea */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return getIntersection; }); +/* unused harmony export getMargin */ +/* unused harmony export getSize */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return getTopLeft; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return getTopRight; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return getWidth; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return intersects; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return isEmpty; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return returnOrUpdate; }); +/* unused harmony export scaleFromCenter */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return intersectsSegment; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return applyTransform; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return wrapX; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return wrapAndSliceX; }); +/* harmony import */ var _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("045d"); +/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("92fa"); +/** + * @module ol/extent + */ + + +/** + * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`. + * @typedef {Array} Extent + * @api + */ +/** + * Extent corner. + * @typedef {'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'} Corner + */ +/** + * Build an extent that includes all given coordinates. + * + * @param {Array} coordinates Coordinates. + * @return {Extent} Bounding extent. + * @api + */ +function boundingExtent(coordinates) { + var extent = createEmpty(); + for (var i = 0, ii = coordinates.length; i < ii; ++i) { + extendCoordinate(extent, coordinates[i]); + } + return extent; +} +/** + * @param {Array} xs Xs. + * @param {Array} ys Ys. + * @param {Extent} [opt_extent] Destination extent. + * @private + * @return {Extent} Extent. + */ +function _boundingExtentXYs(xs, ys, opt_extent) { + var minX = Math.min.apply(null, xs); + var minY = Math.min.apply(null, ys); + var maxX = Math.max.apply(null, xs); + var maxY = Math.max.apply(null, ys); + return createOrUpdate(minX, minY, maxX, maxY, opt_extent); +} +/** + * Return extent increased by the provided value. + * @param {Extent} extent Extent. + * @param {number} value The amount by which the extent should be buffered. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} Extent. + * @api + */ +function buffer(extent, value, opt_extent) { + if (opt_extent) { + opt_extent[0] = extent[0] - value; + opt_extent[1] = extent[1] - value; + opt_extent[2] = extent[2] + value; + opt_extent[3] = extent[3] + value; + return opt_extent; + } + else { + return [ + extent[0] - value, + extent[1] - value, + extent[2] + value, + extent[3] + value, + ]; + } +} +/** + * Creates a clone of an extent. + * + * @param {Extent} extent Extent to clone. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} The clone. + */ +function clone(extent, opt_extent) { + if (opt_extent) { + opt_extent[0] = extent[0]; + opt_extent[1] = extent[1]; + opt_extent[2] = extent[2]; + opt_extent[3] = extent[3]; + return opt_extent; + } + else { + return extent.slice(); + } +} +/** + * @param {Extent} extent Extent. + * @param {number} x X. + * @param {number} y Y. + * @return {number} Closest squared distance. + */ +function closestSquaredDistanceXY(extent, x, y) { + var dx, dy; + if (x < extent[0]) { + dx = extent[0] - x; + } + else if (extent[2] < x) { + dx = x - extent[2]; + } + else { + dx = 0; + } + if (y < extent[1]) { + dy = extent[1] - y; + } + else if (extent[3] < y) { + dy = y - extent[3]; + } + else { + dy = 0; + } + return dx * dx + dy * dy; +} +/** + * Check if the passed coordinate is contained or on the edge of the extent. + * + * @param {Extent} extent Extent. + * @param {import("./coordinate.js").Coordinate} coordinate Coordinate. + * @return {boolean} The coordinate is contained in the extent. + * @api + */ +function containsCoordinate(extent, coordinate) { + return containsXY(extent, coordinate[0], coordinate[1]); +} +/** + * Check if one extent contains another. + * + * An extent is deemed contained if it lies completely within the other extent, + * including if they share one or more edges. + * + * @param {Extent} extent1 Extent 1. + * @param {Extent} extent2 Extent 2. + * @return {boolean} The second extent is contained by or on the edge of the + * first. + * @api + */ +function containsExtent(extent1, extent2) { + return (extent1[0] <= extent2[0] && + extent2[2] <= extent1[2] && + extent1[1] <= extent2[1] && + extent2[3] <= extent1[3]); +} +/** + * Check if the passed coordinate is contained or on the edge of the extent. + * + * @param {Extent} extent Extent. + * @param {number} x X coordinate. + * @param {number} y Y coordinate. + * @return {boolean} The x, y values are contained in the extent. + * @api + */ +function containsXY(extent, x, y) { + return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3]; +} +/** + * Get the relationship between a coordinate and extent. + * @param {Extent} extent The extent. + * @param {import("./coordinate.js").Coordinate} coordinate The coordinate. + * @return {import("./extent/Relationship.js").default} The relationship (bitwise compare with + * import("./extent/Relationship.js").Relationship). + */ +function coordinateRelationship(extent, coordinate) { + var minX = extent[0]; + var minY = extent[1]; + var maxX = extent[2]; + var maxY = extent[3]; + var x = coordinate[0]; + var y = coordinate[1]; + var relationship = _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].UNKNOWN; + if (x < minX) { + relationship = relationship | _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].LEFT; + } + else if (x > maxX) { + relationship = relationship | _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].RIGHT; + } + if (y < minY) { + relationship = relationship | _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].BELOW; + } + else if (y > maxY) { + relationship = relationship | _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].ABOVE; + } + if (relationship === _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].UNKNOWN) { + relationship = _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].INTERSECTING; + } + return relationship; +} +/** + * Create an empty extent. + * @return {Extent} Empty extent. + * @api + */ +function createEmpty() { + return [Infinity, Infinity, -Infinity, -Infinity]; +} +/** + * Create a new extent or update the provided extent. + * @param {number} minX Minimum X. + * @param {number} minY Minimum Y. + * @param {number} maxX Maximum X. + * @param {number} maxY Maximum Y. + * @param {Extent} [opt_extent] Destination extent. + * @return {Extent} Extent. + */ +function createOrUpdate(minX, minY, maxX, maxY, opt_extent) { + if (opt_extent) { + opt_extent[0] = minX; + opt_extent[1] = minY; + opt_extent[2] = maxX; + opt_extent[3] = maxY; + return opt_extent; + } + else { + return [minX, minY, maxX, maxY]; + } +} +/** + * Create a new empty extent or make the provided one empty. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} Extent. + */ +function createOrUpdateEmpty(opt_extent) { + return createOrUpdate(Infinity, Infinity, -Infinity, -Infinity, opt_extent); +} +/** + * @param {import("./coordinate.js").Coordinate} coordinate Coordinate. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} Extent. + */ +function createOrUpdateFromCoordinate(coordinate, opt_extent) { + var x = coordinate[0]; + var y = coordinate[1]; + return createOrUpdate(x, y, x, y, opt_extent); +} +/** + * @param {Array} coordinates Coordinates. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} Extent. + */ +function createOrUpdateFromCoordinates(coordinates, opt_extent) { + var extent = createOrUpdateEmpty(opt_extent); + return extendCoordinates(extent, coordinates); +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} Extent. + */ +function createOrUpdateFromFlatCoordinates(flatCoordinates, offset, end, stride, opt_extent) { + var extent = createOrUpdateEmpty(opt_extent); + return extendFlatCoordinates(extent, flatCoordinates, offset, end, stride); +} +/** + * @param {Array>} rings Rings. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} Extent. + */ +function createOrUpdateFromRings(rings, opt_extent) { + var extent = createOrUpdateEmpty(opt_extent); + return extendRings(extent, rings); +} +/** + * Determine if two extents are equivalent. + * @param {Extent} extent1 Extent 1. + * @param {Extent} extent2 Extent 2. + * @return {boolean} The two extents are equivalent. + * @api + */ +function equals(extent1, extent2) { + return (extent1[0] == extent2[0] && + extent1[2] == extent2[2] && + extent1[1] == extent2[1] && + extent1[3] == extent2[3]); +} +/** + * Determine if two extents are approximately equivalent. + * @param {Extent} extent1 Extent 1. + * @param {Extent} extent2 Extent 2. + * @param {number} tolerance Tolerance in extent coordinate units. + * @return {boolean} The two extents differ by less than the tolerance. + */ +function approximatelyEquals(extent1, extent2, tolerance) { + return (Math.abs(extent1[0] - extent2[0]) < tolerance && + Math.abs(extent1[2] - extent2[2]) < tolerance && + Math.abs(extent1[1] - extent2[1]) < tolerance && + Math.abs(extent1[3] - extent2[3]) < tolerance); +} +/** + * Modify an extent to include another extent. + * @param {Extent} extent1 The extent to be modified. + * @param {Extent} extent2 The extent that will be included in the first. + * @return {Extent} A reference to the first (extended) extent. + * @api + */ +function extend(extent1, extent2) { + if (extent2[0] < extent1[0]) { + extent1[0] = extent2[0]; + } + if (extent2[2] > extent1[2]) { + extent1[2] = extent2[2]; + } + if (extent2[1] < extent1[1]) { + extent1[1] = extent2[1]; + } + if (extent2[3] > extent1[3]) { + extent1[3] = extent2[3]; + } + return extent1; +} +/** + * @param {Extent} extent Extent. + * @param {import("./coordinate.js").Coordinate} coordinate Coordinate. + */ +function extendCoordinate(extent, coordinate) { + if (coordinate[0] < extent[0]) { + extent[0] = coordinate[0]; + } + if (coordinate[0] > extent[2]) { + extent[2] = coordinate[0]; + } + if (coordinate[1] < extent[1]) { + extent[1] = coordinate[1]; + } + if (coordinate[1] > extent[3]) { + extent[3] = coordinate[1]; + } +} +/** + * @param {Extent} extent Extent. + * @param {Array} coordinates Coordinates. + * @return {Extent} Extent. + */ +function extendCoordinates(extent, coordinates) { + for (var i = 0, ii = coordinates.length; i < ii; ++i) { + extendCoordinate(extent, coordinates[i]); + } + return extent; +} +/** + * @param {Extent} extent Extent. + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @return {Extent} Extent. + */ +function extendFlatCoordinates(extent, flatCoordinates, offset, end, stride) { + for (; offset < end; offset += stride) { + extendXY(extent, flatCoordinates[offset], flatCoordinates[offset + 1]); + } + return extent; +} +/** + * @param {Extent} extent Extent. + * @param {Array>} rings Rings. + * @return {Extent} Extent. + */ +function extendRings(extent, rings) { + for (var i = 0, ii = rings.length; i < ii; ++i) { + extendCoordinates(extent, rings[i]); + } + return extent; +} +/** + * @param {Extent} extent Extent. + * @param {number} x X. + * @param {number} y Y. + */ +function extendXY(extent, x, y) { + extent[0] = Math.min(extent[0], x); + extent[1] = Math.min(extent[1], y); + extent[2] = Math.max(extent[2], x); + extent[3] = Math.max(extent[3], y); +} +/** + * This function calls `callback` for each corner of the extent. If the + * callback returns a truthy value the function returns that value + * immediately. Otherwise the function returns `false`. + * @param {Extent} extent Extent. + * @param {function(import("./coordinate.js").Coordinate): S} callback Callback. + * @return {S|boolean} Value. + * @template S + */ +function forEachCorner(extent, callback) { + var val; + val = callback(getBottomLeft(extent)); + if (val) { + return val; + } + val = callback(getBottomRight(extent)); + if (val) { + return val; + } + val = callback(getTopRight(extent)); + if (val) { + return val; + } + val = callback(getTopLeft(extent)); + if (val) { + return val; + } + return false; +} +/** + * Get the size of an extent. + * @param {Extent} extent Extent. + * @return {number} Area. + * @api + */ +function getArea(extent) { + var area = 0; + if (!isEmpty(extent)) { + area = getWidth(extent) * getHeight(extent); + } + return area; +} +/** + * Get the bottom left coordinate of an extent. + * @param {Extent} extent Extent. + * @return {import("./coordinate.js").Coordinate} Bottom left coordinate. + * @api + */ +function getBottomLeft(extent) { + return [extent[0], extent[1]]; +} +/** + * Get the bottom right coordinate of an extent. + * @param {Extent} extent Extent. + * @return {import("./coordinate.js").Coordinate} Bottom right coordinate. + * @api + */ +function getBottomRight(extent) { + return [extent[2], extent[1]]; +} +/** + * Get the center coordinate of an extent. + * @param {Extent} extent Extent. + * @return {import("./coordinate.js").Coordinate} Center. + * @api + */ +function getCenter(extent) { + return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2]; +} +/** + * Get a corner coordinate of an extent. + * @param {Extent} extent Extent. + * @param {Corner} corner Corner. + * @return {import("./coordinate.js").Coordinate} Corner coordinate. + */ +function getCorner(extent, corner) { + var coordinate; + if (corner === 'bottom-left') { + coordinate = getBottomLeft(extent); + } + else if (corner === 'bottom-right') { + coordinate = getBottomRight(extent); + } + else if (corner === 'top-left') { + coordinate = getTopLeft(extent); + } + else if (corner === 'top-right') { + coordinate = getTopRight(extent); + } + else { + Object(_asserts_js__WEBPACK_IMPORTED_MODULE_1__[/* assert */ "a"])(false, 13); // Invalid corner + } + return coordinate; +} +/** + * @param {Extent} extent1 Extent 1. + * @param {Extent} extent2 Extent 2. + * @return {number} Enlarged area. + */ +function getEnlargedArea(extent1, extent2) { + var minX = Math.min(extent1[0], extent2[0]); + var minY = Math.min(extent1[1], extent2[1]); + var maxX = Math.max(extent1[2], extent2[2]); + var maxY = Math.max(extent1[3], extent2[3]); + return (maxX - minX) * (maxY - minY); +} +/** + * @param {import("./coordinate.js").Coordinate} center Center. + * @param {number} resolution Resolution. + * @param {number} rotation Rotation. + * @param {import("./size.js").Size} size Size. + * @param {Extent} [opt_extent] Destination extent. + * @return {Extent} Extent. + */ +function getForViewAndSize(center, resolution, rotation, size, opt_extent) { + var _a = getRotatedViewport(center, resolution, rotation, size), x0 = _a[0], y0 = _a[1], x1 = _a[2], y1 = _a[3], x2 = _a[4], y2 = _a[5], x3 = _a[6], y3 = _a[7]; + return createOrUpdate(Math.min(x0, x1, x2, x3), Math.min(y0, y1, y2, y3), Math.max(x0, x1, x2, x3), Math.max(y0, y1, y2, y3), opt_extent); +} +/** + * @param {import("./coordinate.js").Coordinate} center Center. + * @param {number} resolution Resolution. + * @param {number} rotation Rotation. + * @param {import("./size.js").Size} size Size. + * @return {Array} Linear ring representing the viewport. + */ +function getRotatedViewport(center, resolution, rotation, size) { + var dx = (resolution * size[0]) / 2; + var dy = (resolution * size[1]) / 2; + var cosRotation = Math.cos(rotation); + var sinRotation = Math.sin(rotation); + var xCos = dx * cosRotation; + var xSin = dx * sinRotation; + var yCos = dy * cosRotation; + var ySin = dy * sinRotation; + var x = center[0]; + var y = center[1]; + return [ + x - xCos + ySin, + y - xSin - yCos, + x - xCos - ySin, + y - xSin + yCos, + x + xCos - ySin, + y + xSin + yCos, + x + xCos + ySin, + y + xSin - yCos, + x - xCos + ySin, + y - xSin - yCos, + ]; +} +/** + * Get the height of an extent. + * @param {Extent} extent Extent. + * @return {number} Height. + * @api + */ +function getHeight(extent) { + return extent[3] - extent[1]; +} +/** + * @param {Extent} extent1 Extent 1. + * @param {Extent} extent2 Extent 2. + * @return {number} Intersection area. + */ +function getIntersectionArea(extent1, extent2) { + var intersection = getIntersection(extent1, extent2); + return getArea(intersection); +} +/** + * Get the intersection of two extents. + * @param {Extent} extent1 Extent 1. + * @param {Extent} extent2 Extent 2. + * @param {Extent} [opt_extent] Optional extent to populate with intersection. + * @return {Extent} Intersecting extent. + * @api + */ +function getIntersection(extent1, extent2, opt_extent) { + var intersection = opt_extent ? opt_extent : createEmpty(); + if (intersects(extent1, extent2)) { + if (extent1[0] > extent2[0]) { + intersection[0] = extent1[0]; + } + else { + intersection[0] = extent2[0]; + } + if (extent1[1] > extent2[1]) { + intersection[1] = extent1[1]; + } + else { + intersection[1] = extent2[1]; + } + if (extent1[2] < extent2[2]) { + intersection[2] = extent1[2]; + } + else { + intersection[2] = extent2[2]; + } + if (extent1[3] < extent2[3]) { + intersection[3] = extent1[3]; + } + else { + intersection[3] = extent2[3]; + } + } + else { + createOrUpdateEmpty(intersection); + } + return intersection; +} +/** + * @param {Extent} extent Extent. + * @return {number} Margin. + */ +function getMargin(extent) { + return getWidth(extent) + getHeight(extent); +} +/** + * Get the size (width, height) of an extent. + * @param {Extent} extent The extent. + * @return {import("./size.js").Size} The extent size. + * @api + */ +function getSize(extent) { + return [extent[2] - extent[0], extent[3] - extent[1]]; +} +/** + * Get the top left coordinate of an extent. + * @param {Extent} extent Extent. + * @return {import("./coordinate.js").Coordinate} Top left coordinate. + * @api + */ +function getTopLeft(extent) { + return [extent[0], extent[3]]; +} +/** + * Get the top right coordinate of an extent. + * @param {Extent} extent Extent. + * @return {import("./coordinate.js").Coordinate} Top right coordinate. + * @api + */ +function getTopRight(extent) { + return [extent[2], extent[3]]; +} +/** + * Get the width of an extent. + * @param {Extent} extent Extent. + * @return {number} Width. + * @api + */ +function getWidth(extent) { + return extent[2] - extent[0]; +} +/** + * Determine if one extent intersects another. + * @param {Extent} extent1 Extent 1. + * @param {Extent} extent2 Extent. + * @return {boolean} The two extents intersect. + * @api + */ +function intersects(extent1, extent2) { + return (extent1[0] <= extent2[2] && + extent1[2] >= extent2[0] && + extent1[1] <= extent2[3] && + extent1[3] >= extent2[1]); +} +/** + * Determine if an extent is empty. + * @param {Extent} extent Extent. + * @return {boolean} Is empty. + * @api + */ +function isEmpty(extent) { + return extent[2] < extent[0] || extent[3] < extent[1]; +} +/** + * @param {Extent} extent Extent. + * @param {Extent} [opt_extent] Extent. + * @return {Extent} Extent. + */ +function returnOrUpdate(extent, opt_extent) { + if (opt_extent) { + opt_extent[0] = extent[0]; + opt_extent[1] = extent[1]; + opt_extent[2] = extent[2]; + opt_extent[3] = extent[3]; + return opt_extent; + } + else { + return extent; + } +} +/** + * @param {Extent} extent Extent. + * @param {number} value Value. + */ +function scaleFromCenter(extent, value) { + var deltaX = ((extent[2] - extent[0]) / 2) * (value - 1); + var deltaY = ((extent[3] - extent[1]) / 2) * (value - 1); + extent[0] -= deltaX; + extent[2] += deltaX; + extent[1] -= deltaY; + extent[3] += deltaY; +} +/** + * Determine if the segment between two coordinates intersects (crosses, + * touches, or is contained by) the provided extent. + * @param {Extent} extent The extent. + * @param {import("./coordinate.js").Coordinate} start Segment start coordinate. + * @param {import("./coordinate.js").Coordinate} end Segment end coordinate. + * @return {boolean} The segment intersects the extent. + */ +function intersectsSegment(extent, start, end) { + var intersects = false; + var startRel = coordinateRelationship(extent, start); + var endRel = coordinateRelationship(extent, end); + if (startRel === _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].INTERSECTING || + endRel === _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].INTERSECTING) { + intersects = true; + } + else { + var minX = extent[0]; + var minY = extent[1]; + var maxX = extent[2]; + var maxY = extent[3]; + var startX = start[0]; + var startY = start[1]; + var endX = end[0]; + var endY = end[1]; + var slope = (endY - startY) / (endX - startX); + var x = void 0, y = void 0; + if (!!(endRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].ABOVE) && !(startRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].ABOVE)) { + // potentially intersects top + x = endX - (endY - maxY) / slope; + intersects = x >= minX && x <= maxX; + } + if (!intersects && + !!(endRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].RIGHT) && + !(startRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].RIGHT)) { + // potentially intersects right + y = endY - (endX - maxX) * slope; + intersects = y >= minY && y <= maxY; + } + if (!intersects && + !!(endRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].BELOW) && + !(startRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].BELOW)) { + // potentially intersects bottom + x = endX - (endY - minY) / slope; + intersects = x >= minX && x <= maxX; + } + if (!intersects && + !!(endRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].LEFT) && + !(startRel & _extent_Relationship_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].LEFT)) { + // potentially intersects left + y = endY - (endX - minX) * slope; + intersects = y >= minY && y <= maxY; + } + } + return intersects; +} +/** + * Apply a transform function to the extent. + * @param {Extent} extent Extent. + * @param {import("./proj.js").TransformFunction} transformFn Transform function. + * Called with `[minX, minY, maxX, maxY]` extent coordinates. + * @param {Extent} [opt_extent] Destination extent. + * @param {number} [opt_stops] Number of stops per side used for the transform. + * By default only the corners are used. + * @return {Extent} Extent. + * @api + */ +function applyTransform(extent, transformFn, opt_extent, opt_stops) { + var coordinates = []; + if (opt_stops > 1) { + var width = extent[2] - extent[0]; + var height = extent[3] - extent[1]; + for (var i = 0; i < opt_stops; ++i) { + coordinates.push(extent[0] + (width * i) / opt_stops, extent[1], extent[2], extent[1] + (height * i) / opt_stops, extent[2] - (width * i) / opt_stops, extent[3], extent[0], extent[3] - (height * i) / opt_stops); + } + } + else { + coordinates = [ + extent[0], + extent[1], + extent[2], + extent[1], + extent[2], + extent[3], + extent[0], + extent[3], + ]; + } + transformFn(coordinates, coordinates, 2); + var xs = []; + var ys = []; + for (var i = 0, l = coordinates.length; i < l; i += 2) { + xs.push(coordinates[i]); + ys.push(coordinates[i + 1]); + } + return _boundingExtentXYs(xs, ys, opt_extent); +} +/** + * Modifies the provided extent in-place to be within the real world + * extent. + * + * @param {Extent} extent Extent. + * @param {import("./proj/Projection.js").default} projection Projection + * @return {Extent} The extent within the real world extent. + */ +function wrapX(extent, projection) { + var projectionExtent = projection.getExtent(); + var center = getCenter(extent); + if (projection.canWrapX() && + (center[0] < projectionExtent[0] || center[0] >= projectionExtent[2])) { + var worldWidth = getWidth(projectionExtent); + var worldsAway = Math.floor((center[0] - projectionExtent[0]) / worldWidth); + var offset = worldsAway * worldWidth; + extent[0] -= offset; + extent[2] -= offset; + } + return extent; +} +/** + * Fits the extent to the real world + * + * If the extent does not cross the anti meridian, this will return the extent in an array + * If the extent crosses the anti meridian, the extent will be sliced, so each part fits within the + * real world + * + * + * @param {Extent} extent Extent. + * @param {import("./proj/Projection.js").default} projection Projection + * @return {Array} The extent within the real world extent. + */ +function wrapAndSliceX(extent, projection) { + if (projection.canWrapX()) { + var projectionExtent = projection.getExtent(); + if (!isFinite(extent[0]) || !isFinite(extent[2])) { + return [[projectionExtent[0], extent[1], projectionExtent[2], extent[3]]]; + } + wrapX(extent, projection); + var worldWidth = getWidth(projectionExtent); + if (getWidth(extent) > worldWidth) { + // the extent wraps around on itself + return [[projectionExtent[0], extent[1], projectionExtent[2], extent[3]]]; + } + else if (extent[0] < projectionExtent[0]) { + // the extent crosses the anti meridian, so it needs to be sliced + return [ + [extent[0] + worldWidth, extent[1], projectionExtent[2], extent[3]], + [projectionExtent[0], extent[1], extent[2], extent[3]], + ]; + } + else if (extent[2] > projectionExtent[2]) { + // the extent crosses the anti meridian, so it needs to be sliced + return [ + [extent[0], extent[1], projectionExtent[2], extent[3]], + [projectionExtent[0], extent[1], extent[2] - worldWidth, extent[3]], + ]; + } + } + return [extent]; +} +//# sourceMappingURL=extent.js.map + +/***/ }), + +/***/ "0b0e": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IMAGE_SMOOTHING_DISABLED; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return IMAGE_SMOOTHING_ENABLED; }); +/** + * @module ol/renderer/canvas/common + */ +/** + * Context options to disable image smoothing. + * @type {Object} + */ +var IMAGE_SMOOTHING_DISABLED = { + imageSmoothingEnabled: false, + msImageSmoothingEnabled: false, +}; +/** + * Context options to enable image smoothing. + * @type {Object} + */ +var IMAGE_SMOOTHING_ENABLED = { + imageSmoothingEnabled: true, + msImageSmoothingEnabled: true, +}; +//# sourceMappingURL=common.js.map + +/***/ }), + +/***/ "0b2d": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("01d4"); +/** + * @module ol/MapBrowserEventType + */ + +/** + * Constants for event names. + * @enum {string} + */ +/* harmony default export */ __webpack_exports__["a"] = ({ + /** + * A true single click with no dragging and no double click. Note that this + * event is delayed by 250 ms to ensure that it is not a double click. + * @event module:ol/MapBrowserEvent~MapBrowserEvent#singleclick + * @api + */ + SINGLECLICK: 'singleclick', + /** + * A click with no dragging. A double click will fire two of this. + * @event module:ol/MapBrowserEvent~MapBrowserEvent#click + * @api + */ + CLICK: _events_EventType_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].CLICK, + /** + * A true double click, with no dragging. + * @event module:ol/MapBrowserEvent~MapBrowserEvent#dblclick + * @api + */ + DBLCLICK: _events_EventType_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].DBLCLICK, + /** + * Triggered when a pointer is dragged. + * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointerdrag + * @api + */ + POINTERDRAG: 'pointerdrag', + /** + * Triggered when a pointer is moved. Note that on touch devices this is + * triggered when the map is panned, so is not the same as mousemove. + * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointermove + * @api + */ + POINTERMOVE: 'pointermove', + POINTERDOWN: 'pointerdown', + POINTERUP: 'pointerup', + POINTEROVER: 'pointerover', + POINTEROUT: 'pointerout', + POINTERENTER: 'pointerenter', + POINTERLEAVE: 'pointerleave', + POINTERCANCEL: 'pointercancel', +}); +/*** + * @typedef {'singleclick'|'click'|'dblclick'|'pointerdrag'|'pointermove'} Types + */ +//# sourceMappingURL=MapBrowserEventType.js.map + +/***/ }), + +/***/ "0cfb": +/***/ (function(module, exports, __webpack_require__) { + +var DESCRIPTORS = __webpack_require__("83ab"); +var fails = __webpack_require__("d039"); +var createElement = __webpack_require__("cc12"); + +// Thanks to IE8 for its funny defineProperty +module.exports = !DESCRIPTORS && !fails(function () { + // eslint-disable-next-line es/no-object-defineproperty -- required for testing + return Object.defineProperty(createElement('div'), 'a', { + get: function () { return 7; } + }).a != 7; +}); + + +/***/ }), + +/***/ "0d26": +/***/ (function(module, exports, __webpack_require__) { + +var uncurryThis = __webpack_require__("e330"); + +var $Error = Error; +var replace = uncurryThis(''.replace); + +var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd'); +var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/; +var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST); + +module.exports = function (stack, dropEntries) { + if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) { + while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, ''); + } return stack; +}; + + +/***/ }), + +/***/ "0d51": +/***/ (function(module, exports) { + +var $String = String; + +module.exports = function (argument) { + try { + return $String(argument); + } catch (error) { + return 'Object'; + } +}; + + +/***/ }), + +/***/ "0df5": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* unused harmony export toGeometry */ +/* unused harmony export toFeature */ +/* harmony import */ var _Feature_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("4cdf"); +/* harmony import */ var _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("521b"); +/* harmony import */ var _geom_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("f403"); +/* harmony import */ var _geom_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("9a44"); +/* harmony import */ var _geom_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("7a09"); +/* harmony import */ var _geom_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("47e4"); +/* harmony import */ var _geom_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("88da"); +/* harmony import */ var _geom_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("5bc3"); +/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("a896"); +/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("0af5"); +/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("9f5e"); +/* harmony import */ var _geom_flat_interiorpoint_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("0a9d"); +/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("256f"); +/* harmony import */ var _geom_flat_orient_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("4d98"); +/* harmony import */ var _geom_flat_interpolate_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("b1a2"); +/* harmony import */ var _geom_flat_center_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__("9159"); +/* harmony import */ var _geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("bef8"); +/** + * @module ol/render/Feature + */ + + + + + + + + + + + + +/** + * @type {import("../transform.js").Transform} + */ +var tmpTransform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__[/* create */ "c"])(); +/** + * 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} flatCoordinates Flat coordinates. These always need + * to be right-handed for polygons. + * @param {Array|Array>} ends Ends or Endss. + * @param {Object} 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} + */ + this.flatCoordinates_ = flatCoordinates; + /** + * @private + * @type {Array} + */ + this.flatInteriorPoints_ = null; + /** + * @private + * @type {Array} + */ + this.flatMidpoints_ = null; + /** + * @private + * @type {Array|Array>} + */ + this.ends_ = ends; + /** + * @private + * @type {Object} + */ + 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' + ? Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__[/* createOrUpdateFromCoordinate */ "m"])(this.flatCoordinates_) + : Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__[/* createOrUpdateFromFlatCoordinates */ "n"])(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2); + } + return this.extent_; + }; + /** + * @return {Array} Flat interior points. + */ + RenderFeature.prototype.getFlatInteriorPoint = function () { + if (!this.flatInteriorPoints_) { + var flatCenter = Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__[/* getCenter */ "w"])(this.getExtent()); + this.flatInteriorPoints_ = Object(_geom_flat_interiorpoint_js__WEBPACK_IMPORTED_MODULE_11__[/* getInteriorPointOfArray */ "a"])(this.flatCoordinates_, 0, + /** @type {Array} */ (this.ends_), 2, flatCenter, 0); + } + return this.flatInteriorPoints_; + }; + /** + * @return {Array} Flat interior points. + */ + RenderFeature.prototype.getFlatInteriorPoints = function () { + if (!this.flatInteriorPoints_) { + var flatCenters = Object(_geom_flat_center_js__WEBPACK_IMPORTED_MODULE_15__[/* linearRingss */ "a"])(this.flatCoordinates_, 0, + /** @type {Array>} */ (this.ends_), 2); + this.flatInteriorPoints_ = Object(_geom_flat_interiorpoint_js__WEBPACK_IMPORTED_MODULE_11__[/* getInteriorPointsOfMultiArray */ "b"])(this.flatCoordinates_, 0, + /** @type {Array>} */ (this.ends_), 2, flatCenters); + } + return this.flatInteriorPoints_; + }; + /** + * @return {Array} Flat midpoint. + */ + RenderFeature.prototype.getFlatMidpoint = function () { + if (!this.flatMidpoints_) { + this.flatMidpoints_ = Object(_geom_flat_interpolate_js__WEBPACK_IMPORTED_MODULE_14__[/* interpolatePoint */ "a"])(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2, 0.5); + } + return this.flatMidpoints_; + }; + /** + * @return {Array} Flat midpoints. + */ + RenderFeature.prototype.getFlatMidpoints = function () { + if (!this.flatMidpoints_) { + this.flatMidpoints_ = []; + var flatCoordinates = this.flatCoordinates_; + var offset = 0; + var ends = /** @type {Array} */ (this.ends_); + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + var midpoint = Object(_geom_flat_interpolate_js__WEBPACK_IMPORTED_MODULE_14__[/* interpolatePoint */ "a"])(flatCoordinates, offset, end, 2, 0.5); + Object(_array_js__WEBPACK_IMPORTED_MODULE_10__[/* extend */ "c"])(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} 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} 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 = Object(_proj_js__WEBPACK_IMPORTED_MODULE_12__[/* get */ "h"])(projection); + var pixelExtent = projection.getExtent(); + var projectedExtent = projection.getWorldExtent(); + if (pixelExtent && projectedExtent) { + var scale = Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__[/* getHeight */ "z"])(projectedExtent) / Object(_extent_js__WEBPACK_IMPORTED_MODULE_9__[/* getHeight */ "z"])(pixelExtent); + Object(_transform_js__WEBPACK_IMPORTED_MODULE_8__[/* compose */ "b"])(tmpTransform, projectedExtent[0], projectedExtent[3], scale, -scale, 0, 0, 0); + Object(_geom_flat_transform_js__WEBPACK_IMPORTED_MODULE_16__[/* transform2D */ "c"])(this.flatCoordinates_, 0, this.flatCoordinates_.length, 2, tmpTransform, this.flatCoordinates_); + } + }; + /** + * @return {Array|Array>} Ends or endss. + */ + RenderFeature.prototype.getEnds = function () { + return this.ends_; + }; + return RenderFeature; +}()); +RenderFeature.prototype.getEndss = RenderFeature.prototype.getEnds; +/** + * @return {Array} 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 + */ +function toGeometry(renderFeature) { + var geometryType = renderFeature.getType(); + switch (geometryType) { + case 'Point': + return new _geom_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"](renderFeature.getFlatCoordinates()); + case 'MultiPoint': + return new _geom_js__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"](renderFeature.getFlatCoordinates(), _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].XY); + case 'LineString': + return new _geom_js__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"](renderFeature.getFlatCoordinates(), _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].XY); + case 'MultiLineString': + return new _geom_js__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"](renderFeature.getFlatCoordinates(), _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].XY, + /** @type {Array} */ (renderFeature.getEnds())); + case 'Polygon': + var flatCoordinates = renderFeature.getFlatCoordinates(); + var ends = /** @type {Array} */ (renderFeature.getEnds()); + var endss = Object(_geom_flat_orient_js__WEBPACK_IMPORTED_MODULE_13__[/* inflateEnds */ "a"])(flatCoordinates, ends); + return endss.length > 1 + ? new _geom_js__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].XY, endss) + : new _geom_js__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"](flatCoordinates, _geom_GeometryLayout_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].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 + */ +function toFeature(renderFeature, opt_geometryName) { + var id = renderFeature.getId(); + var geometry = toGeometry(renderFeature); + var properties = renderFeature.getProperties(); + var feature = new _Feature_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"](); + if (opt_geometryName !== undefined) { + feature.setGeometryName(opt_geometryName); + } + feature.setGeometry(geometry); + if (id !== undefined) { + feature.setId(id); + } + feature.setProperties(properties, true); + return feature; +} +/* harmony default export */ __webpack_exports__["a"] = (RenderFeature); +//# sourceMappingURL=Feature.js.map + +/***/ }), + +/***/ "0ec0": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var _Disposable_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("da5c"); +/* harmony import */ var _Event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("cef7"); +/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("57cb"); +/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("38f3"); +var __extends = (undefined && undefined.__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/events/Target + */ + + + + +/** + * @typedef {EventTarget|Target} EventTargetLike + */ +/** + * @classdesc + * A simplified implementation of the W3C DOM Level 2 EventTarget interface. + * See https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget. + * + * There are two important simplifications compared to the specification: + * + * 1. The handling of `useCapture` in `addEventListener` and + * `removeEventListener`. There is no real capture model. + * 2. The handling of `stopPropagation` and `preventDefault` on `dispatchEvent`. + * There is no event target hierarchy. When a listener calls + * `stopPropagation` or `preventDefault` on an event object, it means that no + * more listeners after this one will be called. Same as when the listener + * returns false. + */ +var Target = /** @class */ (function (_super) { + __extends(Target, _super); + /** + * @param {*} [opt_target] Default event target for dispatched events. + */ + function Target(opt_target) { + var _this = _super.call(this) || this; + /** + * @private + * @type {*} + */ + _this.eventTarget_ = opt_target; + /** + * @private + * @type {Object} + */ + _this.pendingRemovals_ = null; + /** + * @private + * @type {Object} + */ + _this.dispatching_ = null; + /** + * @private + * @type {Object>} + */ + _this.listeners_ = null; + return _this; + } + /** + * @param {string} type Type. + * @param {import("../events.js").Listener} listener Listener. + */ + Target.prototype.addEventListener = function (type, listener) { + if (!type || !listener) { + return; + } + var listeners = this.listeners_ || (this.listeners_ = {}); + var listenersForType = listeners[type] || (listeners[type] = []); + if (listenersForType.indexOf(listener) === -1) { + listenersForType.push(listener); + } + }; + /** + * Dispatches an event and calls all listeners listening for events + * of this type. The event parameter can either be a string or an + * Object with a `type` property. + * + * @param {import("./Event.js").default|string} event Event object. + * @return {boolean|undefined} `false` if anyone called preventDefault on the + * event object or if any of the listeners returned false. + * @api + */ + Target.prototype.dispatchEvent = function (event) { + var isString = typeof event === 'string'; + var type = isString ? event : event.type; + var listeners = this.listeners_ && this.listeners_[type]; + if (!listeners) { + return; + } + var evt = isString ? new _Event_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"](event) : /** @type {Event} */ (event); + if (!evt.target) { + evt.target = this.eventTarget_ || this; + } + var dispatching = this.dispatching_ || (this.dispatching_ = {}); + var pendingRemovals = this.pendingRemovals_ || (this.pendingRemovals_ = {}); + if (!(type in dispatching)) { + dispatching[type] = 0; + pendingRemovals[type] = 0; + } + ++dispatching[type]; + var propagate; + for (var i = 0, ii = listeners.length; i < ii; ++i) { + if ('handleEvent' in listeners[i]) { + propagate = /** @type {import("../events.js").ListenerObject} */ (listeners[i]).handleEvent(evt); + } + else { + propagate = /** @type {import("../events.js").ListenerFunction} */ (listeners[i]).call(this, evt); + } + if (propagate === false || evt.propagationStopped) { + propagate = false; + break; + } + } + if (--dispatching[type] === 0) { + var pr = pendingRemovals[type]; + delete pendingRemovals[type]; + while (pr--) { + this.removeEventListener(type, _functions_js__WEBPACK_IMPORTED_MODULE_2__[/* VOID */ "c"]); + } + delete dispatching[type]; + } + return propagate; + }; + /** + * Clean up. + */ + Target.prototype.disposeInternal = function () { + this.listeners_ && Object(_obj_js__WEBPACK_IMPORTED_MODULE_3__[/* clear */ "b"])(this.listeners_); + }; + /** + * Get the listeners for a specified event type. Listeners are returned in the + * order that they will be called in. + * + * @param {string} type Type. + * @return {Array|undefined} Listeners. + */ + Target.prototype.getListeners = function (type) { + return (this.listeners_ && this.listeners_[type]) || undefined; + }; + /** + * @param {string} [opt_type] Type. If not provided, + * `true` will be returned if this event target has any listeners. + * @return {boolean} Has listeners. + */ + Target.prototype.hasListener = function (opt_type) { + if (!this.listeners_) { + return false; + } + return opt_type + ? opt_type in this.listeners_ + : Object.keys(this.listeners_).length > 0; + }; + /** + * @param {string} type Type. + * @param {import("../events.js").Listener} listener Listener. + */ + Target.prototype.removeEventListener = function (type, listener) { + var listeners = this.listeners_ && this.listeners_[type]; + if (listeners) { + var index = listeners.indexOf(listener); + if (index !== -1) { + if (this.pendingRemovals_ && type in this.pendingRemovals_) { + // make listener a no-op, and remove later in #dispatchEvent() + listeners[index] = _functions_js__WEBPACK_IMPORTED_MODULE_2__[/* VOID */ "c"]; + ++this.pendingRemovals_[type]; + } + else { + listeners.splice(index, 1); + if (listeners.length === 0) { + delete this.listeners_[type]; + } + } + } + } + }; + return Target; +}(_Disposable_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])); +/* harmony default export */ __webpack_exports__["a"] = (Target); +//# sourceMappingURL=Target.js.map + +/***/ }), + +/***/ "10b7": +/***/ (function(module, exports, __webpack_require__) { + +;(function (root, factory) { + if (true) { + // CommonJS + module.exports = exports = factory(__webpack_require__("21bf")); + } + else {} +}(this, function (CryptoJS) { + + /** @preserve + (c) 2012 by Cédric Mesnil. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Constants table + var _zl = WordArray.create([ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]); + var _zr = WordArray.create([ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]); + var _sl = WordArray.create([ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]); + var _sr = WordArray.create([ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]); + + var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]); + var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]); + + /** + * RIPEMD160 hash algorithm. + */ + var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({ + _doReset: function () { + this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]); + }, + + _doProcessBlock: function (M, offset) { + + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + + // Swap + M[offset_i] = ( + (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | + (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) + ); + } + // Shortcut + var H = this._hash.words; + var hl = _hl.words; + var hr = _hr.words; + var zl = _zl.words; + var zr = _zr.words; + var sl = _sl.words; + var sr = _sr.words; + + // Working variables + var al, bl, cl, dl, el; + var ar, br, cr, dr, er; + + ar = al = H[0]; + br = bl = H[1]; + cr = cl = H[2]; + dr = dl = H[3]; + er = el = H[4]; + // Computation + var t; + for (var i = 0; i < 80; i += 1) { + t = (al + M[offset+zl[i]])|0; + if (i<16){ + t += f1(bl,cl,dl) + hl[0]; + } else if (i<32) { + t += f2(bl,cl,dl) + hl[1]; + } else if (i<48) { + t += f3(bl,cl,dl) + hl[2]; + } else if (i<64) { + t += f4(bl,cl,dl) + hl[3]; + } else {// if (i<80) { + t += f5(bl,cl,dl) + hl[4]; + } + t = t|0; + t = rotl(t,sl[i]); + t = (t+el)|0; + al = el; + el = dl; + dl = rotl(cl, 10); + cl = bl; + bl = t; + + t = (ar + M[offset+zr[i]])|0; + if (i<16){ + t += f5(br,cr,dr) + hr[0]; + } else if (i<32) { + t += f4(br,cr,dr) + hr[1]; + } else if (i<48) { + t += f3(br,cr,dr) + hr[2]; + } else if (i<64) { + t += f2(br,cr,dr) + hr[3]; + } else {// if (i<80) { + t += f1(br,cr,dr) + hr[4]; + } + t = t|0; + t = rotl(t,sr[i]) ; + t = (t+er)|0; + ar = er; + er = dr; + dr = rotl(cr, 10); + cr = br; + br = t; + } + // Intermediate hash value + t = (H[1] + cl + dr)|0; + H[1] = (H[2] + dl + er)|0; + H[2] = (H[3] + el + ar)|0; + H[3] = (H[4] + al + br)|0; + H[4] = (H[0] + bl + cr)|0; + H[0] = t; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( + (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | + (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) + ); + data.sigBytes = (dataWords.length + 1) * 4; + + // Hash final blocks + this._process(); + + // Shortcuts + var hash = this._hash; + var H = hash.words; + + // Swap endian + for (var i = 0; i < 5; i++) { + // Shortcut + var H_i = H[i]; + + // Swap + H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | + (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); + } + + // Return final computed hash + return hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + + function f1(x, y, z) { + return ((x) ^ (y) ^ (z)); + + } + + function f2(x, y, z) { + return (((x)&(y)) | ((~x)&(z))); + } + + function f3(x, y, z) { + return (((x) | (~(y))) ^ (z)); + } + + function f4(x, y, z) { + return (((x) & (z)) | ((y)&(~(z)))); + } + + function f5(x, y, z) { + return ((x) ^ ((y) |(~(z)))); + + } + + function rotl(x,n) { + return (x<>>(32-n)); + } + + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.RIPEMD160('message'); + * var hash = CryptoJS.RIPEMD160(wordArray); + */ + C.RIPEMD160 = Hasher._createHelper(RIPEMD160); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacRIPEMD160(message, key); + */ + C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160); + }(Math)); + + + return CryptoJS.RIPEMD160; + +})); + +/***/ }), + +/***/ "1132": +/***/ (function(module, exports, __webpack_require__) { + +;(function (root, factory) { + if (true) { + // CommonJS + module.exports = exports = factory(__webpack_require__("21bf")); + } + else {} +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + + /** + * Base64 encoding strategy. + */ + var Base64 = C_enc.Base64 = { + /** + * Converts a word array to a Base64 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Base64 string. + * + * @static + * + * @example + * + * var base64String = CryptoJS.enc.Base64.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + var map = this._map; + + // Clamp excess bits + wordArray.clamp(); + + // Convert + var base64Chars = []; + for (var i = 0; i < sigBytes; i += 3) { + var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; + var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; + + var triplet = (byte1 << 16) | (byte2 << 8) | byte3; + + for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { + base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); + } + } + + // Add padding + var paddingChar = map.charAt(64); + if (paddingChar) { + while (base64Chars.length % 4) { + base64Chars.push(paddingChar); + } + } + + return base64Chars.join(''); + }, + + /** + * Converts a Base64 string to a word array. + * + * @param {string} base64Str The Base64 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Base64.parse(base64String); + */ + parse: function (base64Str) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = this._map; + var reverseMap = this._reverseMap; + + if (!reverseMap) { + reverseMap = this._reverseMap = []; + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } + + // Ignore padding + var paddingChar = map.charAt(64); + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } + + // Convert + return parseLoop(base64Str, base64StrLength, reverseMap); + + }, + + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' + }; + + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); + var bitsCombined = bits1 | bits2; + words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8); + nBytes++; + } + } + return WordArray.create(words, nBytes); + } + }()); + + + return CryptoJS.enc.Base64; + +})); + +/***/ }), + +/***/ "1300": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return abstract; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getUid; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return VERSION; }); +/** + * @module ol/util + */ +/** + * @return {?} Any return. + */ +function abstract() { + return /** @type {?} */ ((function () { + throw new Error('Unimplemented abstract method.'); + })()); +} +/** + * Counter for getUid. + * @type {number} + * @private + */ +var uidCounter_ = 0; +/** + * Gets a unique ID for an object. This mutates the object so that further calls + * with the same object as a parameter returns the same value. Unique IDs are generated + * as a strictly increasing sequence. Adapted from goog.getUid. + * + * @param {Object} obj The object to get the unique ID for. + * @return {string} The unique ID for the object. + * @api + */ +function getUid(obj) { + return obj.ol_uid || (obj.ol_uid = String(++uidCounter_)); +} +/** + * OpenLayers version. + * @type {string} + */ +var VERSION = '6.15.1'; +//# sourceMappingURL=util.js.map + +/***/ }), + +/***/ "137e": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return canvasPool; }); +/* harmony import */ var _Layer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("faf4"); +/* harmony import */ var _render_Event_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("3333"); +/* harmony import */ var _render_EventType_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("070d"); +/* harmony import */ var _transform_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("a896"); +/* harmony import */ var _color_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("5c38"); +/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("0af5"); +/* harmony import */ var _dom_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("0999"); +/* harmony import */ var _array_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("9f5e"); +var __extends = (undefined && undefined.__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/renderer/canvas/Layer + */ + + + + + + + + +/** + * @type {Array} + */ +var canvasPool = []; +/** + * @type {CanvasRenderingContext2D} + */ +var pixelContext = null; +function createPixelContext() { + var canvas = document.createElement('canvas'); + canvas.width = 1; + canvas.height = 1; + pixelContext = canvas.getContext('2d'); +} +/** + * @abstract + * @template {import("../../layer/Layer.js").default} LayerType + * @extends {LayerRenderer} + */ +var CanvasLayerRenderer = /** @class */ (function (_super) { + __extends(CanvasLayerRenderer, _super); + /** + * @param {LayerType} layer Layer. + */ + function CanvasLayerRenderer(layer) { + var _this = _super.call(this, layer) || this; + /** + * @protected + * @type {HTMLElement} + */ + _this.container = null; + /** + * @protected + * @type {number} + */ + _this.renderedResolution; + /** + * A temporary transform. The values in this transform should only be used in a + * function that sets the values. + * @protected + * @type {import("../../transform.js").Transform} + */ + _this.tempTransform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_3__[/* create */ "c"])(); + /** + * The transform for rendered pixels to viewport CSS pixels. This transform must + * be set when rendering a frame and may be used by other functions after rendering. + * @protected + * @type {import("../../transform.js").Transform} + */ + _this.pixelTransform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_3__[/* create */ "c"])(); + /** + * The transform for viewport CSS pixels to rendered pixels. This transform must + * be set when rendering a frame and may be used by other functions after rendering. + * @protected + * @type {import("../../transform.js").Transform} + */ + _this.inversePixelTransform = Object(_transform_js__WEBPACK_IMPORTED_MODULE_3__[/* create */ "c"])(); + /** + * @type {CanvasRenderingContext2D} + */ + _this.context = null; + /** + * @type {boolean} + */ + _this.containerReused = false; + /** + * @private + * @type {CanvasRenderingContext2D} + */ + _this.pixelContext_ = null; + /** + * @protected + * @type {import("../../PluggableMap.js").FrameState|null} + */ + _this.frameState = null; + return _this; + } + /** + * @param {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} image Image. + * @param {number} col The column index. + * @param {number} row The row index. + * @return {Uint8ClampedArray|null} The image data. + */ + CanvasLayerRenderer.prototype.getImageData = function (image, col, row) { + if (!pixelContext) { + createPixelContext(); + } + pixelContext.clearRect(0, 0, 1, 1); + var data; + try { + pixelContext.drawImage(image, col, row, 1, 1, 0, 0, 1, 1); + data = pixelContext.getImageData(0, 0, 1, 1).data; + } + catch (err) { + pixelContext = null; + return null; + } + return data; + }; + /** + * @param {import('../../PluggableMap.js').FrameState} frameState Frame state. + * @return {string} Background color. + */ + CanvasLayerRenderer.prototype.getBackground = function (frameState) { + var layer = this.getLayer(); + var background = layer.getBackground(); + if (typeof background === 'function') { + background = background(frameState.viewState.resolution); + } + return background || undefined; + }; + /** + * Get a rendering container from an existing target, if compatible. + * @param {HTMLElement} target Potential render target. + * @param {string} transform CSS Transform. + * @param {string} [opt_backgroundColor] Background color. + */ + CanvasLayerRenderer.prototype.useContainer = function (target, transform, opt_backgroundColor) { + var layerClassName = this.getLayer().getClassName(); + var container, context; + if (target && + target.className === layerClassName && + (!opt_backgroundColor || + (target && + target.style.backgroundColor && + Object(_array_js__WEBPACK_IMPORTED_MODULE_7__[/* equals */ "b"])(Object(_color_js__WEBPACK_IMPORTED_MODULE_4__[/* asArray */ "a"])(target.style.backgroundColor), Object(_color_js__WEBPACK_IMPORTED_MODULE_4__[/* asArray */ "a"])(opt_backgroundColor))))) { + var canvas = target.firstElementChild; + if (canvas instanceof HTMLCanvasElement) { + context = canvas.getContext('2d'); + } + } + if (context && context.canvas.style.transform === transform) { + // Container of the previous layer renderer can be used. + this.container = target; + this.context = context; + this.containerReused = true; + } + else if (this.containerReused) { + // Previously reused container cannot be used any more. + this.container = null; + this.context = null; + this.containerReused = false; + } + if (!this.container) { + container = document.createElement('div'); + container.className = layerClassName; + var style = container.style; + style.position = 'absolute'; + style.width = '100%'; + style.height = '100%'; + context = Object(_dom_js__WEBPACK_IMPORTED_MODULE_6__[/* createCanvasContext2D */ "a"])(); + var canvas = context.canvas; + container.appendChild(canvas); + style = canvas.style; + style.position = 'absolute'; + style.left = '0'; + style.transformOrigin = 'top left'; + this.container = container; + this.context = context; + } + if (!this.containerReused && + opt_backgroundColor && + !this.container.style.backgroundColor) { + this.container.style.backgroundColor = opt_backgroundColor; + } + }; + /** + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {import("../../extent.js").Extent} extent Clip extent. + * @protected + */ + CanvasLayerRenderer.prototype.clipUnrotated = function (context, frameState, extent) { + var topLeft = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__[/* getTopLeft */ "C"])(extent); + var topRight = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__[/* getTopRight */ "D"])(extent); + var bottomRight = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__[/* getBottomRight */ "v"])(extent); + var bottomLeft = Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__[/* getBottomLeft */ "u"])(extent); + Object(_transform_js__WEBPACK_IMPORTED_MODULE_3__[/* apply */ "a"])(frameState.coordinateToPixelTransform, topLeft); + Object(_transform_js__WEBPACK_IMPORTED_MODULE_3__[/* apply */ "a"])(frameState.coordinateToPixelTransform, topRight); + Object(_transform_js__WEBPACK_IMPORTED_MODULE_3__[/* apply */ "a"])(frameState.coordinateToPixelTransform, bottomRight); + Object(_transform_js__WEBPACK_IMPORTED_MODULE_3__[/* apply */ "a"])(frameState.coordinateToPixelTransform, bottomLeft); + var inverted = this.inversePixelTransform; + Object(_transform_js__WEBPACK_IMPORTED_MODULE_3__[/* apply */ "a"])(inverted, topLeft); + Object(_transform_js__WEBPACK_IMPORTED_MODULE_3__[/* apply */ "a"])(inverted, topRight); + Object(_transform_js__WEBPACK_IMPORTED_MODULE_3__[/* apply */ "a"])(inverted, bottomRight); + Object(_transform_js__WEBPACK_IMPORTED_MODULE_3__[/* apply */ "a"])(inverted, bottomLeft); + context.save(); + context.beginPath(); + context.moveTo(Math.round(topLeft[0]), Math.round(topLeft[1])); + context.lineTo(Math.round(topRight[0]), Math.round(topRight[1])); + context.lineTo(Math.round(bottomRight[0]), Math.round(bottomRight[1])); + context.lineTo(Math.round(bottomLeft[0]), Math.round(bottomLeft[1])); + context.clip(); + }; + /** + * @param {import("../../render/EventType.js").default} type Event type. + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @private + */ + CanvasLayerRenderer.prototype.dispatchRenderEvent_ = function (type, context, frameState) { + var layer = this.getLayer(); + if (layer.hasListener(type)) { + var event_1 = new _render_Event_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"](type, this.inversePixelTransform, frameState, context); + layer.dispatchEvent(event_1); + } + }; + /** + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @protected + */ + CanvasLayerRenderer.prototype.preRender = function (context, frameState) { + this.frameState = frameState; + this.dispatchRenderEvent_(_render_EventType_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].PRERENDER, context, frameState); + }; + /** + * @param {CanvasRenderingContext2D} context Context. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @protected + */ + CanvasLayerRenderer.prototype.postRender = function (context, frameState) { + this.dispatchRenderEvent_(_render_EventType_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].POSTRENDER, context, frameState); + }; + /** + * Creates a transform for rendering to an element that will be rotated after rendering. + * @param {import("../../coordinate.js").Coordinate} center Center. + * @param {number} resolution Resolution. + * @param {number} rotation Rotation. + * @param {number} pixelRatio Pixel ratio. + * @param {number} width Width of the rendered element (in pixels). + * @param {number} height Height of the rendered element (in pixels). + * @param {number} offsetX Offset on the x-axis in view coordinates. + * @protected + * @return {!import("../../transform.js").Transform} Transform. + */ + CanvasLayerRenderer.prototype.getRenderTransform = function (center, resolution, rotation, pixelRatio, width, height, offsetX) { + var dx1 = width / 2; + var dy1 = height / 2; + var sx = pixelRatio / resolution; + var sy = -sx; + var dx2 = -center[0] + offsetX; + var dy2 = -center[1]; + return Object(_transform_js__WEBPACK_IMPORTED_MODULE_3__[/* compose */ "b"])(this.tempTransform, dx1, dy1, sx, sy, -rotation, dx2, dy2); + }; + /** + * @param {import("../../pixel.js").Pixel} pixel Pixel. + * @param {import("../../PluggableMap.js").FrameState} frameState FrameState. + * @param {number} hitTolerance Hit tolerance in pixels. + * @return {Uint8ClampedArray|Uint8Array} The result. If there is no data at the pixel + * location, null will be returned. If there is data, but pixel values cannot be + * returned, and empty array will be returned. + */ + CanvasLayerRenderer.prototype.getDataAtPixel = function (pixel, frameState, hitTolerance) { + var renderPixel = Object(_transform_js__WEBPACK_IMPORTED_MODULE_3__[/* apply */ "a"])(this.inversePixelTransform, pixel.slice()); + var context = this.context; + var layer = this.getLayer(); + var layerExtent = layer.getExtent(); + if (layerExtent) { + var renderCoordinate = Object(_transform_js__WEBPACK_IMPORTED_MODULE_3__[/* apply */ "a"])(frameState.pixelToCoordinateTransform, pixel.slice()); + /** get only data inside of the layer extent */ + if (!Object(_extent_js__WEBPACK_IMPORTED_MODULE_5__[/* containsCoordinate */ "f"])(layerExtent, renderCoordinate)) { + return null; + } + } + var x = Math.round(renderPixel[0]); + var y = Math.round(renderPixel[1]); + var pixelContext = this.pixelContext_; + if (!pixelContext) { + var pixelCanvas = document.createElement('canvas'); + pixelCanvas.width = 1; + pixelCanvas.height = 1; + pixelContext = pixelCanvas.getContext('2d'); + this.pixelContext_ = pixelContext; + } + pixelContext.clearRect(0, 0, 1, 1); + var data; + try { + pixelContext.drawImage(context.canvas, x, y, 1, 1, 0, 0, 1, 1); + data = pixelContext.getImageData(0, 0, 1, 1).data; + } + catch (err) { + if (err.name === 'SecurityError') { + // tainted canvas, we assume there is data at the given pixel (although there might not be) + this.pixelContext_ = null; + return new Uint8Array(); + } + return data; + } + if (data[3] === 0) { + return null; + } + return data; + }; + /** + * Clean up. + */ + CanvasLayerRenderer.prototype.disposeInternal = function () { + delete this.frameState; + _super.prototype.disposeInternal.call(this); + }; + return CanvasLayerRenderer; +}(_Layer_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])); +/* harmony default export */ __webpack_exports__["b"] = (CanvasLayerRenderer); +//# sourceMappingURL=Layer.js.map + +/***/ }), + +/***/ "1382": +/***/ (function(module, exports, __webpack_require__) { + +;(function (root, factory, undef) { + if (true) { + // CommonJS + module.exports = exports = factory(__webpack_require__("21bf"), __webpack_require__("1132"), __webpack_require__("72fe"), __webpack_require__("2b79"), __webpack_require__("38ba")); + } + else {} +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var StreamCipher = C_lib.StreamCipher; + var C_algo = C.algo; + + // Reusable objects + var S = []; + var C_ = []; + var G = []; + + /** + * Rabbit stream cipher algorithm + */ + var Rabbit = C_algo.Rabbit = StreamCipher.extend({ + _doReset: function () { + // Shortcuts + var K = this._key.words; + var iv = this.cfg.iv; + + // Swap endian + for (var i = 0; i < 4; i++) { + K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) | + (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00); + } + + // Generate initial state values + var X = this._X = [ + K[0], (K[3] << 16) | (K[2] >>> 16), + K[1], (K[0] << 16) | (K[3] >>> 16), + K[2], (K[1] << 16) | (K[0] >>> 16), + K[3], (K[2] << 16) | (K[1] >>> 16) + ]; + + // Generate initial counter values + var C = this._C = [ + (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), + (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), + (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), + (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) + ]; + + // Carry bit + this._b = 0; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + + // Modify the counters + for (var i = 0; i < 8; i++) { + C[i] ^= X[(i + 4) & 7]; + } + + // IV setup + if (iv) { + // Shortcuts + var IV = iv.words; + var IV_0 = IV[0]; + var IV_1 = IV[1]; + + // Generate four subvectors + var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); + var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); + var i1 = (i0 >>> 16) | (i2 & 0xffff0000); + var i3 = (i2 << 16) | (i0 & 0x0000ffff); + + // Modify counter values + C[0] ^= i0; + C[1] ^= i1; + C[2] ^= i2; + C[3] ^= i3; + C[4] ^= i0; + C[5] ^= i1; + C[6] ^= i2; + C[7] ^= i3; + + // Iterate the system four times + for (var i = 0; i < 4; i++) { + nextState.call(this); + } + } + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var X = this._X; + + // Iterate the system + nextState.call(this); + + // Generate four keystream words + S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); + S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); + S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); + S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); + + for (var i = 0; i < 4; i++) { + // Swap endian + S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | + (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); + + // Encrypt + M[offset + i] ^= S[i]; + } + }, + + blockSize: 128/32, + + ivSize: 64/32 + }); + + function nextState() { + // Shortcuts + var X = this._X; + var C = this._C; + + // Save old counter values + for (var i = 0; i < 8; i++) { + C_[i] = C[i]; + } + + // Calculate new counter values + C[0] = (C[0] + 0x4d34d34d + this._b) | 0; + C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; + C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; + C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; + C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; + C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; + C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; + C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; + this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; + + // Calculate the g-values + for (var i = 0; i < 8; i++) { + var gx = X[i] + C[i]; + + // Construct high and low argument for squaring + var ga = gx & 0xffff; + var gb = gx >>> 16; + + // Calculate high and low result of squaring + var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; + var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); + + // High XOR low + G[i] = gh ^ gl; + } + + // Calculate new state values + X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; + X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; + X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; + X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; + X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; + X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; + X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; + X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; + } + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg); + * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg); + */ + C.Rabbit = StreamCipher._createHelper(Rabbit); + }()); + + + return CryptoJS.Rabbit; + +})); + +/***/ }), + +/***/ "13d2": +/***/ (function(module, exports, __webpack_require__) { + +var uncurryThis = __webpack_require__("e330"); +var fails = __webpack_require__("d039"); +var isCallable = __webpack_require__("1626"); +var hasOwn = __webpack_require__("1a2d"); +var DESCRIPTORS = __webpack_require__("83ab"); +var CONFIGURABLE_FUNCTION_NAME = __webpack_require__("5e77").CONFIGURABLE; +var inspectSource = __webpack_require__("8925"); +var InternalStateModule = __webpack_require__("69f3"); + +var enforceInternalState = InternalStateModule.enforce; +var getInternalState = InternalStateModule.get; +var $String = String; +// eslint-disable-next-line es/no-object-defineproperty -- safe +var defineProperty = Object.defineProperty; +var stringSlice = uncurryThis(''.slice); +var replace = uncurryThis(''.replace); +var join = uncurryThis([].join); + +var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () { + return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8; +}); + +var TEMPLATE = String(String).split('String'); + +var makeBuiltIn = module.exports = function (value, name, options) { + if (stringSlice($String(name), 0, 7) === 'Symbol(') { + name = '[' + replace($String(name), /^Symbol\(([^)]*)\)/, '$1') + ']'; + } + if (options && options.getter) name = 'get ' + name; + if (options && options.setter) name = 'set ' + name; + if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) { + if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true }); + else value.name = name; + } + if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) { + defineProperty(value, 'length', { value: options.arity }); + } + try { + if (options && hasOwn(options, 'constructor') && options.constructor) { + if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false }); + // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable + } else if (value.prototype) value.prototype = undefined; + } catch (error) { /* empty */ } + var state = enforceInternalState(value); + if (!hasOwn(state, 'source')) { + state.source = join(TEMPLATE, typeof name == 'string' ? name : ''); + } return value; +}; + +// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative +// eslint-disable-next-line no-extend-native -- required +Function.prototype.toString = makeBuiltIn(function toString() { + return isCallable(this) && getInternalState(this).source || inspectSource(this); +}, 'toString'); + + +/***/ }), + +/***/ "14d9": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var $ = __webpack_require__("23e7"); +var toObject = __webpack_require__("7b0b"); +var lengthOfArrayLike = __webpack_require__("07fa"); +var setArrayLength = __webpack_require__("3a34"); +var doesNotExceedSafeInteger = __webpack_require__("3511"); +var fails = __webpack_require__("d039"); + +var INCORRECT_TO_LENGTH = fails(function () { + return [].push.call({ length: 0x100000000 }, 1) !== 4294967297; +}); + +// V8 and Safari <= 15.4, FF < 23 throws InternalError +// https://bugs.chromium.org/p/v8/issues/detail?id=12681 +var properErrorOnNonWritableLength = function () { + try { + // eslint-disable-next-line es/no-object-defineproperty -- safe + Object.defineProperty([], 'length', { writable: false }).push(); + } catch (error) { + return error instanceof TypeError; + } +}; + +var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength(); + +// `Array.prototype.push` method +// https://tc39.es/ecma262/#sec-array.prototype.push +$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + push: function push(item) { + var O = toObject(this); + var len = lengthOfArrayLike(O); + var argCount = arguments.length; + doesNotExceedSafeInteger(len + argCount); + for (var i = 0; i < argCount; i++) { + O[len] = arguments[i]; + len++; + } + setArrayLength(O, len); + return len; + } +}); + + +/***/ }), + +/***/ "1626": +/***/ (function(module, exports, __webpack_require__) { + +var $documentAll = __webpack_require__("8ea1"); + +var documentAll = $documentAll.all; + +// `IsCallable` abstract operation +// https://tc39.es/ecma262/#sec-iscallable +module.exports = $documentAll.IS_HTMLDDA ? function (argument) { + return typeof argument == 'function' || argument === documentAll; +} : function (argument) { + return typeof argument == 'function'; +}; + + +/***/ }), + +/***/ "17e1": +/***/ (function(module, exports, __webpack_require__) { + +;(function (root, factory) { + if (true) { + // CommonJS + module.exports = exports = factory(__webpack_require__("21bf")); + } + else {} +}(this, function (CryptoJS) { + + (function () { + // Check if typed arrays are supported + if (typeof ArrayBuffer != 'function') { + return; + } + + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + + // Reference original init + var superInit = WordArray.init; + + // Augment WordArray.init to handle typed arrays + var subInit = WordArray.init = function (typedArray) { + // Convert buffers to uint8 + if (typedArray instanceof ArrayBuffer) { + typedArray = new Uint8Array(typedArray); + } + + // Convert other array views to uint8 + if ( + typedArray instanceof Int8Array || + (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) || + typedArray instanceof Int16Array || + typedArray instanceof Uint16Array || + typedArray instanceof Int32Array || + typedArray instanceof Uint32Array || + typedArray instanceof Float32Array || + typedArray instanceof Float64Array + ) { + typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); + } + + // Handle Uint8Array + if (typedArray instanceof Uint8Array) { + // Shortcut + var typedArrayByteLength = typedArray.byteLength; + + // Extract bytes + var words = []; + for (var i = 0; i < typedArrayByteLength; i++) { + words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); + } + + // Initialize this word array + superInit.call(this, words, typedArrayByteLength); + } else { + // Else call normal init + superInit.apply(this, arguments); + } + }; + + subInit.prototype = WordArray; + }()); + + + return CryptoJS.lib.WordArray; + +})); + +/***/ }), + +/***/ "183a": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/** + * @module ol/CollectionEventType + */ +/** + * @enum {string} + */ +/* harmony default export */ __webpack_exports__["a"] = ({ + /** + * Triggered when an item is added to the collection. + * @event module:ol/Collection.CollectionEvent#add + * @api + */ + ADD: 'add', + /** + * Triggered when an item is removed from the collection. + * @event module:ol/Collection.CollectionEvent#remove + * @api + */ + REMOVE: 'remove', +}); +//# sourceMappingURL=CollectionEventType.js.map + +/***/ }), + +/***/ "191b": +/***/ (function(module, exports, __webpack_require__) { + +;(function (root, factory, undef) { + if (true) { + // CommonJS + module.exports = exports = factory(__webpack_require__("21bf"), __webpack_require__("94f8")); + } + else {} +}(this, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var SHA256 = C_algo.SHA256; + + /** + * SHA-224 hash algorithm. + */ + var SHA224 = C_algo.SHA224 = SHA256.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, + 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 + ]); + }, + + _doFinalize: function () { + var hash = SHA256._doFinalize.call(this); + + hash.sigBytes -= 4; + + return hash; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA224('message'); + * var hash = CryptoJS.SHA224(wordArray); + */ + C.SHA224 = SHA256._createHelper(SHA224); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA224(message, key); + */ + C.HmacSHA224 = SHA256._createHmacHelper(SHA224); + }()); + + + return CryptoJS.SHA224; + +})); + +/***/ }), + +/***/ "1a2d": +/***/ (function(module, exports, __webpack_require__) { + +var uncurryThis = __webpack_require__("e330"); +var toObject = __webpack_require__("7b0b"); + +var hasOwnProperty = uncurryThis({}.hasOwnProperty); + +// `HasOwnProperty` abstract operation +// https://tc39.es/ecma262/#sec-hasownproperty +// eslint-disable-next-line es/no-object-hasown -- safe +module.exports = Object.hasOwn || function hasOwn(it, key) { + return hasOwnProperty(toObject(it), key); +}; + + +/***/ }), + +/***/ "1af9": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return inView; }); +/* harmony import */ var _Base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("5564"); +/* harmony import */ var _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("01d4"); +/* harmony import */ var _Property_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("df4c"); +/* harmony import */ var _render_EventType_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("070d"); +/* harmony import */ var _asserts_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("92fa"); +/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("38f3"); +/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("1e8d"); +var __extends = (undefined && undefined.__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/layer/Layer + */ + + + + + + + +/** + * @typedef {function(import("../PluggableMap.js").FrameState):HTMLElement} RenderFunction + */ +/*** + * @template Return + * @typedef {import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").OnSignature & + * import("../Observable").CombinedOnSignature} LayerOnSignature + */ +/** + * @template {import("../source/Source.js").default} [SourceType=import("../source/Source.js").default] + * @typedef {Object} Options + * @property {string} [className='ol-layer'] A CSS class name to set to the layer element. + * @property {number} [opacity=1] Opacity (0, 1). + * @property {boolean} [visible=true] Visibility. + * @property {import("../extent.js").Extent} [extent] The bounding extent for layer rendering. The layer will not be + * rendered outside of this extent. + * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers + * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed + * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()` + * method was used. + * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be + * visible. + * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will + * be visible. + * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be + * visible. + * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will + * be visible. + * @property {SourceType} [source] Source for this layer. If not provided to the constructor, + * the source can be set by calling {@link module:ol/layer/Layer~Layer#setSource layer.setSource(source)} after + * construction. + * @property {import("../PluggableMap.js").default|null} [map] Map. + * @property {RenderFunction} [render] Render function. Takes the frame state as input and is expected to return an + * HTML element. Will overwrite the default rendering for the layer. + * @property {Object} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`. + */ +/** + * @typedef {Object} State + * @property {import("./Layer.js").default} layer Layer. + * @property {number} opacity Opacity, the value is rounded to two digits to appear after the decimal point. + * @property {boolean} visible Visible. + * @property {boolean} managed Managed. + * @property {import("../extent.js").Extent} [extent] Extent. + * @property {number} zIndex ZIndex. + * @property {number} maxResolution Maximum resolution. + * @property {number} minResolution Minimum resolution. + * @property {number} minZoom Minimum zoom. + * @property {number} maxZoom Maximum zoom. + */ +/** + * @classdesc + * Base class from which all layer types are derived. This should only be instantiated + * in the case where a custom layer is added to the map with a custom `render` function. + * Such a function can be specified in the `options` object, and is expected to return an HTML element. + * + * A visual representation of raster or vector map data. + * Layers group together those properties that pertain to how the data is to be + * displayed, irrespective of the source of that data. + * + * Layers are usually added to a map with {@link import("../PluggableMap.js").default#addLayer map.addLayer()}. Components + * like {@link module:ol/interaction/Draw~Draw} use unmanaged layers + * internally. These unmanaged layers are associated with the map using + * {@link module:ol/layer/Layer~Layer#setMap} instead. + * + * A generic `change` event is fired when the state of the source changes. + * + * Please note that for performance reasons several layers might get rendered to + * the same HTML element, which will cause {@link import("../PluggableMap.js").default#forEachLayerAtPixel map.forEachLayerAtPixel()} to + * give false positives. To avoid this, apply different `className` properties to the + * layers at creation time. + * + * @fires import("../render/Event.js").RenderEvent#prerender + * @fires import("../render/Event.js").RenderEvent#postrender + * + * @template {import("../source/Source.js").default} [SourceType=import("../source/Source.js").default] + * @template {import("../renderer/Layer.js").default} [RendererType=import("../renderer/Layer.js").default] + * @api + */ +var Layer = /** @class */ (function (_super) { + __extends(Layer, _super); + /** + * @param {Options} options Layer options. + */ + function Layer(options) { + var _this = this; + var baseOptions = Object(_obj_js__WEBPACK_IMPORTED_MODULE_5__[/* assign */ "a"])({}, options); + delete baseOptions.source; + _this = _super.call(this, baseOptions) || this; + /*** + * @type {LayerOnSignature} + */ + _this.on; + /*** + * @type {LayerOnSignature} + */ + _this.once; + /*** + * @type {LayerOnSignature} + */ + _this.un; + /** + * @private + * @type {?import("../events.js").EventsKey} + */ + _this.mapPrecomposeKey_ = null; + /** + * @private + * @type {?import("../events.js").EventsKey} + */ + _this.mapRenderKey_ = null; + /** + * @private + * @type {?import("../events.js").EventsKey} + */ + _this.sourceChangeKey_ = null; + /** + * @private + * @type {RendererType} + */ + _this.renderer_ = null; + /** + * @protected + * @type {boolean} + */ + _this.rendered = false; + // Overwrite default render method with a custom one + if (options.render) { + _this.render = options.render; + } + if (options.map) { + _this.setMap(options.map); + } + _this.addChangeListener(_Property_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].SOURCE, _this.handleSourcePropertyChange_); + var source = options.source + ? /** @type {SourceType} */ (options.source) + : null; + _this.setSource(source); + return _this; + } + /** + * @param {Array} [opt_array] Array of layers (to be modified in place). + * @return {Array} Array of layers. + */ + Layer.prototype.getLayersArray = function (opt_array) { + var array = opt_array ? opt_array : []; + array.push(this); + return array; + }; + /** + * @param {Array} [opt_states] Optional list of layer states (to be modified in place). + * @return {Array} List of layer states. + */ + Layer.prototype.getLayerStatesArray = function (opt_states) { + var states = opt_states ? opt_states : []; + states.push(this.getLayerState()); + return states; + }; + /** + * Get the layer source. + * @return {SourceType|null} The layer source (or `null` if not yet set). + * @observable + * @api + */ + Layer.prototype.getSource = function () { + return /** @type {SourceType} */ (this.get(_Property_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].SOURCE)) || null; + }; + /** + * @return {SourceType|null} The source being rendered. + */ + Layer.prototype.getRenderSource = function () { + return this.getSource(); + }; + /** + * @return {import("../source/Source.js").State} Source state. + */ + Layer.prototype.getSourceState = function () { + var source = this.getSource(); + return !source ? 'undefined' : source.getState(); + }; + /** + * @private + */ + Layer.prototype.handleSourceChange_ = function () { + this.changed(); + }; + /** + * @private + */ + Layer.prototype.handleSourcePropertyChange_ = function () { + if (this.sourceChangeKey_) { + Object(_events_js__WEBPACK_IMPORTED_MODULE_6__[/* unlistenByKey */ "c"])(this.sourceChangeKey_); + this.sourceChangeKey_ = null; + } + var source = this.getSource(); + if (source) { + this.sourceChangeKey_ = Object(_events_js__WEBPACK_IMPORTED_MODULE_6__[/* listen */ "a"])(source, _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].CHANGE, this.handleSourceChange_, this); + } + this.changed(); + }; + /** + * @param {import("../pixel").Pixel} pixel Pixel. + * @return {Promise>} Promise that resolves with + * an array of features. + */ + Layer.prototype.getFeatures = function (pixel) { + if (!this.renderer_) { + return new Promise(function (resolve) { return resolve([]); }); + } + return this.renderer_.getFeatures(pixel); + }; + /** + * @param {import("../pixel").Pixel} pixel Pixel. + * @return {Uint8ClampedArray|Uint8Array|Float32Array|DataView|null} Pixel data. + */ + Layer.prototype.getData = function (pixel) { + if (!this.renderer_ || !this.rendered) { + return null; + } + return this.renderer_.getData(pixel); + }; + /** + * In charge to manage the rendering of the layer. One layer type is + * bounded with one layer renderer. + * @param {?import("../PluggableMap.js").FrameState} frameState Frame state. + * @param {HTMLElement} target Target which the renderer may (but need not) use + * for rendering its content. + * @return {HTMLElement} The rendered element. + */ + Layer.prototype.render = function (frameState, target) { + var layerRenderer = this.getRenderer(); + if (layerRenderer.prepareFrame(frameState)) { + this.rendered = true; + return layerRenderer.renderFrame(frameState, target); + } + }; + /** + * Called when a layer is not visible during a map render. + */ + Layer.prototype.unrender = function () { + this.rendered = false; + }; + /** + * For use inside the library only. + * @param {import("../PluggableMap.js").default|null} map Map. + */ + Layer.prototype.setMapInternal = function (map) { + if (!map) { + this.unrender(); + } + this.set(_Property_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].MAP, map); + }; + /** + * For use inside the library only. + * @return {import("../PluggableMap.js").default|null} Map. + */ + Layer.prototype.getMapInternal = function () { + return this.get(_Property_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].MAP); + }; + /** + * Sets the layer to be rendered on top of other layers on a map. The map will + * not manage this layer in its layers collection, and the callback in + * {@link module:ol/Map~Map#forEachLayerAtPixel} will receive `null` as layer. This + * is useful for temporary layers. To remove an unmanaged layer from the map, + * use `#setMap(null)`. + * + * To add the layer to a map and have it managed by the map, use + * {@link module:ol/Map~Map#addLayer} instead. + * @param {import("../PluggableMap.js").default|null} map Map. + * @api + */ + Layer.prototype.setMap = function (map) { + if (this.mapPrecomposeKey_) { + Object(_events_js__WEBPACK_IMPORTED_MODULE_6__[/* unlistenByKey */ "c"])(this.mapPrecomposeKey_); + this.mapPrecomposeKey_ = null; + } + if (!map) { + this.changed(); + } + if (this.mapRenderKey_) { + Object(_events_js__WEBPACK_IMPORTED_MODULE_6__[/* unlistenByKey */ "c"])(this.mapRenderKey_); + this.mapRenderKey_ = null; + } + if (map) { + this.mapPrecomposeKey_ = Object(_events_js__WEBPACK_IMPORTED_MODULE_6__[/* listen */ "a"])(map, _render_EventType_js__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].PRECOMPOSE, function (evt) { + var renderEvent = + /** @type {import("../render/Event.js").default} */ (evt); + var layerStatesArray = renderEvent.frameState.layerStatesArray; + var layerState = this.getLayerState(false); + // A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both. + Object(_asserts_js__WEBPACK_IMPORTED_MODULE_4__[/* assert */ "a"])(!layerStatesArray.some(function (arrayLayerState) { + return arrayLayerState.layer === layerState.layer; + }), 67); + layerStatesArray.push(layerState); + }, this); + this.mapRenderKey_ = Object(_events_js__WEBPACK_IMPORTED_MODULE_6__[/* listen */ "a"])(this, _events_EventType_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].CHANGE, map.render, map); + this.changed(); + } + }; + /** + * Set the layer source. + * @param {SourceType|null} source The layer source. + * @observable + * @api + */ + Layer.prototype.setSource = function (source) { + this.set(_Property_js__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].SOURCE, source); + }; + /** + * Get the renderer for this layer. + * @return {RendererType|null} The layer renderer. + */ + Layer.prototype.getRenderer = function () { + if (!this.renderer_) { + this.renderer_ = this.createRenderer(); + } + return this.renderer_; + }; + /** + * @return {boolean} The layer has a renderer. + */ + Layer.prototype.hasRenderer = function () { + return !!this.renderer_; + }; + /** + * Create a renderer for this layer. + * @return {RendererType} A layer renderer. + * @protected + */ + Layer.prototype.createRenderer = function () { + return null; + }; + /** + * Clean up. + */ + Layer.prototype.disposeInternal = function () { + if (this.renderer_) { + this.renderer_.dispose(); + delete this.renderer_; + } + this.setSource(null); + _super.prototype.disposeInternal.call(this); + }; + return Layer; +}(_Base_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])); +/** + * Return `true` if the layer is visible and if the provided view state + * has resolution and zoom levels that are in range of the layer's min/max. + * @param {State} layerState Layer state. + * @param {import("../View.js").State} viewState View state. + * @return {boolean} The layer is visible at the given view state. + */ +function inView(layerState, viewState) { + if (!layerState.visible) { + return false; + } + var resolution = viewState.resolution; + if (resolution < layerState.minResolution || + resolution >= layerState.maxResolution) { + return false; + } + var zoom = viewState.zoom; + return zoom > layerState.minZoom && zoom <= layerState.maxZoom; +} +/* harmony default export */ __webpack_exports__["a"] = (Layer); +//# sourceMappingURL=Layer.js.map + +/***/ }), + +/***/ "1c48": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* unused harmony export simplifyLineString */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return douglasPeucker; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return douglasPeuckerArray; }); +/* unused harmony export douglasPeuckerMultiArray */ +/* unused harmony export radialDistance */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return snap; }); +/* unused harmony export quantize */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return quantizeArray; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return quantizeMultiArray; }); +/* harmony import */ var _math_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("7fc9"); +/** + * @module ol/geom/flat/simplify + */ +// Based on simplify-js https://github.com/mourner/simplify-js +// Copyright (c) 2012, Vladimir Agafonkin +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} squaredTolerance Squared tolerance. + * @param {boolean} highQuality Highest quality. + * @param {Array} [opt_simplifiedFlatCoordinates] Simplified flat + * coordinates. + * @return {Array} Simplified line string. + */ +function simplifyLineString(flatCoordinates, offset, end, stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) { + var simplifiedFlatCoordinates = opt_simplifiedFlatCoordinates !== undefined + ? opt_simplifiedFlatCoordinates + : []; + if (!highQuality) { + end = radialDistance(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, 0); + flatCoordinates = simplifiedFlatCoordinates; + offset = 0; + stride = 2; + } + simplifiedFlatCoordinates.length = douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, 0); + return simplifiedFlatCoordinates; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} squaredTolerance Squared tolerance. + * @param {Array} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @return {number} Simplified offset. + */ +function douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) { + var n = (end - offset) / stride; + if (n < 3) { + for (; offset < end; offset += stride) { + simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset]; + simplifiedFlatCoordinates[simplifiedOffset++] = + flatCoordinates[offset + 1]; + } + return simplifiedOffset; + } + /** @type {Array} */ + var markers = new Array(n); + markers[0] = 1; + markers[n - 1] = 1; + /** @type {Array} */ + var stack = [offset, end - stride]; + var index = 0; + while (stack.length > 0) { + var last = stack.pop(); + var first = stack.pop(); + var maxSquaredDistance = 0; + var x1 = flatCoordinates[first]; + var y1 = flatCoordinates[first + 1]; + var x2 = flatCoordinates[last]; + var y2 = flatCoordinates[last + 1]; + for (var i = first + stride; i < last; i += stride) { + var x = flatCoordinates[i]; + var y = flatCoordinates[i + 1]; + var squaredDistance_1 = Object(_math_js__WEBPACK_IMPORTED_MODULE_0__[/* squaredSegmentDistance */ "j"])(x, y, x1, y1, x2, y2); + if (squaredDistance_1 > maxSquaredDistance) { + index = i; + maxSquaredDistance = squaredDistance_1; + } + } + if (maxSquaredDistance > squaredTolerance) { + markers[(index - offset) / stride] = 1; + if (first + stride < index) { + stack.push(first, index); + } + if (index + stride < last) { + stack.push(index, last); + } + } + } + for (var i = 0; i < n; ++i) { + if (markers[i]) { + simplifiedFlatCoordinates[simplifiedOffset++] = + flatCoordinates[offset + i * stride]; + simplifiedFlatCoordinates[simplifiedOffset++] = + flatCoordinates[offset + i * stride + 1]; + } + } + return simplifiedOffset; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {number} squaredTolerance Squared tolerance. + * @param {Array} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @param {Array} simplifiedEnds Simplified ends. + * @return {number} Simplified offset. + */ +function douglasPeuckerArray(flatCoordinates, offset, ends, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) { + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + simplifiedOffset = douglasPeucker(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset); + simplifiedEnds.push(simplifiedOffset); + offset = end; + } + return simplifiedOffset; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Endss. + * @param {number} stride Stride. + * @param {number} squaredTolerance Squared tolerance. + * @param {Array} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @param {Array>} simplifiedEndss Simplified endss. + * @return {number} Simplified offset. + */ +function douglasPeuckerMultiArray(flatCoordinates, offset, endss, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) { + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + var simplifiedEnds = []; + simplifiedOffset = douglasPeuckerArray(flatCoordinates, offset, ends, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds); + simplifiedEndss.push(simplifiedEnds); + offset = ends[ends.length - 1]; + } + return simplifiedOffset; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} squaredTolerance Squared tolerance. + * @param {Array} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @return {number} Simplified offset. + */ +function radialDistance(flatCoordinates, offset, end, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset) { + if (end <= offset + stride) { + // zero or one point, no simplification possible, so copy and return + for (; offset < end; offset += stride) { + simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset]; + simplifiedFlatCoordinates[simplifiedOffset++] = + flatCoordinates[offset + 1]; + } + return simplifiedOffset; + } + var x1 = flatCoordinates[offset]; + var y1 = flatCoordinates[offset + 1]; + // copy first point + simplifiedFlatCoordinates[simplifiedOffset++] = x1; + simplifiedFlatCoordinates[simplifiedOffset++] = y1; + var x2 = x1; + var y2 = y1; + for (offset += stride; offset < end; offset += stride) { + x2 = flatCoordinates[offset]; + y2 = flatCoordinates[offset + 1]; + if (Object(_math_js__WEBPACK_IMPORTED_MODULE_0__[/* squaredDistance */ "i"])(x1, y1, x2, y2) > squaredTolerance) { + // copy point at offset + simplifiedFlatCoordinates[simplifiedOffset++] = x2; + simplifiedFlatCoordinates[simplifiedOffset++] = y2; + x1 = x2; + y1 = y2; + } + } + if (x2 != x1 || y2 != y1) { + // copy last point + simplifiedFlatCoordinates[simplifiedOffset++] = x2; + simplifiedFlatCoordinates[simplifiedOffset++] = y2; + } + return simplifiedOffset; +} +/** + * @param {number} value Value. + * @param {number} tolerance Tolerance. + * @return {number} Rounded value. + */ +function snap(value, tolerance) { + return tolerance * Math.round(value / tolerance); +} +/** + * Simplifies a line string using an algorithm designed by Tim Schaub. + * Coordinates are snapped to the nearest value in a virtual grid and + * consecutive duplicate coordinates are discarded. This effectively preserves + * topology as the simplification of any subsection of a line string is + * independent of the rest of the line string. This means that, for examples, + * the common edge between two polygons will be simplified to the same line + * string independently in both polygons. This implementation uses a single + * pass over the coordinates and eliminates intermediate collinear points. + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} tolerance Tolerance. + * @param {Array} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @return {number} Simplified offset. + */ +function quantize(flatCoordinates, offset, end, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset) { + // do nothing if the line is empty + if (offset == end) { + return simplifiedOffset; + } + // snap the first coordinate (P1) + var x1 = snap(flatCoordinates[offset], tolerance); + var y1 = snap(flatCoordinates[offset + 1], tolerance); + offset += stride; + // add the first coordinate to the output + simplifiedFlatCoordinates[simplifiedOffset++] = x1; + simplifiedFlatCoordinates[simplifiedOffset++] = y1; + // find the next coordinate that does not snap to the same value as the first + // coordinate (P2) + var x2, y2; + do { + x2 = snap(flatCoordinates[offset], tolerance); + y2 = snap(flatCoordinates[offset + 1], tolerance); + offset += stride; + if (offset == end) { + // all coordinates snap to the same value, the line collapses to a point + // push the last snapped value anyway to ensure that the output contains + // at least two points + // FIXME should we really return at least two points anyway? + simplifiedFlatCoordinates[simplifiedOffset++] = x2; + simplifiedFlatCoordinates[simplifiedOffset++] = y2; + return simplifiedOffset; + } + } while (x2 == x1 && y2 == y1); + while (offset < end) { + // snap the next coordinate (P3) + var x3 = snap(flatCoordinates[offset], tolerance); + var y3 = snap(flatCoordinates[offset + 1], tolerance); + offset += stride; + // skip P3 if it is equal to P2 + if (x3 == x2 && y3 == y2) { + continue; + } + // calculate the delta between P1 and P2 + var dx1 = x2 - x1; + var dy1 = y2 - y1; + // calculate the delta between P3 and P1 + var dx2 = x3 - x1; + var dy2 = y3 - y1; + // if P1, P2, and P3 are colinear and P3 is further from P1 than P2 is from + // P1 in the same direction then P2 is on the straight line between P1 and + // P3 + if (dx1 * dy2 == dy1 * dx2 && + ((dx1 < 0 && dx2 < dx1) || dx1 == dx2 || (dx1 > 0 && dx2 > dx1)) && + ((dy1 < 0 && dy2 < dy1) || dy1 == dy2 || (dy1 > 0 && dy2 > dy1))) { + // discard P2 and set P2 = P3 + x2 = x3; + y2 = y3; + continue; + } + // either P1, P2, and P3 are not colinear, or they are colinear but P3 is + // between P3 and P1 or on the opposite half of the line to P2. add P2, + // and continue with P1 = P2 and P2 = P3 + simplifiedFlatCoordinates[simplifiedOffset++] = x2; + simplifiedFlatCoordinates[simplifiedOffset++] = y2; + x1 = x2; + y1 = y2; + x2 = x3; + y2 = y3; + } + // add the last point (P2) + simplifiedFlatCoordinates[simplifiedOffset++] = x2; + simplifiedFlatCoordinates[simplifiedOffset++] = y2; + return simplifiedOffset; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {number} tolerance Tolerance. + * @param {Array} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @param {Array} simplifiedEnds Simplified ends. + * @return {number} Simplified offset. + */ +function quantizeArray(flatCoordinates, offset, ends, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) { + for (var i = 0, ii = ends.length; i < ii; ++i) { + var end = ends[i]; + simplifiedOffset = quantize(flatCoordinates, offset, end, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset); + simplifiedEnds.push(simplifiedOffset); + offset = end; + } + return simplifiedOffset; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Endss. + * @param {number} stride Stride. + * @param {number} tolerance Tolerance. + * @param {Array} simplifiedFlatCoordinates Simplified flat + * coordinates. + * @param {number} simplifiedOffset Simplified offset. + * @param {Array>} simplifiedEndss Simplified endss. + * @return {number} Simplified offset. + */ +function quantizeMultiArray(flatCoordinates, offset, endss, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) { + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + var simplifiedEnds = []; + simplifiedOffset = quantizeArray(flatCoordinates, offset, ends, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds); + simplifiedEndss.push(simplifiedEnds); + offset = ends[ends.length - 1]; + } + return simplifiedOffset; +} +//# sourceMappingURL=simplify.js.map + +/***/ }), + +/***/ "1d80": +/***/ (function(module, exports, __webpack_require__) { + +var isNullOrUndefined = __webpack_require__("7234"); + +var $TypeError = TypeError; + +// `RequireObjectCoercible` abstract operation +// https://tc39.es/ecma262/#sec-requireobjectcoercible +module.exports = function (it) { + if (isNullOrUndefined(it)) throw $TypeError("Can't call method on " + it); + return it; +}; + + +/***/ }), + +/***/ "1e8d": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return listen; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return listenOnce; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return unlistenByKey; }); +/* harmony import */ var _obj_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("38f3"); +/** + * @module ol/events + */ + +/** + * Key to use with {@link module:ol/Observable.unByKey}. + * @typedef {Object} EventsKey + * @property {ListenerFunction} listener Listener. + * @property {import("./events/Target.js").EventTargetLike} target Target. + * @property {string} type Type. + * @api + */ +/** + * Listener function. This function is called with an event object as argument. + * When the function returns `false`, event propagation will stop. + * + * @typedef {function((Event|import("./events/Event.js").default)): (void|boolean)} ListenerFunction + * @api + */ +/** + * @typedef {Object} ListenerObject + * @property {ListenerFunction} handleEvent HandleEvent listener function. + */ +/** + * @typedef {ListenerFunction|ListenerObject} Listener + */ +/** + * Registers an event listener on an event target. Inspired by + * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html + * + * This function efficiently binds a `listener` to a `this` object, and returns + * a key for use with {@link module:ol/events.unlistenByKey}. + * + * @param {import("./events/Target.js").EventTargetLike} target Event target. + * @param {string} type Event type. + * @param {ListenerFunction} listener Listener. + * @param {Object} [opt_this] Object referenced by the `this` keyword in the + * listener. Default is the `target`. + * @param {boolean} [opt_once] If true, add the listener as one-off listener. + * @return {EventsKey} Unique key for the listener. + */ +function listen(target, type, listener, opt_this, opt_once) { + if (opt_this && opt_this !== target) { + listener = listener.bind(opt_this); + } + if (opt_once) { + var originalListener_1 = listener; + listener = function () { + target.removeEventListener(type, listener); + originalListener_1.apply(this, arguments); + }; + } + var eventsKey = { + target: target, + type: type, + listener: listener, + }; + target.addEventListener(type, listener); + return eventsKey; +} +/** + * Registers a one-off event listener on an event target. Inspired by + * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html + * + * This function efficiently binds a `listener` as self-unregistering listener + * to a `this` object, and returns a key for use with + * {@link module:ol/events.unlistenByKey} in case the listener needs to be + * unregistered before it is called. + * + * When {@link module:ol/events.listen} is called with the same arguments after this + * function, the self-unregistering listener will be turned into a permanent + * listener. + * + * @param {import("./events/Target.js").EventTargetLike} target Event target. + * @param {string} type Event type. + * @param {ListenerFunction} listener Listener. + * @param {Object} [opt_this] Object referenced by the `this` keyword in the + * listener. Default is the `target`. + * @return {EventsKey} Key for unlistenByKey. + */ +function listenOnce(target, type, listener, opt_this) { + return listen(target, type, listener, opt_this, true); +} +/** + * Unregisters event listeners on an event target. Inspired by + * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html + * + * The argument passed to this function is the key returned from + * {@link module:ol/events.listen} or {@link module:ol/events.listenOnce}. + * + * @param {EventsKey} key The key. + */ +function unlistenByKey(key) { + if (key && key.target) { + key.target.removeEventListener(key.type, key.listener); + Object(_obj_js__WEBPACK_IMPORTED_MODULE_0__[/* clear */ "b"])(key); + } +} +//# sourceMappingURL=events.js.map + +/***/ }), + +/***/ "1fb5": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.byteLength = byteLength +exports.toByteArray = toByteArray +exports.fromByteArray = fromByteArray + +var lookup = [] +var revLookup = [] +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array + +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i] + revLookup[code.charCodeAt(i)] = i +} + +// Support decoding URL-safe base64 strings, as Node.js does. +// See: https://en.wikipedia.org/wiki/Base64#URL_applications +revLookup['-'.charCodeAt(0)] = 62 +revLookup['_'.charCodeAt(0)] = 63 + +function getLens (b64) { + var len = b64.length + + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len + + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) + + return [validLen, placeHoldersLen] +} + +// base64 is 4/3 + up to two characters of the original data +function byteLength (b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function _byteLength (b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function toByteArray (b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) + + var curByte = 0 + + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen + + var i + for (i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + return arr +} + +function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + + lookup[num >> 12 & 0x3F] + + lookup[num >> 6 & 0x3F] + + lookup[num & 0x3F] +} + +function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + output.push(tripletToBase64(tmp)) + } + return output.join('') +} + +function fromByteArray (uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) + } + + return parts.join('') +} + + +/***/ }), + +/***/ "21bf": +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global) {;(function (root, factory) { + if (true) { + // CommonJS + module.exports = exports = factory(); + } + else {} +}(this, function () { + + /*globals window, global, require*/ + + /** + * CryptoJS core components. + */ + var CryptoJS = CryptoJS || (function (Math, undefined) { + + var crypto; + + // Native crypto from window (Browser) + if (typeof window !== 'undefined' && window.crypto) { + crypto = window.crypto; + } + + // Native crypto in web worker (Browser) + if (typeof self !== 'undefined' && self.crypto) { + crypto = self.crypto; + } + + // Native crypto from worker + if (typeof globalThis !== 'undefined' && globalThis.crypto) { + crypto = globalThis.crypto; + } + + // Native (experimental IE 11) crypto from window (Browser) + if (!crypto && typeof window !== 'undefined' && window.msCrypto) { + crypto = window.msCrypto; + } + + // Native crypto from global (NodeJS) + if (!crypto && typeof global !== 'undefined' && global.crypto) { + crypto = global.crypto; + } + + // Native crypto import via require (NodeJS) + if (!crypto && "function" === 'function') { + try { + crypto = __webpack_require__(0); + } catch (err) {} + } + + /* + * Cryptographically secure pseudorandom number generator + * + * As Math.random() is cryptographically not safe to use + */ + var cryptoSecureRandomInt = function () { + if (crypto) { + // Use getRandomValues method (Browser) + if (typeof crypto.getRandomValues === 'function') { + try { + return crypto.getRandomValues(new Uint32Array(1))[0]; + } catch (err) {} + } + + // Use randomBytes method (NodeJS) + if (typeof crypto.randomBytes === 'function') { + try { + return crypto.randomBytes(4).readInt32LE(); + } catch (err) {} + } + } + + throw new Error('Native crypto module could not be used to get secure random number.'); + }; + + /* + * Local polyfill of Object.create + + */ + var create = Object.create || (function () { + function F() {} + + return function (obj) { + var subtype; + + F.prototype = obj; + + subtype = new F(); + + F.prototype = null; + + return subtype; + }; + }()); + + /** + * CryptoJS namespace. + */ + var C = {}; + + /** + * Library namespace. + */ + var C_lib = C.lib = {}; + + /** + * Base object for prototypal inheritance. + */ + var Base = C_lib.Base = (function () { + + + return { + /** + * Creates a new object that inherits from this object. + * + * @param {Object} overrides Properties to copy into the new object. + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * field: 'value', + * + * method: function () { + * } + * }); + */ + extend: function (overrides) { + // Spawn + var subtype = create(this); + + // Augment + if (overrides) { + subtype.mixIn(overrides); + } + + // Create default initializer + if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { + subtype.init = function () { + subtype.$super.init.apply(this, arguments); + }; + } + + // Initializer's prototype is the subtype object + subtype.init.prototype = subtype; + + // Reference supertype + subtype.$super = this; + + return subtype; + }, + + /** + * Extends this object and runs the init method. + * Arguments to create() will be passed to init(). + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var instance = MyType.create(); + */ + create: function () { + var instance = this.extend(); + instance.init.apply(instance, arguments); + + return instance; + }, + + /** + * Initializes a newly created object. + * Override this method to add some logic when your objects are created. + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * init: function () { + * // ... + * } + * }); + */ + init: function () { + }, + + /** + * Copies properties into this object. + * + * @param {Object} properties The properties to mix in. + * + * @example + * + * MyType.mixIn({ + * field: 'value' + * }); + */ + mixIn: function (properties) { + for (var propertyName in properties) { + if (properties.hasOwnProperty(propertyName)) { + this[propertyName] = properties[propertyName]; + } + } + + // IE won't copy toString using the loop above + if (properties.hasOwnProperty('toString')) { + this.toString = properties.toString; + } + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = instance.clone(); + */ + clone: function () { + return this.init.prototype.extend(this); + } + }; + }()); + + /** + * An array of 32-bit words. + * + * @property {Array} words The array of 32-bit words. + * @property {number} sigBytes The number of significant bytes in this word array. + */ + var WordArray = C_lib.WordArray = Base.extend({ + /** + * Initializes a newly created word array. + * + * @param {Array} words (Optional) An array of 32-bit words. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.create(); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); + */ + init: function (words, sigBytes) { + words = this.words = words || []; + + if (sigBytes != undefined) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 4; + } + }, + + /** + * Converts this word array to a string. + * + * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex + * + * @return {string} The stringified word array. + * + * @example + * + * var string = wordArray + ''; + * var string = wordArray.toString(); + * var string = wordArray.toString(CryptoJS.enc.Utf8); + */ + toString: function (encoder) { + return (encoder || Hex).stringify(this); + }, + + /** + * Concatenates a word array to this word array. + * + * @param {WordArray} wordArray The word array to append. + * + * @return {WordArray} This word array. + * + * @example + * + * wordArray1.concat(wordArray2); + */ + concat: function (wordArray) { + // Shortcuts + var thisWords = this.words; + var thatWords = wordArray.words; + var thisSigBytes = this.sigBytes; + var thatSigBytes = wordArray.sigBytes; + + // Clamp excess bits + this.clamp(); + + // Concat + if (thisSigBytes % 4) { + // Copy one byte at a time + for (var i = 0; i < thatSigBytes; i++) { + var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); + } + } else { + // Copy one word at a time + for (var j = 0; j < thatSigBytes; j += 4) { + thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2]; + } + } + this.sigBytes += thatSigBytes; + + // Chainable + return this; + }, + + /** + * Removes insignificant bits. + * + * @example + * + * wordArray.clamp(); + */ + clamp: function () { + // Shortcuts + var words = this.words; + var sigBytes = this.sigBytes; + + // Clamp + words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); + words.length = Math.ceil(sigBytes / 4); + }, + + /** + * Creates a copy of this word array. + * + * @return {WordArray} The clone. + * + * @example + * + * var clone = wordArray.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + clone.words = this.words.slice(0); + + return clone; + }, + + /** + * Creates a word array filled with random bytes. + * + * @param {number} nBytes The number of random bytes to generate. + * + * @return {WordArray} The random word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.random(16); + */ + random: function (nBytes) { + var words = []; + + for (var i = 0; i < nBytes; i += 4) { + words.push(cryptoSecureRandomInt()); + } + + return new WordArray.init(words, nBytes); + } + }); + + /** + * Encoder namespace. + */ + var C_enc = C.enc = {}; + + /** + * Hex encoding strategy. + */ + var Hex = C_enc.Hex = { + /** + * Converts a word array to a hex string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The hex string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.enc.Hex.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var hexChars = []; + for (var i = 0; i < sigBytes; i++) { + var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + hexChars.push((bite >>> 4).toString(16)); + hexChars.push((bite & 0x0f).toString(16)); + } + + return hexChars.join(''); + }, + + /** + * Converts a hex string to a word array. + * + * @param {string} hexStr The hex string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Hex.parse(hexString); + */ + parse: function (hexStr) { + // Shortcut + var hexStrLength = hexStr.length; + + // Convert + var words = []; + for (var i = 0; i < hexStrLength; i += 2) { + words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); + } + + return new WordArray.init(words, hexStrLength / 2); + } + }; + + /** + * Latin1 encoding strategy. + */ + var Latin1 = C_enc.Latin1 = { + /** + * Converts a word array to a Latin1 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Latin1 string. + * + * @static + * + * @example + * + * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var latin1Chars = []; + for (var i = 0; i < sigBytes; i++) { + var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + latin1Chars.push(String.fromCharCode(bite)); + } + + return latin1Chars.join(''); + }, + + /** + * Converts a Latin1 string to a word array. + * + * @param {string} latin1Str The Latin1 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); + */ + parse: function (latin1Str) { + // Shortcut + var latin1StrLength = latin1Str.length; + + // Convert + var words = []; + for (var i = 0; i < latin1StrLength; i++) { + words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); + } + + return new WordArray.init(words, latin1StrLength); + } + }; + + /** + * UTF-8 encoding strategy. + */ + var Utf8 = C_enc.Utf8 = { + /** + * Converts a word array to a UTF-8 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-8 string. + * + * @static + * + * @example + * + * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); + */ + stringify: function (wordArray) { + try { + return decodeURIComponent(escape(Latin1.stringify(wordArray))); + } catch (e) { + throw new Error('Malformed UTF-8 data'); + } + }, + + /** + * Converts a UTF-8 string to a word array. + * + * @param {string} utf8Str The UTF-8 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); + */ + parse: function (utf8Str) { + return Latin1.parse(unescape(encodeURIComponent(utf8Str))); + } + }; + + /** + * Abstract buffered block algorithm template. + * + * The property blockSize must be implemented in a concrete subtype. + * + * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 + */ + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ + /** + * Resets this block algorithm's data buffer to its initial state. + * + * @example + * + * bufferedBlockAlgorithm.reset(); + */ + reset: function () { + // Initial values + this._data = new WordArray.init(); + this._nDataBytes = 0; + }, + + /** + * Adds new data to this block algorithm's buffer. + * + * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. + * + * @example + * + * bufferedBlockAlgorithm._append('data'); + * bufferedBlockAlgorithm._append(wordArray); + */ + _append: function (data) { + // Convert string to WordArray, else assume WordArray already + if (typeof data == 'string') { + data = Utf8.parse(data); + } + + // Append + this._data.concat(data); + this._nDataBytes += data.sigBytes; + }, + + /** + * Processes available data blocks. + * + * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. + * + * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. + * + * @return {WordArray} The processed data. + * + * @example + * + * var processedData = bufferedBlockAlgorithm._process(); + * var processedData = bufferedBlockAlgorithm._process(!!'flush'); + */ + _process: function (doFlush) { + var processedWords; + + // Shortcuts + var data = this._data; + var dataWords = data.words; + var dataSigBytes = data.sigBytes; + var blockSize = this.blockSize; + var blockSizeBytes = blockSize * 4; + + // Count blocks ready + var nBlocksReady = dataSigBytes / blockSizeBytes; + if (doFlush) { + // Round up to include partial blocks + nBlocksReady = Math.ceil(nBlocksReady); + } else { + // Round down to include only full blocks, + // less the number of blocks that must remain in the buffer + nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); + } + + // Count words ready + var nWordsReady = nBlocksReady * blockSize; + + // Count bytes ready + var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); + + // Process blocks + if (nWordsReady) { + for (var offset = 0; offset < nWordsReady; offset += blockSize) { + // Perform concrete-algorithm logic + this._doProcessBlock(dataWords, offset); + } + + // Remove processed words + processedWords = dataWords.splice(0, nWordsReady); + data.sigBytes -= nBytesReady; + } + + // Return processed words + return new WordArray.init(processedWords, nBytesReady); + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = bufferedBlockAlgorithm.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + clone._data = this._data.clone(); + + return clone; + }, + + _minBufferSize: 0 + }); + + /** + * Abstract hasher template. + * + * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) + */ + var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + */ + cfg: Base.extend(), + + /** + * Initializes a newly created hasher. + * + * @param {Object} cfg (Optional) The configuration options to use for this hash computation. + * + * @example + * + * var hasher = CryptoJS.algo.SHA256.create(); + */ + init: function (cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); + + // Set initial values + this.reset(); + }, + + /** + * Resets this hasher to its initial state. + * + * @example + * + * hasher.reset(); + */ + reset: function () { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); + + // Perform concrete-hasher logic + this._doReset(); + }, + + /** + * Updates this hasher with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {Hasher} This hasher. + * + * @example + * + * hasher.update('message'); + * hasher.update(wordArray); + */ + update: function (messageUpdate) { + // Append + this._append(messageUpdate); + + // Update the hash + this._process(); + + // Chainable + return this; + }, + + /** + * Finalizes the hash computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The hash. + * + * @example + * + * var hash = hasher.finalize(); + * var hash = hasher.finalize('message'); + * var hash = hasher.finalize(wordArray); + */ + finalize: function (messageUpdate) { + // Final message update + if (messageUpdate) { + this._append(messageUpdate); + } + + // Perform concrete-hasher logic + var hash = this._doFinalize(); + + return hash; + }, + + blockSize: 512/32, + + /** + * Creates a shortcut function to a hasher's object interface. + * + * @param {Hasher} hasher The hasher to create a helper for. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); + */ + _createHelper: function (hasher) { + return function (message, cfg) { + return new hasher.init(cfg).finalize(message); + }; + }, + + /** + * Creates a shortcut function to the HMAC's object interface. + * + * @param {Hasher} hasher The hasher to use in this HMAC helper. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); + */ + _createHmacHelper: function (hasher) { + return function (message, key) { + return new C_algo.HMAC.init(hasher, key).finalize(message); + }; + } + }); + + /** + * Algorithm namespace. + */ + var C_algo = C.algo = {}; + + return C; + }(Math)); + + + return CryptoJS; + +})); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("c8ba"))) + +/***/ }), + +/***/ "23cb": +/***/ (function(module, exports, __webpack_require__) { + +var toIntegerOrInfinity = __webpack_require__("5926"); + +var max = Math.max; +var min = Math.min; + +// Helper for a popular repeating case of the spec: +// Let integer be ? ToInteger(index). +// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). +module.exports = function (index, length) { + var integer = toIntegerOrInfinity(index); + return integer < 0 ? max(integer + length, 0) : min(integer, length); +}; + + +/***/ }), + +/***/ "23e7": +/***/ (function(module, exports, __webpack_require__) { + +var global = __webpack_require__("da84"); +var getOwnPropertyDescriptor = __webpack_require__("06cf").f; +var createNonEnumerableProperty = __webpack_require__("9112"); +var defineBuiltIn = __webpack_require__("cb2d"); +var defineGlobalProperty = __webpack_require__("6374"); +var copyConstructorProperties = __webpack_require__("e893"); +var isForced = __webpack_require__("94ca"); + +/* + options.target - name of the target object + options.global - target is the global object + options.stat - export as static methods of target + options.proto - export as prototype methods of target + options.real - real prototype method for the `pure` version + options.forced - export even if the native feature is available + options.bind - bind methods to the target, required for the `pure` version + options.wrap - wrap constructors to preventing global pollution, required for the `pure` version + options.unsafe - use the simple assignment of property instead of delete + defineProperty + options.sham - add a flag to not completely full polyfills + options.enumerable - export as enumerable property + options.dontCallGetSet - prevent calling a getter on target + options.name - the .name of the function if it does not match the key +*/ +module.exports = function (options, source) { + var TARGET = options.target; + var GLOBAL = options.global; + var STATIC = options.stat; + var FORCED, target, key, targetProperty, sourceProperty, descriptor; + if (GLOBAL) { + target = global; + } else if (STATIC) { + target = global[TARGET] || defineGlobalProperty(TARGET, {}); + } else { + target = (global[TARGET] || {}).prototype; + } + if (target) for (key in source) { + sourceProperty = source[key]; + if (options.dontCallGetSet) { + descriptor = getOwnPropertyDescriptor(target, key); + targetProperty = descriptor && descriptor.value; + } else targetProperty = target[key]; + FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); + // contained in target + if (!FORCED && targetProperty !== undefined) { + if (typeof sourceProperty == typeof targetProperty) continue; + copyConstructorProperties(sourceProperty, targetProperty); + } + // add a flag to not completely full polyfills + if (options.sham || (targetProperty && targetProperty.sham)) { + createNonEnumerableProperty(sourceProperty, 'sham', true); + } + defineBuiltIn(target, key, sourceProperty, options); + } +}; + + +/***/ }), + +/***/ "241c": +/***/ (function(module, exports, __webpack_require__) { + +var internalObjectKeys = __webpack_require__("ca84"); +var enumBugKeys = __webpack_require__("7839"); + +var hiddenKeys = enumBugKeys.concat('length', 'prototype'); + +// `Object.getOwnPropertyNames` method +// https://tc39.es/ecma262/#sec-object.getownpropertynames +// eslint-disable-next-line es/no-object-getownpropertynames -- safe +exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { + return internalObjectKeys(O, hiddenKeys); +}; + + +/***/ }), + +/***/ "256f": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; + +// EXPORTS +__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ Units["a" /* METERS_PER_UNIT */]; }); +__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ disableCoordinateWarning; }); +__webpack_require__.d(__webpack_exports__, "h", function() { return /* binding */ proj_get; }); +__webpack_require__.d(__webpack_exports__, "i", function() { return /* binding */ getPointResolution; }); +__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ createProjection; }); +__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ equivalent; }); +__webpack_require__.d(__webpack_exports__, "k", function() { return /* binding */ getTransformFromProjections; }); +__webpack_require__.d(__webpack_exports__, "j", function() { return /* binding */ getTransform; }); +__webpack_require__.d(__webpack_exports__, "p", function() { return /* binding */ proj_transform; }); +__webpack_require__.d(__webpack_exports__, "q", function() { return /* binding */ transformExtent; }); +__webpack_require__.d(__webpack_exports__, "l", function() { return /* binding */ getUserProjection; }); +__webpack_require__.d(__webpack_exports__, "m", function() { return /* binding */ toUserCoordinate; }); +__webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ fromUserCoordinate; }); +__webpack_require__.d(__webpack_exports__, "n", function() { return /* binding */ toUserExtent; }); +__webpack_require__.d(__webpack_exports__, "f", function() { return /* binding */ fromUserExtent; }); +__webpack_require__.d(__webpack_exports__, "o", function() { return /* binding */ toUserResolution; }); +__webpack_require__.d(__webpack_exports__, "g", function() { return /* binding */ fromUserResolution; }); + +// UNUSED EXPORTS: Projection, cloneTransform, identityTransform, addProjection, addProjections, addEquivalentProjections, addEquivalentTransforms, clearAllProjections, createTransformFromCoordinateTransform, addCoordinateTransforms, fromLonLat, toLonLat, transformWithProjections, setUserProjection, clearUserProjection, useGeographic, createSafeCoordinateTransform, addCommon + +// EXTERNAL MODULE: ./node_modules/ol/proj/Units.js +var Units = __webpack_require__("fced"); + +// EXTERNAL MODULE: ./node_modules/ol/proj/Projection.js +var Projection = __webpack_require__("f5dd"); + +// EXTERNAL MODULE: ./node_modules/ol/math.js +var math = __webpack_require__("7fc9"); + +// CONCATENATED MODULE: ./node_modules/ol/proj/epsg3857.js +var __extends = (undefined && undefined.__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/proj/epsg3857 + */ + + + +/** + * Radius of WGS84 sphere + * + * @const + * @type {number} + */ +var RADIUS = 6378137; +/** + * @const + * @type {number} + */ +var HALF_SIZE = Math.PI * RADIUS; +/** + * @const + * @type {import("../extent.js").Extent} + */ +var EXTENT = [-HALF_SIZE, -HALF_SIZE, HALF_SIZE, HALF_SIZE]; +/** + * @const + * @type {import("../extent.js").Extent} + */ +var WORLD_EXTENT = [-180, -85, 180, 85]; +/** + * Maximum safe value in y direction + * @const + * @type {number} + */ +var MAX_SAFE_Y = RADIUS * Math.log(Math.tan(Math.PI / 2)); +/** + * @classdesc + * Projection object for web/spherical Mercator (EPSG:3857). + */ +var epsg3857_EPSG3857Projection = /** @class */ (function (_super) { + __extends(EPSG3857Projection, _super); + /** + * @param {string} code Code. + */ + function EPSG3857Projection(code) { + return _super.call(this, { + code: code, + units: Units["b" /* default */].METERS, + extent: EXTENT, + global: true, + worldExtent: WORLD_EXTENT, + getPointResolution: function (resolution, point) { + return resolution / Object(math["c" /* cosh */])(point[1] / RADIUS); + }, + }) || this; + } + return EPSG3857Projection; +}(Projection["a" /* default */])); +/** + * Projections equal to EPSG:3857. + * + * @const + * @type {Array} + */ +var PROJECTIONS = [ + new epsg3857_EPSG3857Projection('EPSG:3857'), + new epsg3857_EPSG3857Projection('EPSG:102100'), + new epsg3857_EPSG3857Projection('EPSG:102113'), + new epsg3857_EPSG3857Projection('EPSG:900913'), + new epsg3857_EPSG3857Projection('http://www.opengis.net/def/crs/EPSG/0/3857'), + new epsg3857_EPSG3857Projection('http://www.opengis.net/gml/srs/epsg.xml#3857'), +]; +/** + * Transformation from EPSG:4326 to EPSG:3857. + * + * @param {Array} input Input array of coordinate values. + * @param {Array} [opt_output] Output array of coordinate values. + * @param {number} [opt_dimension] Dimension (default is `2`). + * @return {Array} Output array of coordinate values. + */ +function fromEPSG4326(input, opt_output, opt_dimension) { + var length = input.length; + var dimension = opt_dimension > 1 ? opt_dimension : 2; + var output = opt_output; + if (output === undefined) { + if (dimension > 2) { + // preserve values beyond second dimension + output = input.slice(); + } + else { + output = new Array(length); + } + } + for (var i = 0; i < length; i += dimension) { + output[i] = (HALF_SIZE * input[i]) / 180; + var y = RADIUS * Math.log(Math.tan((Math.PI * (+input[i + 1] + 90)) / 360)); + if (y > MAX_SAFE_Y) { + y = MAX_SAFE_Y; + } + else if (y < -MAX_SAFE_Y) { + y = -MAX_SAFE_Y; + } + output[i + 1] = y; + } + return output; +} +/** + * Transformation from EPSG:3857 to EPSG:4326. + * + * @param {Array} input Input array of coordinate values. + * @param {Array} [opt_output] Output array of coordinate values. + * @param {number} [opt_dimension] Dimension (default is `2`). + * @return {Array} Output array of coordinate values. + */ +function toEPSG4326(input, opt_output, opt_dimension) { + var length = input.length; + var dimension = opt_dimension > 1 ? opt_dimension : 2; + var output = opt_output; + if (output === undefined) { + if (dimension > 2) { + // preserve values beyond second dimension + output = input.slice(); + } + else { + output = new Array(length); + } + } + for (var i = 0; i < length; i += dimension) { + output[i] = (180 * input[i]) / HALF_SIZE; + output[i + 1] = + (360 * Math.atan(Math.exp(input[i + 1] / RADIUS))) / Math.PI - 90; + } + return output; +} +//# sourceMappingURL=epsg3857.js.map +// CONCATENATED MODULE: ./node_modules/ol/proj/epsg4326.js +var epsg4326_extends = (undefined && undefined.__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/proj/epsg4326 + */ + + +/** + * Semi-major radius of the WGS84 ellipsoid. + * + * @const + * @type {number} + */ +var epsg4326_RADIUS = 6378137; +/** + * Extent of the EPSG:4326 projection which is the whole world. + * + * @const + * @type {import("../extent.js").Extent} + */ +var epsg4326_EXTENT = [-180, -90, 180, 90]; +/** + * @const + * @type {number} + */ +var METERS_PER_UNIT = (Math.PI * epsg4326_RADIUS) / 180; +/** + * @classdesc + * Projection object for WGS84 geographic coordinates (EPSG:4326). + * + * Note that OpenLayers does not strictly comply with the EPSG definition. + * The EPSG registry defines 4326 as a CRS for Latitude,Longitude (y,x). + * OpenLayers treats EPSG:4326 as a pseudo-projection, with x,y coordinates. + */ +var epsg4326_EPSG4326Projection = /** @class */ (function (_super) { + epsg4326_extends(EPSG4326Projection, _super); + /** + * @param {string} code Code. + * @param {string} [opt_axisOrientation] Axis orientation. + */ + function EPSG4326Projection(code, opt_axisOrientation) { + return _super.call(this, { + code: code, + units: Units["b" /* default */].DEGREES, + extent: epsg4326_EXTENT, + axisOrientation: opt_axisOrientation, + global: true, + metersPerUnit: METERS_PER_UNIT, + worldExtent: epsg4326_EXTENT, + }) || this; + } + return EPSG4326Projection; +}(Projection["a" /* default */])); +/** + * Projections equal to EPSG:4326. + * + * @const + * @type {Array} + */ +var epsg4326_PROJECTIONS = [ + new epsg4326_EPSG4326Projection('CRS:84'), + new epsg4326_EPSG4326Projection('EPSG:4326', 'neu'), + new epsg4326_EPSG4326Projection('urn:ogc:def:crs:OGC:1.3:CRS84'), + new epsg4326_EPSG4326Projection('urn:ogc:def:crs:OGC:2:84'), + new epsg4326_EPSG4326Projection('http://www.opengis.net/def/crs/OGC/1.3/CRS84'), + new epsg4326_EPSG4326Projection('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'), + new epsg4326_EPSG4326Projection('http://www.opengis.net/def/crs/EPSG/0/4326', 'neu'), +]; +//# sourceMappingURL=epsg4326.js.map +// CONCATENATED MODULE: ./node_modules/ol/proj/projections.js +/** + * @module ol/proj/projections + */ +/** + * @type {Object} + */ +var cache = {}; +/** + * Clear the projections cache. + */ +function clear() { + cache = {}; +} +/** + * Get a cached projection by code. + * @param {string} code The code for the projection. + * @return {import("./Projection.js").default} The projection (if cached). + */ +function get(code) { + return (cache[code] || + cache[code.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/, 'EPSG:$3')] || + null); +} +/** + * Add a projection to the cache. + * @param {string} code The projection code. + * @param {import("./Projection.js").default} projection The projection to cache. + */ +function add(code, projection) { + cache[code] = projection; +} +//# sourceMappingURL=projections.js.map +// EXTERNAL MODULE: ./node_modules/ol/obj.js +var obj = __webpack_require__("38f3"); + +// CONCATENATED MODULE: ./node_modules/ol/proj/transforms.js +/** + * @module ol/proj/transforms + */ + +/** + * @private + * @type {!Object>} + */ +var transforms = {}; +/** + * Clear the transform cache. + */ +function transforms_clear() { + transforms = {}; +} +/** + * Registers a conversion function to convert coordinates from the source + * projection to the destination projection. + * + * @param {import("./Projection.js").default} source Source. + * @param {import("./Projection.js").default} destination Destination. + * @param {import("../proj.js").TransformFunction} transformFn Transform. + */ +function transforms_add(source, destination, transformFn) { + var sourceCode = source.getCode(); + var destinationCode = destination.getCode(); + if (!(sourceCode in transforms)) { + transforms[sourceCode] = {}; + } + transforms[sourceCode][destinationCode] = transformFn; +} +/** + * Unregisters the conversion function to convert coordinates from the source + * projection to the destination projection. This method is used to clean up + * cached transforms during testing. + * + * @param {import("./Projection.js").default} source Source projection. + * @param {import("./Projection.js").default} destination Destination projection. + * @return {import("../proj.js").TransformFunction} transformFn The unregistered transform. + */ +function remove(source, destination) { + var sourceCode = source.getCode(); + var destinationCode = destination.getCode(); + var transform = transforms[sourceCode][destinationCode]; + delete transforms[sourceCode][destinationCode]; + if (Object(obj["d" /* isEmpty */])(transforms[sourceCode])) { + delete transforms[sourceCode]; + } + return transform; +} +/** + * Get a transform given a source code and a destination code. + * @param {string} sourceCode The code for the source projection. + * @param {string} destinationCode The code for the destination projection. + * @return {import("../proj.js").TransformFunction|undefined} The transform function (if found). + */ +function transforms_get(sourceCode, destinationCode) { + var transform; + if (sourceCode in transforms && destinationCode in transforms[sourceCode]) { + transform = transforms[sourceCode][destinationCode]; + } + return transform; +} +//# sourceMappingURL=transforms.js.map +// EXTERNAL MODULE: ./node_modules/ol/extent.js +var ol_extent = __webpack_require__("0af5"); + +// EXTERNAL MODULE: ./node_modules/ol/coordinate.js +var ol_coordinate = __webpack_require__("a568"); + +// EXTERNAL MODULE: ./node_modules/ol/sphere.js +var sphere = __webpack_require__("790a"); + +// CONCATENATED MODULE: ./node_modules/ol/proj.js +/** + * @module ol/proj + */ +/** + * The ol/proj module stores: + * * a list of {@link module:ol/proj/Projection~Projection} + * objects, one for each projection supported by the application + * * a list of transform functions needed to convert coordinates in one projection + * into another. + * + * The static functions are the methods used to maintain these. + * Each transform function can handle not only simple coordinate pairs, but also + * large arrays of coordinates such as vector geometries. + * + * When loaded, the library adds projection objects for EPSG:4326 (WGS84 + * geographic coordinates) and EPSG:3857 (Web or Spherical Mercator, as used + * for example by Bing Maps or OpenStreetMap), together with the relevant + * transform functions. + * + * Additional transforms may be added by using the http://proj4js.org/ + * library (version 2.2 or later). You can use the full build supplied by + * Proj4js, or create a custom build to support those projections you need; see + * the Proj4js website for how to do this. You also need the Proj4js definitions + * for the required projections. These definitions can be obtained from + * https://epsg.io/, and are a JS function, so can be loaded in a script + * tag (as in the examples) or pasted into your application. + * + * After all required projection definitions are added to proj4's registry (by + * using `proj4.defs()`), simply call `register(proj4)` from the `ol/proj/proj4` + * package. Existing transforms are not changed by this function. See + * examples/wms-image-custom-proj for an example of this. + * + * Additional projection definitions can be registered with `proj4.defs()` any + * time. Just make sure to call `register(proj4)` again; for example, with user-supplied data where you don't + * know in advance what projections are needed, you can initially load minimal + * support and then load whichever are requested. + * + * Note that Proj4js does not support projection extents. If you want to add + * one for creating default tile grids, you can add it after the Projection + * object has been created with `setExtent`, for example, + * `get('EPSG:1234').setExtent(extent)`. + * + * In addition to Proj4js support, any transform functions can be added with + * {@link module:ol/proj.addCoordinateTransforms}. To use this, you must first create + * a {@link module:ol/proj/Projection~Projection} object for the new projection and add it with + * {@link module:ol/proj.addProjection}. You can then add the forward and inverse + * functions with {@link module:ol/proj.addCoordinateTransforms}. See + * examples/wms-custom-proj for an example of this. + * + * Note that if no transforms are needed and you only need to define the + * projection, just add a {@link module:ol/proj/Projection~Projection} with + * {@link module:ol/proj.addProjection}. See examples/wms-no-proj for an example of + * this. + */ + + + + + + + + + + +/** + * A projection as {@link module:ol/proj/Projection~Projection}, SRS identifier + * string or undefined. + * @typedef {Projection|string|undefined} ProjectionLike + * @api + */ +/** + * A transform function accepts an array of input coordinate values, an optional + * output array, and an optional dimension (default should be 2). The function + * transforms the input coordinate values, populates the output array, and + * returns the output array. + * + * @typedef {function(Array, Array=, number=): Array} TransformFunction + * @api + */ + + +var showCoordinateWarning = true; +/** + * @param {boolean} [opt_disable = true] Disable console info about `useGeographic()` + */ +function disableCoordinateWarning(opt_disable) { + var hide = opt_disable === undefined ? true : opt_disable; + showCoordinateWarning = !hide; +} +/** + * @param {Array} input Input coordinate array. + * @param {Array} [opt_output] Output array of coordinate values. + * @param {number} [opt_dimension] Dimension. + * @return {Array} Output coordinate array (new array, same coordinate + * values). + */ +function cloneTransform(input, opt_output, opt_dimension) { + var output; + if (opt_output !== undefined) { + for (var i = 0, ii = input.length; i < ii; ++i) { + opt_output[i] = input[i]; + } + output = opt_output; + } + else { + output = input.slice(); + } + return output; +} +/** + * @param {Array} input Input coordinate array. + * @param {Array} [opt_output] Output array of coordinate values. + * @param {number} [opt_dimension] Dimension. + * @return {Array} Input coordinate array (same array as input). + */ +function identityTransform(input, opt_output, opt_dimension) { + if (opt_output !== undefined && input !== opt_output) { + for (var i = 0, ii = input.length; i < ii; ++i) { + opt_output[i] = input[i]; + } + input = opt_output; + } + return input; +} +/** + * Add a Projection object to the list of supported projections that can be + * looked up by their code. + * + * @param {Projection} projection Projection instance. + * @api + */ +function addProjection(projection) { + add(projection.getCode(), projection); + transforms_add(projection, projection, cloneTransform); +} +/** + * @param {Array} projections Projections. + */ +function addProjections(projections) { + projections.forEach(addProjection); +} +/** + * Fetches a Projection object for the code specified. + * + * @param {ProjectionLike} projectionLike Either a code string which is + * a combination of authority and identifier such as "EPSG:4326", or an + * existing projection object, or undefined. + * @return {Projection|null} Projection object, or null if not in list. + * @api + */ +function proj_get(projectionLike) { + return typeof projectionLike === 'string' + ? get(/** @type {string} */ (projectionLike)) + : /** @type {Projection} */ (projectionLike) || null; +} +/** + * Get the resolution of the point in degrees or distance units. + * For projections with degrees as the unit this will simply return the + * provided resolution. For other projections the point resolution is + * by default estimated by transforming the `point` pixel to EPSG:4326, + * measuring its width and height on the normal sphere, + * and taking the average of the width and height. + * A custom function can be provided for a specific projection, either + * by setting the `getPointResolution` option in the + * {@link module:ol/proj/Projection~Projection} constructor or by using + * {@link module:ol/proj/Projection~Projection#setGetPointResolution} to change an existing + * projection object. + * @param {ProjectionLike} projection The projection. + * @param {number} resolution Nominal resolution in projection units. + * @param {import("./coordinate.js").Coordinate} point Point to find adjusted resolution at. + * @param {import("./proj/Units.js").default} [opt_units] Units to get the point resolution in. + * Default is the projection's units. + * @return {number} Point resolution. + * @api + */ +function getPointResolution(projection, resolution, point, opt_units) { + projection = proj_get(projection); + var pointResolution; + var getter = projection.getPointResolutionFunc(); + if (getter) { + pointResolution = getter(resolution, point); + if (opt_units && opt_units !== projection.getUnits()) { + var metersPerUnit = projection.getMetersPerUnit(); + if (metersPerUnit) { + pointResolution = + (pointResolution * metersPerUnit) / Units["a" /* METERS_PER_UNIT */][opt_units]; + } + } + } + else { + var units = projection.getUnits(); + if ((units == Units["b" /* default */].DEGREES && !opt_units) || opt_units == Units["b" /* default */].DEGREES) { + pointResolution = resolution; + } + else { + // Estimate point resolution by transforming the center pixel to EPSG:4326, + // measuring its width and height on the normal sphere, and taking the + // average of the width and height. + var toEPSG4326_1 = getTransformFromProjections(projection, proj_get('EPSG:4326')); + if (toEPSG4326_1 === identityTransform && units !== Units["b" /* default */].DEGREES) { + // no transform is available + pointResolution = resolution * projection.getMetersPerUnit(); + } + else { + var vertices = [ + point[0] - resolution / 2, + point[1], + point[0] + resolution / 2, + point[1], + point[0], + point[1] - resolution / 2, + point[0], + point[1] + resolution / 2, + ]; + vertices = toEPSG4326_1(vertices, vertices, 2); + var width = Object(sphere["b" /* getDistance */])(vertices.slice(0, 2), vertices.slice(2, 4)); + var height = Object(sphere["b" /* getDistance */])(vertices.slice(4, 6), vertices.slice(6, 8)); + pointResolution = (width + height) / 2; + } + var metersPerUnit = opt_units + ? Units["a" /* METERS_PER_UNIT */][opt_units] + : projection.getMetersPerUnit(); + if (metersPerUnit !== undefined) { + pointResolution /= metersPerUnit; + } + } + } + return pointResolution; +} +/** + * Registers transformation functions that don't alter coordinates. Those allow + * to transform between projections with equal meaning. + * + * @param {Array} projections Projections. + * @api + */ +function addEquivalentProjections(projections) { + addProjections(projections); + projections.forEach(function (source) { + projections.forEach(function (destination) { + if (source !== destination) { + transforms_add(source, destination, cloneTransform); + } + }); + }); +} +/** + * Registers transformation functions to convert coordinates in any projection + * in projection1 to any projection in projection2. + * + * @param {Array} projections1 Projections with equal + * meaning. + * @param {Array} projections2 Projections with equal + * meaning. + * @param {TransformFunction} forwardTransform Transformation from any + * projection in projection1 to any projection in projection2. + * @param {TransformFunction} inverseTransform Transform from any projection + * in projection2 to any projection in projection1.. + */ +function addEquivalentTransforms(projections1, projections2, forwardTransform, inverseTransform) { + projections1.forEach(function (projection1) { + projections2.forEach(function (projection2) { + transforms_add(projection1, projection2, forwardTransform); + transforms_add(projection2, projection1, inverseTransform); + }); + }); +} +/** + * Clear all cached projections and transforms. + */ +function clearAllProjections() { + clear(); + transforms_clear(); +} +/** + * @param {Projection|string|undefined} projection Projection. + * @param {string} defaultCode Default code. + * @return {Projection} Projection. + */ +function createProjection(projection, defaultCode) { + if (!projection) { + return proj_get(defaultCode); + } + else if (typeof projection === 'string') { + return proj_get(projection); + } + else { + return /** @type {Projection} */ (projection); + } +} +/** + * Creates a {@link module:ol/proj~TransformFunction} from a simple 2D coordinate transform + * function. + * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} coordTransform Coordinate + * transform. + * @return {TransformFunction} Transform function. + */ +function createTransformFromCoordinateTransform(coordTransform) { + return ( + /** + * @param {Array} input Input. + * @param {Array} [opt_output] Output. + * @param {number} [opt_dimension] Dimension. + * @return {Array} Output. + */ + function (input, opt_output, opt_dimension) { + var length = input.length; + var dimension = opt_dimension !== undefined ? opt_dimension : 2; + var output = opt_output !== undefined ? opt_output : new Array(length); + for (var i = 0; i < length; i += dimension) { + var point = coordTransform(input.slice(i, i + dimension)); + var pointLength = point.length; + for (var j = 0, jj = dimension; j < jj; ++j) { + output[i + j] = j >= pointLength ? input[i + j] : point[j]; + } + } + return output; + }); +} +/** + * Registers coordinate transform functions to convert coordinates between the + * source projection and the destination projection. + * The forward and inverse functions convert coordinate pairs; this function + * converts these into the functions used internally which also handle + * extents and coordinate arrays. + * + * @param {ProjectionLike} source Source projection. + * @param {ProjectionLike} destination Destination projection. + * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} forward The forward transform + * function (that is, from the source projection to the destination + * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns + * the transformed {@link module:ol/coordinate~Coordinate}. + * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} inverse The inverse transform + * function (that is, from the destination projection to the source + * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns + * the transformed {@link module:ol/coordinate~Coordinate}. If the transform function can only + * transform less dimensions than the input coordinate, it is supposeed to return a coordinate + * with only the length it can transform. The other dimensions will be taken unchanged from the + * source. + * @api + */ +function addCoordinateTransforms(source, destination, forward, inverse) { + var sourceProj = proj_get(source); + var destProj = proj_get(destination); + transforms_add(sourceProj, destProj, createTransformFromCoordinateTransform(forward)); + transforms_add(destProj, sourceProj, createTransformFromCoordinateTransform(inverse)); +} +/** + * Transforms a coordinate from longitude/latitude to a different projection. + * @param {import("./coordinate.js").Coordinate} coordinate Coordinate as longitude and latitude, i.e. + * an array with longitude as 1st and latitude as 2nd element. + * @param {ProjectionLike} [opt_projection] Target projection. The + * default is Web Mercator, i.e. 'EPSG:3857'. + * @return {import("./coordinate.js").Coordinate} Coordinate projected to the target projection. + * @api + */ +function fromLonLat(coordinate, opt_projection) { + disableCoordinateWarning(); + return proj_transform(coordinate, 'EPSG:4326', opt_projection !== undefined ? opt_projection : 'EPSG:3857'); +} +/** + * Transforms a coordinate to longitude/latitude. + * @param {import("./coordinate.js").Coordinate} coordinate Projected coordinate. + * @param {ProjectionLike} [opt_projection] Projection of the coordinate. + * The default is Web Mercator, i.e. 'EPSG:3857'. + * @return {import("./coordinate.js").Coordinate} Coordinate as longitude and latitude, i.e. an array + * with longitude as 1st and latitude as 2nd element. + * @api + */ +function toLonLat(coordinate, opt_projection) { + var lonLat = proj_transform(coordinate, opt_projection !== undefined ? opt_projection : 'EPSG:3857', 'EPSG:4326'); + var lon = lonLat[0]; + if (lon < -180 || lon > 180) { + lonLat[0] = Object(math["g" /* modulo */])(lon + 180, 360) - 180; + } + return lonLat; +} +/** + * Checks if two projections are the same, that is every coordinate in one + * projection does represent the same geographic point as the same coordinate in + * the other projection. + * + * @param {Projection} projection1 Projection 1. + * @param {Projection} projection2 Projection 2. + * @return {boolean} Equivalent. + * @api + */ +function equivalent(projection1, projection2) { + if (projection1 === projection2) { + return true; + } + var equalUnits = projection1.getUnits() === projection2.getUnits(); + if (projection1.getCode() === projection2.getCode()) { + return equalUnits; + } + else { + var transformFunc = getTransformFromProjections(projection1, projection2); + return transformFunc === cloneTransform && equalUnits; + } +} +/** + * Searches in the list of transform functions for the function for converting + * coordinates from the source projection to the destination projection. + * + * @param {Projection} sourceProjection Source Projection object. + * @param {Projection} destinationProjection Destination Projection + * object. + * @return {TransformFunction} Transform function. + */ +function getTransformFromProjections(sourceProjection, destinationProjection) { + var sourceCode = sourceProjection.getCode(); + var destinationCode = destinationProjection.getCode(); + var transformFunc = transforms_get(sourceCode, destinationCode); + if (!transformFunc) { + transformFunc = identityTransform; + } + return transformFunc; +} +/** + * Given the projection-like objects, searches for a transformation + * function to convert a coordinates array from the source projection to the + * destination projection. + * + * @param {ProjectionLike} source Source. + * @param {ProjectionLike} destination Destination. + * @return {TransformFunction} Transform function. + * @api + */ +function getTransform(source, destination) { + var sourceProjection = proj_get(source); + var destinationProjection = proj_get(destination); + return getTransformFromProjections(sourceProjection, destinationProjection); +} +/** + * Transforms a coordinate from source projection to destination projection. + * This returns a new coordinate (and does not modify the original). + * + * See {@link module:ol/proj.transformExtent} for extent transformation. + * See the transform method of {@link module:ol/geom/Geometry~Geometry} and its + * subclasses for geometry transforms. + * + * @param {import("./coordinate.js").Coordinate} coordinate Coordinate. + * @param {ProjectionLike} source Source projection-like. + * @param {ProjectionLike} destination Destination projection-like. + * @return {import("./coordinate.js").Coordinate} Coordinate. + * @api + */ +function proj_transform(coordinate, source, destination) { + var transformFunc = getTransform(source, destination); + return transformFunc(coordinate, undefined, coordinate.length); +} +/** + * Transforms an extent from source projection to destination projection. This + * returns a new extent (and does not modify the original). + * + * @param {import("./extent.js").Extent} extent The extent to transform. + * @param {ProjectionLike} source Source projection-like. + * @param {ProjectionLike} destination Destination projection-like. + * @param {number} [opt_stops] Number of stops per side used for the transform. + * By default only the corners are used. + * @return {import("./extent.js").Extent} The transformed extent. + * @api + */ +function transformExtent(extent, source, destination, opt_stops) { + var transformFunc = getTransform(source, destination); + return Object(ol_extent["a" /* applyTransform */])(extent, transformFunc, undefined, opt_stops); +} +/** + * Transforms the given point to the destination projection. + * + * @param {import("./coordinate.js").Coordinate} point Point. + * @param {Projection} sourceProjection Source projection. + * @param {Projection} destinationProjection Destination projection. + * @return {import("./coordinate.js").Coordinate} Point. + */ +function transformWithProjections(point, sourceProjection, destinationProjection) { + var transformFunc = getTransformFromProjections(sourceProjection, destinationProjection); + return transformFunc(point); +} +/** + * @type {Projection|null} + */ +var userProjection = null; +/** + * Set the projection for coordinates supplied from and returned by API methods. + * This includes all API methods except for those interacting with tile grids. + * @param {ProjectionLike} projection The user projection. + * @api + */ +function setUserProjection(projection) { + userProjection = proj_get(projection); +} +/** + * Clear the user projection if set. + * @api + */ +function clearUserProjection() { + userProjection = null; +} +/** + * Get the projection for coordinates supplied from and returned by API methods. + * Note that this method is not yet a part of the stable API. Support for user + * projections is not yet complete and should be considered experimental. + * @return {Projection|null} The user projection (or null if not set). + * @api + */ +function getUserProjection() { + return userProjection; +} +/** + * Use geographic coordinates (WGS-84 datum) in API methods. This includes all API + * methods except for those interacting with tile grids. + * @api + */ +function useGeographic() { + setUserProjection('EPSG:4326'); +} +/** + * Return a coordinate transformed into the user projection. If no user projection + * is set, the original coordinate is returned. + * @param {Array} coordinate Input coordinate. + * @param {ProjectionLike} sourceProjection The input coordinate projection. + * @return {Array} The input coordinate in the user projection. + */ +function toUserCoordinate(coordinate, sourceProjection) { + if (!userProjection) { + return coordinate; + } + return proj_transform(coordinate, sourceProjection, userProjection); +} +/** + * Return a coordinate transformed from the user projection. If no user projection + * is set, the original coordinate is returned. + * @param {Array} coordinate Input coordinate. + * @param {ProjectionLike} destProjection The destination projection. + * @return {Array} The input coordinate transformed. + */ +function fromUserCoordinate(coordinate, destProjection) { + if (!userProjection) { + if (showCoordinateWarning && + !Object(ol_coordinate["b" /* equals */])(coordinate, [0, 0]) && + coordinate[0] >= -180 && + coordinate[0] <= 180 && + coordinate[1] >= -90 && + coordinate[1] <= 90) { + showCoordinateWarning = false; + // eslint-disable-next-line no-console + console.warn('Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.'); + } + return coordinate; + } + return proj_transform(coordinate, userProjection, destProjection); +} +/** + * Return an extent transformed into the user projection. If no user projection + * is set, the original extent is returned. + * @param {import("./extent.js").Extent} extent Input extent. + * @param {ProjectionLike} sourceProjection The input extent projection. + * @return {import("./extent.js").Extent} The input extent in the user projection. + */ +function toUserExtent(extent, sourceProjection) { + if (!userProjection) { + return extent; + } + return transformExtent(extent, sourceProjection, userProjection); +} +/** + * Return an extent transformed from the user projection. If no user projection + * is set, the original extent is returned. + * @param {import("./extent.js").Extent} extent Input extent. + * @param {ProjectionLike} destProjection The destination projection. + * @return {import("./extent.js").Extent} The input extent transformed. + */ +function fromUserExtent(extent, destProjection) { + if (!userProjection) { + return extent; + } + return transformExtent(extent, userProjection, destProjection); +} +/** + * Return the resolution in user projection units per pixel. If no user projection + * is set, or source or user projection are missing units, the original resolution + * is returned. + * @param {number} resolution Resolution in input projection units per pixel. + * @param {ProjectionLike} sourceProjection The input projection. + * @return {number} Resolution in user projection units per pixel. + */ +function toUserResolution(resolution, sourceProjection) { + if (!userProjection) { + return resolution; + } + var sourceUnits = proj_get(sourceProjection).getUnits(); + var userUnits = userProjection.getUnits(); + return sourceUnits && userUnits + ? (resolution * Units["a" /* METERS_PER_UNIT */][sourceUnits]) / Units["a" /* METERS_PER_UNIT */][userUnits] + : resolution; +} +/** + * Return the resolution in user projection units per pixel. If no user projection + * is set, or source or user projection are missing units, the original resolution + * is returned. + * @param {number} resolution Resolution in user projection units per pixel. + * @param {ProjectionLike} destProjection The destination projection. + * @return {number} Resolution in destination projection units per pixel. + */ +function fromUserResolution(resolution, destProjection) { + if (!userProjection) { + return resolution; + } + var sourceUnits = proj_get(destProjection).getUnits(); + var userUnits = userProjection.getUnits(); + return sourceUnits && userUnits + ? (resolution * Units["a" /* METERS_PER_UNIT */][userUnits]) / Units["a" /* METERS_PER_UNIT */][sourceUnits] + : resolution; +} +/** + * Creates a safe coordinate transform function from a coordinate transform function. + * "Safe" means that it can handle wrapping of x-coordinates for global projections, + * and that coordinates exceeding the source projection validity extent's range will be + * clamped to the validity range. + * @param {Projection} sourceProj Source projection. + * @param {Projection} destProj Destination projection. + * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} transform Transform function (source to destiation). + * @return {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} Safe transform function (source to destiation). + */ +function createSafeCoordinateTransform(sourceProj, destProj, transform) { + return function (coord) { + var transformed, worldsAway; + if (sourceProj.canWrapX()) { + var sourceExtent = sourceProj.getExtent(); + var sourceExtentWidth = Object(ol_extent["E" /* getWidth */])(sourceExtent); + coord = coord.slice(0); + worldsAway = Object(ol_coordinate["c" /* getWorldsAway */])(coord, sourceProj, sourceExtentWidth); + if (worldsAway) { + // Move x to the real world + coord[0] = coord[0] - worldsAway * sourceExtentWidth; + } + coord[0] = Object(math["b" /* clamp */])(coord[0], sourceExtent[0], sourceExtent[2]); + coord[1] = Object(math["b" /* clamp */])(coord[1], sourceExtent[1], sourceExtent[3]); + transformed = transform(coord); + } + else { + transformed = transform(coord); + } + if (worldsAway && destProj.canWrapX()) { + // Move transformed coordinate back to the offset world + transformed[0] += worldsAway * Object(ol_extent["E" /* getWidth */])(destProj.getExtent()); + } + return transformed; + }; +} +/** + * Add transforms to and from EPSG:4326 and EPSG:3857. This function is called + * by when this module is executed and should only need to be called again after + * `clearAllProjections()` is called (e.g. in tests). + */ +function addCommon() { + // Add transformations that don't alter coordinates to convert within set of + // projections with equal meaning. + addEquivalentProjections(PROJECTIONS); + addEquivalentProjections(epsg4326_PROJECTIONS); + // Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like + // coordinates and back. + addEquivalentTransforms(epsg4326_PROJECTIONS, PROJECTIONS, fromEPSG4326, toEPSG4326); +} +addCommon(); +//# sourceMappingURL=proj.js.map + +/***/ }), + +/***/ "25a5": +/***/ (function(module, exports, __webpack_require__) { + +!function(t,i){ true?module.exports=i():undefined}(this,function(){"use strict";function t(t,r,e,a,h){!function t(n,r,e,a,h){for(;a>e;){if(a-e>600){var o=a-e+1,s=r-e+1,l=Math.log(o),f=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*f*(o-f)/o)*(s-o/2<0?-1:1),m=Math.max(e,Math.floor(r-s*f/o+u)),c=Math.min(a,Math.floor(r+(o-s)*f/o+u));t(n,r,m,c,h)}var p=n[r],d=e,x=a;for(i(n,e,r),h(n[a],p)>0&&i(n,e,a);d0;)x--}0===h(n[e],p)?i(n,e,x):i(n,++x,a),x<=r&&(e=x+1),r<=x&&(a=x-1)}}(t,r,e||0,a||t.length-1,h||n)}function i(t,i,n){var r=t[i];t[i]=t[n],t[n]=r}function n(t,i){return ti?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function e(t,i,n){if(!n)return i.indexOf(t);for(var r=0;r=t.minX&&i.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function d(i,n,r,e,a){for(var h=[n,r];h.length;)if(!((r=h.pop())-(n=h.pop())<=e)){var o=n+Math.ceil((r-n)/e/2)*e;t(i,o,n,r,a),h.push(n,o,o,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var i=this.data,n=[];if(!c(t,i))return n;for(var r=this.toBBox,e=[];i;){for(var a=0;a=0&&e[i].children.length>this._maxEntries;)this._split(e,i),i--;this._adjustParentBBoxes(r,e,i)},r.prototype._split=function(t,i){var n=t[i],r=n.children.length,e=this._minEntries;this._chooseSplitAxis(n,e,r);var h=this._chooseSplitIndex(n,e,r),o=p(n.children.splice(h,n.children.length-h));o.height=n.height,o.leaf=n.leaf,a(n,this.toBBox),a(o,this.toBBox),i?t[i-1].children.push(o):this._splitRoot(n,o)},r.prototype._splitRoot=function(t,i){this.data=p([t,i]),this.data.height=t.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,i,n){for(var r,e,a,o,s,l,u,m=1/0,c=1/0,p=i;p<=n-i;p++){var d=h(t,0,p,this.toBBox),x=h(t,p,n,this.toBBox),v=(e=d,a=x,o=void 0,s=void 0,l=void 0,u=void 0,o=Math.max(e.minX,a.minX),s=Math.max(e.minY,a.minY),l=Math.min(e.maxX,a.maxX),u=Math.min(e.maxY,a.maxY),Math.max(0,l-o)*Math.max(0,u-s)),M=f(d)+f(x);v=i;c--){var p=t.children[c];o(s,t.leaf?e(p):p),l+=u(s)}return l},r.prototype._adjustParentBBoxes=function(t,i,n){for(var r=n;r>=0;r--)o(i[r],t)},r.prototype._condense=function(t){for(var i=t.length-1,n=void 0;i>=0;i--)0===t[i].children.length?i>0?(n=t[i-1].children).splice(n.indexOf(t[i]),1):this.clear():a(t[i],this.toBBox)},r}); + + +/***/ }), + +/***/ "25f1": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return linearRingContainsExtent; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return linearRingContainsXY; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return linearRingsContainsXY; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return linearRingssContainsXY; }); +/* harmony import */ var _extent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("0af5"); +/** + * @module ol/geom/flat/contains + */ + +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {import("../../extent.js").Extent} extent Extent. + * @return {boolean} Contains extent. + */ +function linearRingContainsExtent(flatCoordinates, offset, end, stride, extent) { + var outside = Object(_extent_js__WEBPACK_IMPORTED_MODULE_0__[/* forEachCorner */ "s"])(extent, + /** + * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate. + * @return {boolean} Contains (x, y). + */ + function (coordinate) { + return !linearRingContainsXY(flatCoordinates, offset, end, stride, coordinate[0], coordinate[1]); + }); + return !outside; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {number} end End. + * @param {number} stride Stride. + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). + */ +function linearRingContainsXY(flatCoordinates, offset, end, stride, x, y) { + // https://geomalgorithms.com/a03-_inclusion.html + // Copyright 2000 softSurfer, 2012 Dan Sunday + // This code may be freely used and modified for any purpose + // providing that this copyright notice is included with it. + // SoftSurfer makes no warranty for this code, and cannot be held + // liable for any real or imagined damage resulting from its use. + // Users of this code must verify correctness for their application. + var wn = 0; + var x1 = flatCoordinates[end - stride]; + var y1 = flatCoordinates[end - stride + 1]; + for (; offset < end; offset += stride) { + var x2 = flatCoordinates[offset]; + var y2 = flatCoordinates[offset + 1]; + if (y1 <= y) { + if (y2 > y && (x2 - x1) * (y - y1) - (x - x1) * (y2 - y1) > 0) { + wn++; + } + } + else if (y2 <= y && (x2 - x1) * (y - y1) - (x - x1) * (y2 - y1) < 0) { + wn--; + } + x1 = x2; + y1 = y2; + } + return wn !== 0; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array} ends Ends. + * @param {number} stride Stride. + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). + */ +function linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y) { + if (ends.length === 0) { + return false; + } + if (!linearRingContainsXY(flatCoordinates, offset, ends[0], stride, x, y)) { + return false; + } + for (var i = 1, ii = ends.length; i < ii; ++i) { + if (linearRingContainsXY(flatCoordinates, ends[i - 1], ends[i], stride, x, y)) { + return false; + } + } + return true; +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {number} offset Offset. + * @param {Array>} endss Endss. + * @param {number} stride Stride. + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). + */ +function linearRingssContainsXY(flatCoordinates, offset, endss, stride, x, y) { + if (endss.length === 0) { + return false; + } + for (var i = 0, ii = endss.length; i < ii; ++i) { + var ends = endss[i]; + if (linearRingsContainsXY(flatCoordinates, offset, ends, stride, x, y)) { + return true; + } + offset = ends[ends.length - 1]; + } + return false; +} +//# sourceMappingURL=contains.js.map + +/***/ }), + +/***/ "27c7": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +// ESM COMPAT FLAG +__webpack_require__.r(__webpack_exports__); + +// EXPORTS +__webpack_require__.d(__webpack_exports__, "EsriJSON", function() { return /* reexport */ format_EsriJSON; }); +__webpack_require__.d(__webpack_exports__, "GeoJSON", function() { return /* reexport */ GeoJSON["a" /* default */]; }); +__webpack_require__.d(__webpack_exports__, "GML", function() { return /* reexport */ format_GML; }); +__webpack_require__.d(__webpack_exports__, "GPX", function() { return /* reexport */ format_GPX; }); +__webpack_require__.d(__webpack_exports__, "IGC", function() { return /* reexport */ format_IGC; }); +__webpack_require__.d(__webpack_exports__, "IIIFInfo", function() { return /* reexport */ format_IIIFInfo; }); +__webpack_require__.d(__webpack_exports__, "KML", function() { return /* reexport */ format_KML; }); +__webpack_require__.d(__webpack_exports__, "MVT", function() { return /* reexport */ MVT["a" /* default */]; }); +__webpack_require__.d(__webpack_exports__, "OWS", function() { return /* reexport */ format_OWS; }); +__webpack_require__.d(__webpack_exports__, "Polyline", function() { return /* reexport */ format_Polyline; }); +__webpack_require__.d(__webpack_exports__, "TopoJSON", function() { return /* reexport */ format_TopoJSON; }); +__webpack_require__.d(__webpack_exports__, "WFS", function() { return /* reexport */ format_WFS; }); +__webpack_require__.d(__webpack_exports__, "WKB", function() { return /* reexport */ format_WKB; }); +__webpack_require__.d(__webpack_exports__, "WKT", function() { return /* reexport */ WKT["a" /* default */]; }); +__webpack_require__.d(__webpack_exports__, "WMSCapabilities", function() { return /* reexport */ format_WMSCapabilities; }); +__webpack_require__.d(__webpack_exports__, "WMSGetFeatureInfo", function() { return /* reexport */ format_WMSGetFeatureInfo; }); +__webpack_require__.d(__webpack_exports__, "WMTSCapabilities", function() { return /* reexport */ format_WMTSCapabilities; }); + +// EXTERNAL MODULE: ./node_modules/ol/Feature.js +var Feature = __webpack_require__("4cdf"); + +// EXTERNAL MODULE: ./node_modules/ol/geom/GeometryLayout.js +var GeometryLayout = __webpack_require__("521b"); + +// EXTERNAL MODULE: ./node_modules/ol/format/JSONFeature.js +var JSONFeature = __webpack_require__("377d"); + +// EXTERNAL MODULE: ./node_modules/ol/geom/LineString.js +var LineString = __webpack_require__("7a09"); + +// EXTERNAL MODULE: ./node_modules/ol/geom/LinearRing.js +var LinearRing = __webpack_require__("049d"); + +// EXTERNAL MODULE: ./node_modules/ol/geom/MultiLineString.js +var MultiLineString = __webpack_require__("47e4"); + +// EXTERNAL MODULE: ./node_modules/ol/geom/MultiPoint.js +var MultiPoint = __webpack_require__("9a44"); + +// EXTERNAL MODULE: ./node_modules/ol/geom/MultiPolygon.js +var MultiPolygon = __webpack_require__("88da"); + +// EXTERNAL MODULE: ./node_modules/ol/geom/Point.js +var Point = __webpack_require__("f403"); + +// EXTERNAL MODULE: ./node_modules/ol/geom/Polygon.js +var Polygon = __webpack_require__("5bc3"); + +// EXTERNAL MODULE: ./node_modules/ol/asserts.js +var asserts = __webpack_require__("92fa"); + +// EXTERNAL MODULE: ./node_modules/ol/obj.js +var ol_obj = __webpack_require__("38f3"); + +// EXTERNAL MODULE: ./node_modules/ol/extent.js +var ol_extent = __webpack_require__("0af5"); + +// EXTERNAL MODULE: ./node_modules/ol/geom/flat/deflate.js +var deflate = __webpack_require__("abb7"); + +// EXTERNAL MODULE: ./node_modules/ol/proj.js + 4 modules +var ol_proj = __webpack_require__("256f"); + +// EXTERNAL MODULE: ./node_modules/ol/geom/flat/orient.js + 1 modules +var orient = __webpack_require__("4d98"); + +// EXTERNAL MODULE: ./node_modules/ol/format/Feature.js +var format_Feature = __webpack_require__("b7df"); + +// CONCATENATED MODULE: ./node_modules/ol/format/EsriJSON.js +var __extends = (undefined && undefined.__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/format/EsriJSON + */ + + + + + + + + + + + + + + + + + +/** + * @typedef {import("arcgis-rest-api").Feature} EsriJSONFeature + * @typedef {import("arcgis-rest-api").FeatureSet} EsriJSONFeatureSet + * @typedef {import("arcgis-rest-api").Geometry} EsriJSONGeometry + * @typedef {import("arcgis-rest-api").Point} EsriJSONPoint + * @typedef {import("arcgis-rest-api").Polyline} EsriJSONPolyline + * @typedef {import("arcgis-rest-api").Polygon} EsriJSONPolygon + * @typedef {import("arcgis-rest-api").Multipoint} EsriJSONMultipoint + * @typedef {import("arcgis-rest-api").HasZM} EsriJSONHasZM + * @typedef {import("arcgis-rest-api").Position} EsriJSONPosition + * @typedef {import("arcgis-rest-api").SpatialReferenceWkid} EsriJSONSpatialReferenceWkid + */ +/** + * @typedef {Object} EsriJSONMultiPolygon + * @property {Array>>>} rings Rings for the MultiPolygon. + * @property {boolean} [hasM] If the polygon coordinates have an M value. + * @property {boolean} [hasZ] If the polygon coordinates have a Z value. + * @property {EsriJSONSpatialReferenceWkid} [spatialReference] The coordinate reference system. + */ +/** + * @const + * @type {Object} + */ +var GEOMETRY_READERS = { + Point: readPointGeometry, + LineString: readLineStringGeometry, + Polygon: readPolygonGeometry, + MultiPoint: readMultiPointGeometry, + MultiLineString: readMultiLineStringGeometry, + MultiPolygon: readMultiPolygonGeometry, +}; +/** + * @const + * @type {Object} + */ +var GEOMETRY_WRITERS = { + Point: writePointGeometry, + LineString: writeLineStringGeometry, + Polygon: writePolygonGeometry, + MultiPoint: writeMultiPointGeometry, + MultiLineString: writeMultiLineStringGeometry, + MultiPolygon: writeMultiPolygonGeometry, +}; +/** + * @typedef {Object} Options + * @property {string} [geometryName] Geometry name to use when creating features. + */ +/** + * @classdesc + * Feature format for reading and writing data in the EsriJSON format. + * + * @api + */ +var EsriJSON_EsriJSON = /** @class */ (function (_super) { + __extends(EsriJSON, _super); + /** + * @param {Options} [opt_options] Options. + */ + function EsriJSON(opt_options) { + var _this = this; + var options = opt_options ? opt_options : {}; + _this = _super.call(this) || this; + /** + * Name of the geometry attribute for features. + * @type {string|undefined} + * @private + */ + _this.geometryName_ = options.geometryName; + return _this; + } + /** + * @param {Object} object Object. + * @param {import("./Feature.js").ReadOptions} [opt_options] Read options. + * @param {string} [opt_idField] Name of the field where to get the id from. + * @protected + * @return {import("../Feature.js").default} Feature. + */ + EsriJSON.prototype.readFeatureFromObject = function (object, opt_options, opt_idField) { + var esriJSONFeature = /** @type {EsriJSONFeature} */ (object); + var geometry = readGeometry(esriJSONFeature.geometry, opt_options); + var feature = new Feature["a" /* default */](); + if (this.geometryName_) { + feature.setGeometryName(this.geometryName_); + } + feature.setGeometry(geometry); + if (esriJSONFeature.attributes) { + feature.setProperties(esriJSONFeature.attributes, true); + var id = esriJSONFeature.attributes[opt_idField]; + if (id !== undefined) { + feature.setId(/** @type {number} */ (id)); + } + } + return feature; + }; + /** + * @param {Object} object Object. + * @param {import("./Feature.js").ReadOptions} [opt_options] Read options. + * @protected + * @return {Array} Features. + */ + EsriJSON.prototype.readFeaturesFromObject = function (object, opt_options) { + var options = opt_options ? opt_options : {}; + if (object['features']) { + var esriJSONFeatureSet = /** @type {EsriJSONFeatureSet} */ (object); + /** @type {Array} */ + var features = []; + var esriJSONFeatures = esriJSONFeatureSet.features; + for (var i = 0, ii = esriJSONFeatures.length; i < ii; ++i) { + features.push(this.readFeatureFromObject(esriJSONFeatures[i], options, object.objectIdFieldName)); + } + return features; + } + else { + return [this.readFeatureFromObject(object, options)]; + } + }; + /** + * @param {EsriJSONGeometry} object Object. + * @param {import("./Feature.js").ReadOptions} [opt_options] Read options. + * @protected + * @return {import("../geom/Geometry.js").default} Geometry. + */ + EsriJSON.prototype.readGeometryFromObject = function (object, opt_options) { + return readGeometry(object, opt_options); + }; + /** + * @param {Object} object Object. + * @protected + * @return {import("../proj/Projection.js").default} Projection. + */ + EsriJSON.prototype.readProjectionFromObject = function (object) { + if (object['spatialReference'] && + object['spatialReference']['wkid'] !== undefined) { + var spatialReference = /** @type {EsriJSONSpatialReferenceWkid} */ (object['spatialReference']); + var crs = spatialReference.wkid; + return Object(ol_proj["h" /* get */])('EPSG:' + crs); + } + else { + return null; + } + }; + /** + * Encode a geometry as a EsriJSON object. + * + * @param {import("../geom/Geometry.js").default} geometry Geometry. + * @param {import("./Feature.js").WriteOptions} [opt_options] Write options. + * @return {EsriJSONGeometry} Object. + * @api + */ + EsriJSON.prototype.writeGeometryObject = function (geometry, opt_options) { + return writeGeometry(geometry, this.adaptOptions(opt_options)); + }; + /** + * Encode a feature as a esriJSON Feature object. + * + * @param {import("../Feature.js").default} feature Feature. + * @param {import("./Feature.js").WriteOptions} [opt_options] Write options. + * @return {Object} Object. + * @api + */ + EsriJSON.prototype.writeFeatureObject = function (feature, opt_options) { + opt_options = this.adaptOptions(opt_options); + var object = {}; + if (!feature.hasProperties()) { + object['attributes'] = {}; + return object; + } + var properties = feature.getProperties(); + var geometry = feature.getGeometry(); + if (geometry) { + object['geometry'] = writeGeometry(geometry, opt_options); + var projection = opt_options && + (opt_options.dataProjection || opt_options.featureProjection); + if (projection) { + object['geometry']['spatialReference'] = + /** @type {EsriJSONSpatialReferenceWkid} */ ({ + wkid: Number(Object(ol_proj["h" /* get */])(projection).getCode().split(':').pop()), + }); + } + delete properties[feature.getGeometryName()]; + } + if (!Object(ol_obj["d" /* isEmpty */])(properties)) { + object['attributes'] = properties; + } + else { + object['attributes'] = {}; + } + return object; + }; + /** + * Encode an array of features as a EsriJSON object. + * + * @param {Array} features Features. + * @param {import("./Feature.js").WriteOptions} [opt_options] Write options. + * @return {EsriJSONFeatureSet} EsriJSON Object. + * @api + */ + EsriJSON.prototype.writeFeaturesObject = function (features, opt_options) { + opt_options = this.adaptOptions(opt_options); + var objects = []; + for (var i = 0, ii = features.length; i < ii; ++i) { + objects.push(this.writeFeatureObject(features[i], opt_options)); + } + return { + 'features': objects, + }; + }; + return EsriJSON; +}(JSONFeature["a" /* default */])); +/** + * @param {EsriJSONGeometry} object Object. + * @param {import("./Feature.js").ReadOptions} [opt_options] Read options. + * @return {import("../geom/Geometry.js").default} Geometry. + */ +function readGeometry(object, opt_options) { + var _a, _b; + if (!object) { + return null; + } + /** @type {import("../geom/Geometry.js").Type} */ + var type; + if (typeof object['x'] === 'number' && typeof object['y'] === 'number') { + type = 'Point'; + } + else if (object['points']) { + type = 'MultiPoint'; + } + else if (object['paths']) { + var esriJSONPolyline = /** @type {EsriJSONPolyline} */ (object); + if (esriJSONPolyline.paths.length === 1) { + type = 'LineString'; + } + else { + type = 'MultiLineString'; + } + } + else if (object['rings']) { + var esriJSONPolygon = /** @type {EsriJSONPolygon} */ (object); + var layout = getGeometryLayout(esriJSONPolygon); + var rings = convertRings(esriJSONPolygon.rings, layout); + if (rings.length === 1) { + type = 'Polygon'; + object = Object(ol_obj["a" /* assign */])({}, object, (_a = {}, _a['rings'] = rings[0], _a)); + } + else { + type = 'MultiPolygon'; + object = Object(ol_obj["a" /* assign */])({}, object, (_b = {}, _b['rings'] = rings, _b)); + } + } + var geometryReader = GEOMETRY_READERS[type]; + return Object(format_Feature["c" /* transformGeometryWithOptions */])(geometryReader(object), false, opt_options); +} +/** + * Determines inner and outer rings. + * Checks if any polygons in this array contain any other polygons in this + * array. It is used for checking for holes. + * Logic inspired by: https://github.com/Esri/terraformer-arcgis-parser + * @param {Array>>} rings Rings. + * @param {import("../geom/GeometryLayout.js").default} layout Geometry layout. + * @return {Array>>>} Transformed rings. + */ +function convertRings(rings, layout) { + var flatRing = []; + var outerRings = []; + var holes = []; + var i, ii; + for (i = 0, ii = rings.length; i < ii; ++i) { + flatRing.length = 0; + Object(deflate["b" /* deflateCoordinates */])(flatRing, 0, rings[i], layout.length); + // is this ring an outer ring? is it clockwise? + var clockwise = Object(orient["b" /* linearRingIsClockwise */])(flatRing, 0, flatRing.length, layout.length); + if (clockwise) { + outerRings.push([rings[i]]); + } + else { + holes.push(rings[i]); + } + } + while (holes.length) { + var hole = holes.shift(); + var matched = false; + // loop over all outer rings and see if they contain our hole. + for (i = outerRings.length - 1; i >= 0; i--) { + var outerRing = outerRings[i][0]; + var containsHole = Object(ol_extent["g" /* containsExtent */])(new LinearRing["a" /* default */](outerRing).getExtent(), new LinearRing["a" /* default */](hole).getExtent()); + if (containsHole) { + // the hole is contained push it into our polygon + outerRings[i].push(hole); + matched = true; + break; + } + } + if (!matched) { + // no outer rings contain this hole turn it into and outer + // ring (reverse it) + outerRings.push([hole.reverse()]); + } + } + return outerRings; +} +/** + * @param {EsriJSONPoint} object Object. + * @return {import("../geom/Geometry.js").default} Point. + */ +function readPointGeometry(object) { + var point; + if (object.m !== undefined && object.z !== undefined) { + point = new Point["a" /* default */]([object.x, object.y, object.z, object.m], GeometryLayout["a" /* default */].XYZM); + } + else if (object.z !== undefined) { + point = new Point["a" /* default */]([object.x, object.y, object.z], GeometryLayout["a" /* default */].XYZ); + } + else if (object.m !== undefined) { + point = new Point["a" /* default */]([object.x, object.y, object.m], GeometryLayout["a" /* default */].XYM); + } + else { + point = new Point["a" /* default */]([object.x, object.y]); + } + return point; +} +/** + * @param {EsriJSONPolyline} object Object. + * @return {import("../geom/Geometry.js").default} LineString. + */ +function readLineStringGeometry(object) { + var layout = getGeometryLayout(object); + return new LineString["a" /* default */](object.paths[0], layout); +} +/** + * @param {EsriJSONPolyline} object Object. + * @return {import("../geom/Geometry.js").default} MultiLineString. + */ +function readMultiLineStringGeometry(object) { + var layout = getGeometryLayout(object); + return new MultiLineString["a" /* default */](object.paths, layout); +} +/** + * @param {EsriJSONHasZM} object Object. + * @return {import("../geom/GeometryLayout.js").default} The geometry layout to use. + */ +function getGeometryLayout(object) { + var layout = GeometryLayout["a" /* default */].XY; + if (object.hasZ === true && object.hasM === true) { + layout = GeometryLayout["a" /* default */].XYZM; + } + else if (object.hasZ === true) { + layout = GeometryLayout["a" /* default */].XYZ; + } + else if (object.hasM === true) { + layout = GeometryLayout["a" /* default */].XYM; + } + return layout; +} +/** + * @param {EsriJSONMultipoint} object Object. + * @return {import("../geom/Geometry.js").default} MultiPoint. + */ +function readMultiPointGeometry(object) { + var layout = getGeometryLayout(object); + return new MultiPoint["a" /* default */](object.points, layout); +} +/** + * @param {EsriJSONMultiPolygon} object Object. + * @return {import("../geom/Geometry.js").default} MultiPolygon. + */ +function readMultiPolygonGeometry(object) { + var layout = getGeometryLayout(object); + return new MultiPolygon["a" /* default */](object.rings, layout); +} +/** + * @param {EsriJSONPolygon} object Object. + * @return {import("../geom/Geometry.js").default} Polygon. + */ +function readPolygonGeometry(object) { + var layout = getGeometryLayout(object); + return new Polygon["a" /* default */](object.rings, layout); +} +/** + * @param {import("../geom/Point.js").default} geometry Geometry. + * @param {import("./Feature.js").WriteOptions} [opt_options] Write options. + * @return {EsriJSONPoint} EsriJSON geometry. + */ +function writePointGeometry(geometry, opt_options) { + var coordinates = geometry.getCoordinates(); + /** @type {EsriJSONPoint} */ + var esriJSON; + var layout = geometry.getLayout(); + if (layout === GeometryLayout["a" /* default */].XYZ) { + esriJSON = { + x: coordinates[0], + y: coordinates[1], + z: coordinates[2], + }; + } + else if (layout === GeometryLayout["a" /* default */].XYM) { + esriJSON = { + x: coordinates[0], + y: coordinates[1], + m: coordinates[2], + }; + } + else if (layout === GeometryLayout["a" /* default */].XYZM) { + esriJSON = { + x: coordinates[0], + y: coordinates[1], + z: coordinates[2], + m: coordinates[3], + }; + } + else if (layout === GeometryLayout["a" /* default */].XY) { + esriJSON = { + x: coordinates[0], + y: coordinates[1], + }; + } + else { + Object(asserts["a" /* assert */])(false, 34); // Invalid geometry layout + } + return esriJSON; +} +/** + * @param {import("../geom/SimpleGeometry.js").default} geometry Geometry. + * @return {Object} Object with boolean hasZ and hasM keys. + */ +function getHasZM(geometry) { + var layout = geometry.getLayout(); + return { + hasZ: layout === GeometryLayout["a" /* default */].XYZ || layout === GeometryLayout["a" /* default */].XYZM, + hasM: layout === GeometryLayout["a" /* default */].XYM || layout === GeometryLayout["a" /* default */].XYZM, + }; +} +/** + * @param {import("../geom/LineString.js").default} lineString Geometry. + * @param {import("./Feature.js").WriteOptions} [opt_options] Write options. + * @return {EsriJSONPolyline} EsriJSON geometry. + */ +function writeLineStringGeometry(lineString, opt_options) { + var hasZM = getHasZM(lineString); + return { + hasZ: hasZM.hasZ, + hasM: hasZM.hasM, + paths: [ + /** @type {Array} */ (lineString.getCoordinates()), + ], + }; +} +/** + * @param {import("../geom/Polygon.js").default} polygon Geometry. + * @param {import("./Feature.js").WriteOptions} [opt_options] Write options. + * @return {EsriJSONPolygon} EsriJSON geometry. + */ +function writePolygonGeometry(polygon, opt_options) { + // Esri geometries use the left-hand rule + var hasZM = getHasZM(polygon); + return { + hasZ: hasZM.hasZ, + hasM: hasZM.hasM, + rings: /** @type {Array>} */ (polygon.getCoordinates(false)), + }; +} +/** + * @param {import("../geom/MultiLineString.js").default} multiLineString Geometry. + * @param {import("./Feature.js").WriteOptions} [opt_options] Write options. + * @return {EsriJSONPolyline} EsriJSON geometry. + */ +function writeMultiLineStringGeometry(multiLineString, opt_options) { + var hasZM = getHasZM(multiLineString); + return { + hasZ: hasZM.hasZ, + hasM: hasZM.hasM, + paths: /** @type {Array>} */ (multiLineString.getCoordinates()), + }; +} +/** + * @param {import("../geom/MultiPoint.js").default} multiPoint Geometry. + * @param {import("./Feature.js").WriteOptions} [opt_options] Write options. + * @return {EsriJSONMultipoint} EsriJSON geometry. + */ +function writeMultiPointGeometry(multiPoint, opt_options) { + var hasZM = getHasZM(multiPoint); + return { + hasZ: hasZM.hasZ, + hasM: hasZM.hasM, + points: /** @type {Array} */ (multiPoint.getCoordinates()), + }; +} +/** + * @param {import("../geom/MultiPolygon.js").default} geometry Geometry. + * @param {import("./Feature.js").WriteOptions} [opt_options] Write options. + * @return {EsriJSONPolygon} EsriJSON geometry. + */ +function writeMultiPolygonGeometry(geometry, opt_options) { + var hasZM = getHasZM(geometry); + var coordinates = geometry.getCoordinates(false); + var output = []; + for (var i = 0; i < coordinates.length; i++) { + for (var x = coordinates[i].length - 1; x >= 0; x--) { + output.push(coordinates[i][x]); + } + } + return { + hasZ: hasZM.hasZ, + hasM: hasZM.hasM, + rings: /** @type {Array>} */ (output), + }; +} +/** + * @param {import("../geom/Geometry.js").default} geometry Geometry. + * @param {import("./Feature.js").WriteOptions} [opt_options] Write options. + * @return {EsriJSONGeometry} EsriJSON geometry. + */ +function writeGeometry(geometry, opt_options) { + var geometryWriter = GEOMETRY_WRITERS[geometry.getType()]; + return geometryWriter(Object(format_Feature["c" /* transformGeometryWithOptions */])(geometry, true, opt_options), opt_options); +} +/* harmony default export */ var format_EsriJSON = (EsriJSON_EsriJSON); +//# sourceMappingURL=EsriJSON.js.map +// EXTERNAL MODULE: ./node_modules/ol/format/GeoJSON.js +var GeoJSON = __webpack_require__("a2e1"); + +// EXTERNAL MODULE: ./node_modules/ol/util.js +var util = __webpack_require__("1300"); + +// EXTERNAL MODULE: ./node_modules/ol/array.js +var ol_array = __webpack_require__("9f5e"); + +// CONCATENATED MODULE: ./node_modules/ol/xml.js +/** + * @module ol/xml + */ + +/** + * When using {@link module:ol/xml.makeChildAppender} or + * {@link module:ol/xml.makeSimpleNodeFactory}, the top `objectStack` item needs + * to have this structure. + * @typedef {Object} NodeStackItem + * @property {Element} node Node. + */ +/** + * @typedef {function(Element, Array<*>): void} Parser + */ +/** + * @typedef {function(Element, *, Array<*>): void} Serializer + */ +/** + * @type {string} + */ +var XML_SCHEMA_INSTANCE_URI = 'http://www.w3.org/2001/XMLSchema-instance'; +/** + * @param {string} namespaceURI Namespace URI. + * @param {string} qualifiedName Qualified name. + * @return {Element} Node. + */ +function createElementNS(namespaceURI, qualifiedName) { + return getDocument().createElementNS(namespaceURI, qualifiedName); +} +/** + * Recursively grab all text content of child nodes into a single string. + * @param {Node} node Node. + * @param {boolean} normalizeWhitespace Normalize whitespace: remove all line + * breaks. + * @return {string} All text content. + * @api + */ +function getAllTextContent(node, normalizeWhitespace) { + return getAllTextContent_(node, normalizeWhitespace, []).join(''); +} +/** + * Recursively grab all text content of child nodes into a single string. + * @param {Node} node Node. + * @param {boolean} normalizeWhitespace Normalize whitespace: remove all line + * breaks. + * @param {Array} accumulator Accumulator. + * @private + * @return {Array} Accumulator. + */ +function getAllTextContent_(node, normalizeWhitespace, accumulator) { + if (node.nodeType == Node.CDATA_SECTION_NODE || + node.nodeType == Node.TEXT_NODE) { + if (normalizeWhitespace) { + accumulator.push(String(node.nodeValue).replace(/(\r\n|\r|\n)/g, '')); + } + else { + accumulator.push(node.nodeValue); + } + } + else { + var n = void 0; + for (n = node.firstChild; n; n = n.nextSibling) { + getAllTextContent_(n, normalizeWhitespace, accumulator); + } + } + return accumulator; +} +/** + * @param {Object} object Object. + * @return {boolean} Is a document. + */ +function isDocument(object) { + return 'documentElement' in object; +} +/** + * @param {Element} node Node. + * @param {?string} namespaceURI Namespace URI. + * @param {string} name Attribute name. + * @return {string} Value + */ +function getAttributeNS(node, namespaceURI, name) { + return node.getAttributeNS(namespaceURI, name) || ''; +} +/** + * Parse an XML string to an XML Document. + * @param {string} xml XML. + * @return {Document} Document. + * @api + */ +function parse(xml) { + return new DOMParser().parseFromString(xml, 'application/xml'); +} +/** + * Make an array extender function for extending the array at the top of the + * object stack. + * @param {function(this: T, Node, Array<*>): (Array<*>|undefined)} valueReader Value reader. + * @param {T} [opt_this] The object to use as `this` in `valueReader`. + * @return {Parser} Parser. + * @template T + */ +function makeArrayExtender(valueReader, opt_this) { + return ( + /** + * @param {Node} node Node. + * @param {Array<*>} objectStack Object stack. + */ + function (node, objectStack) { + var value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack); + if (value !== undefined) { + var array = /** @type {Array<*>} */ (objectStack[objectStack.length - 1]); + Object(ol_array["c" /* extend */])(array, value); + } + }); +} +/** + * Make an array pusher function for pushing to the array at the top of the + * object stack. + * @param {function(this: T, Element, Array<*>): *} valueReader Value reader. + * @param {T} [opt_this] The object to use as `this` in `valueReader`. + * @return {Parser} Parser. + * @template T + */ +function makeArrayPusher(valueReader, opt_this) { + return ( + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ + function (node, objectStack) { + var value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack); + if (value !== undefined) { + var array = /** @type {Array<*>} */ (objectStack[objectStack.length - 1]); + array.push(value); + } + }); +} +/** + * Make an object stack replacer function for replacing the object at the + * top of the stack. + * @param {function(this: T, Node, Array<*>): *} valueReader Value reader. + * @param {T} [opt_this] The object to use as `this` in `valueReader`. + * @return {Parser} Parser. + * @template T + */ +function makeReplacer(valueReader, opt_this) { + return ( + /** + * @param {Node} node Node. + * @param {Array<*>} objectStack Object stack. + */ + function (node, objectStack) { + var value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack); + if (value !== undefined) { + objectStack[objectStack.length - 1] = value; + } + }); +} +/** + * Make an object property pusher function for adding a property to the + * object at the top of the stack. + * @param {function(this: T, Element, Array<*>): *} valueReader Value reader. + * @param {string} [opt_property] Property. + * @param {T} [opt_this] The object to use as `this` in `valueReader`. + * @return {Parser} Parser. + * @template T + */ +function makeObjectPropertyPusher(valueReader, opt_property, opt_this) { + return ( + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ + function (node, objectStack) { + var value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack); + if (value !== undefined) { + var object = /** @type {!Object} */ (objectStack[objectStack.length - 1]); + var property = opt_property !== undefined ? opt_property : node.localName; + var array = void 0; + if (property in object) { + array = object[property]; + } + else { + array = []; + object[property] = array; + } + array.push(value); + } + }); +} +/** + * Make an object property setter function. + * @param {function(this: T, Element, Array<*>): *} valueReader Value reader. + * @param {string} [opt_property] Property. + * @param {T} [opt_this] The object to use as `this` in `valueReader`. + * @return {Parser} Parser. + * @template T + */ +function makeObjectPropertySetter(valueReader, opt_property, opt_this) { + return ( + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ + function (node, objectStack) { + var value = valueReader.call(opt_this !== undefined ? opt_this : this, node, objectStack); + if (value !== undefined) { + var object = /** @type {!Object} */ (objectStack[objectStack.length - 1]); + var property = opt_property !== undefined ? opt_property : node.localName; + object[property] = value; + } + }); +} +/** + * Create a serializer that appends nodes written by its `nodeWriter` to its + * designated parent. The parent is the `node` of the + * {@link module:ol/xml~NodeStackItem} at the top of the `objectStack`. + * @param {function(this: T, Node, V, Array<*>): void} nodeWriter Node writer. + * @param {T} [opt_this] The object to use as `this` in `nodeWriter`. + * @return {Serializer} Serializer. + * @template T, V + */ +function makeChildAppender(nodeWriter, opt_this) { + return function (node, value, objectStack) { + nodeWriter.call(opt_this !== undefined ? opt_this : this, node, value, objectStack); + var parent = /** @type {NodeStackItem} */ (objectStack[objectStack.length - 1]); + var parentNode = parent.node; + parentNode.appendChild(node); + }; +} +/** + * Create a serializer that calls the provided `nodeWriter` from + * {@link module:ol/xml.serialize}. This can be used by the parent writer to have the + * `nodeWriter` called with an array of values when the `nodeWriter` was + * designed to serialize a single item. An example would be a LineString + * geometry writer, which could be reused for writing MultiLineString + * geometries. + * @param {function(this: T, Element, V, Array<*>): void} nodeWriter Node writer. + * @param {T} [opt_this] The object to use as `this` in `nodeWriter`. + * @return {Serializer} Serializer. + * @template T, V + */ +function makeArraySerializer(nodeWriter, opt_this) { + var serializersNS, nodeFactory; + return function (node, value, objectStack) { + if (serializersNS === undefined) { + serializersNS = {}; + var serializers = {}; + serializers[node.localName] = nodeWriter; + serializersNS[node.namespaceURI] = serializers; + nodeFactory = makeSimpleNodeFactory(node.localName); + } + serialize(serializersNS, nodeFactory, value, objectStack); + }; +} +/** + * Create a node factory which can use the `opt_keys` passed to + * {@link module:ol/xml.serialize} or {@link module:ol/xml.pushSerializeAndPop} as node names, + * or a fixed node name. The namespace of the created nodes can either be fixed, + * or the parent namespace will be used. + * @param {string} [opt_nodeName] Fixed node name which will be used for all + * created nodes. If not provided, the 3rd argument to the resulting node + * factory needs to be provided and will be the nodeName. + * @param {string} [opt_namespaceURI] Fixed namespace URI which will be used for + * all created nodes. If not provided, the namespace of the parent node will + * be used. + * @return {function(*, Array<*>, string=): (Node|undefined)} Node factory. + */ +function makeSimpleNodeFactory(opt_nodeName, opt_namespaceURI) { + var fixedNodeName = opt_nodeName; + return ( + /** + * @param {*} value Value. + * @param {Array<*>} objectStack Object stack. + * @param {string} [opt_nodeName] Node name. + * @return {Node} Node. + */ + function (value, objectStack, opt_nodeName) { + var context = /** @type {NodeStackItem} */ (objectStack[objectStack.length - 1]); + var node = context.node; + var nodeName = fixedNodeName; + if (nodeName === undefined) { + nodeName = opt_nodeName; + } + var namespaceURI = opt_namespaceURI !== undefined ? opt_namespaceURI : node.namespaceURI; + return createElementNS(namespaceURI, /** @type {string} */ (nodeName)); + }); +} +/** + * A node factory that creates a node using the parent's `namespaceURI` and the + * `nodeName` passed by {@link module:ol/xml.serialize} or + * {@link module:ol/xml.pushSerializeAndPop} to the node factory. + * @const + * @type {function(*, Array<*>, string=): (Node|undefined)} + */ +var OBJECT_PROPERTY_NODE_FACTORY = makeSimpleNodeFactory(); +/** + * Create an array of `values` to be used with {@link module:ol/xml.serialize} or + * {@link module:ol/xml.pushSerializeAndPop}, where `orderedKeys` has to be provided as + * `opt_key` argument. + * @param {Object} object Key-value pairs for the sequence. Keys can + * be a subset of the `orderedKeys`. + * @param {Array} orderedKeys Keys in the order of the sequence. + * @return {Array<*>} Values in the order of the sequence. The resulting array + * has the same length as the `orderedKeys` array. Values that are not + * present in `object` will be `undefined` in the resulting array. + */ +function makeSequence(object, orderedKeys) { + var length = orderedKeys.length; + var sequence = new Array(length); + for (var i = 0; i < length; ++i) { + sequence[i] = object[orderedKeys[i]]; + } + return sequence; +} +/** + * Create a namespaced structure, using the same values for each namespace. + * This can be used as a starting point for versioned parsers, when only a few + * values are version specific. + * @param {Array} namespaceURIs Namespace URIs. + * @param {T} structure Structure. + * @param {Object} [opt_structureNS] Namespaced structure to add to. + * @return {Object} Namespaced structure. + * @template T + */ +function makeStructureNS(namespaceURIs, structure, opt_structureNS) { + /** + * @type {Object} + */ + var structureNS = opt_structureNS !== undefined ? opt_structureNS : {}; + var i, ii; + for (i = 0, ii = namespaceURIs.length; i < ii; ++i) { + structureNS[namespaceURIs[i]] = structure; + } + return structureNS; +} +/** + * Parse a node using the parsers and object stack. + * @param {Object>} parsersNS + * Parsers by namespace. + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @param {*} [opt_this] The object to use as `this`. + */ +function parseNode(parsersNS, node, objectStack, opt_this) { + var n; + for (n = node.firstElementChild; n; n = n.nextElementSibling) { + var parsers = parsersNS[n.namespaceURI]; + if (parsers !== undefined) { + var parser = parsers[n.localName]; + if (parser !== undefined) { + parser.call(opt_this, n, objectStack); + } + } + } +} +/** + * Push an object on top of the stack, parse and return the popped object. + * @param {T} object Object. + * @param {Object>} parsersNS + * Parsers by namespace. + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @param {*} [opt_this] The object to use as `this`. + * @return {T} Object. + * @template T + */ +function pushParseAndPop(object, parsersNS, node, objectStack, opt_this) { + objectStack.push(object); + parseNode(parsersNS, node, objectStack, opt_this); + return /** @type {T} */ (objectStack.pop()); +} +/** + * Walk through an array of `values` and call a serializer for each value. + * @param {Object>} serializersNS + * Namespaced serializers. + * @param {function(this: T, *, Array<*>, (string|undefined)): (Node|undefined)} nodeFactory + * Node factory. The `nodeFactory` creates the node whose namespace and name + * will be used to choose a node writer from `serializersNS`. This + * separation allows us to decide what kind of node to create, depending on + * the value we want to serialize. An example for this would be different + * geometry writers based on the geometry type. + * @param {Array<*>} values Values to serialize. An example would be an array + * of {@link module:ol/Feature~Feature} instances. + * @param {Array<*>} objectStack Node stack. + * @param {Array} [opt_keys] Keys of the `values`. Will be passed to the + * `nodeFactory`. This is used for serializing object literals where the + * node name relates to the property key. The array length of `opt_keys` has + * to match the length of `values`. For serializing a sequence, `opt_keys` + * determines the order of the sequence. + * @param {T} [opt_this] The object to use as `this` for the node factory and + * serializers. + * @template T + */ +function serialize(serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this) { + var length = (opt_keys !== undefined ? opt_keys : values).length; + var value, node; + for (var i = 0; i < length; ++i) { + value = values[i]; + if (value !== undefined) { + node = nodeFactory.call(opt_this !== undefined ? opt_this : this, value, objectStack, opt_keys !== undefined ? opt_keys[i] : undefined); + if (node !== undefined) { + serializersNS[node.namespaceURI][node.localName].call(opt_this, node, value, objectStack); + } + } + } +} +/** + * @param {O} object Object. + * @param {Object>} serializersNS + * Namespaced serializers. + * @param {function(this: T, *, Array<*>, (string|undefined)): (Node|undefined)} nodeFactory + * Node factory. The `nodeFactory` creates the node whose namespace and name + * will be used to choose a node writer from `serializersNS`. This + * separation allows us to decide what kind of node to create, depending on + * the value we want to serialize. An example for this would be different + * geometry writers based on the geometry type. + * @param {Array<*>} values Values to serialize. An example would be an array + * of {@link module:ol/Feature~Feature} instances. + * @param {Array<*>} objectStack Node stack. + * @param {Array} [opt_keys] Keys of the `values`. Will be passed to the + * `nodeFactory`. This is used for serializing object literals where the + * node name relates to the property key. The array length of `opt_keys` has + * to match the length of `values`. For serializing a sequence, `opt_keys` + * determines the order of the sequence. + * @param {T} [opt_this] The object to use as `this` for the node factory and + * serializers. + * @return {O|undefined} Object. + * @template O, T + */ +function pushSerializeAndPop(object, serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this) { + objectStack.push(object); + serialize(serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this); + return /** @type {O|undefined} */ (objectStack.pop()); +} +var xmlSerializer_ = undefined; +/** + * Register a XMLSerializer. Can be used to inject a XMLSerializer + * where there is no globally available implementation. + * + * @param {XMLSerializer} xmlSerializer A XMLSerializer. + * @api + */ +function registerXMLSerializer(xmlSerializer) { + xmlSerializer_ = xmlSerializer; +} +/** + * @return {XMLSerializer} The XMLSerializer. + */ +function getXMLSerializer() { + if (xmlSerializer_ === undefined && typeof XMLSerializer !== 'undefined') { + xmlSerializer_ = new XMLSerializer(); + } + return xmlSerializer_; +} +var document_ = undefined; +/** + * Register a Document to use when creating nodes for XML serializations. Can be used + * to inject a Document where there is no globally available implementation. + * + * @param {Document} document A Document. + * @api + */ +function registerDocument(document) { + document_ = document; +} +/** + * Get a document that should be used when creating nodes for XML serializations. + * @return {Document} The document. + */ +function getDocument() { + if (document_ === undefined && typeof document !== 'undefined') { + document_ = document.implementation.createDocument('', '', null); + } + return document_; +} +//# sourceMappingURL=xml.js.map +// CONCATENATED MODULE: ./node_modules/ol/format/XMLFeature.js +var XMLFeature_extends = (undefined && undefined.__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/format/XMLFeature + */ + + + + +/** + * @classdesc + * Abstract base class; normally only used for creating subclasses and not + * instantiated in apps. + * Base class for XML feature formats. + * + * @abstract + */ +var XMLFeature_XMLFeature = /** @class */ (function (_super) { + XMLFeature_extends(XMLFeature, _super); + function XMLFeature() { + var _this = _super.call(this) || this; + /** + * @type {XMLSerializer} + * @private + */ + _this.xmlSerializer_ = getXMLSerializer(); + return _this; + } + /** + * @return {import("./Feature.js").Type} Format. + */ + XMLFeature.prototype.getType = function () { + return 'xml'; + }; + /** + * Read a single feature. + * + * @param {Document|Element|Object|string} source Source. + * @param {import("./Feature.js").ReadOptions} [opt_options] Read options. + * @return {import("../Feature.js").default} Feature. + * @api + */ + XMLFeature.prototype.readFeature = function (source, opt_options) { + if (!source) { + return null; + } + else if (typeof source === 'string') { + var doc = parse(source); + return this.readFeatureFromDocument(doc, opt_options); + } + else if (isDocument(source)) { + return this.readFeatureFromDocument( + /** @type {Document} */ (source), opt_options); + } + else { + return this.readFeatureFromNode( + /** @type {Element} */ (source), opt_options); + } + }; + /** + * @param {Document} doc Document. + * @param {import("./Feature.js").ReadOptions} [opt_options] Options. + * @return {import("../Feature.js").default} Feature. + */ + XMLFeature.prototype.readFeatureFromDocument = function (doc, opt_options) { + var features = this.readFeaturesFromDocument(doc, opt_options); + if (features.length > 0) { + return features[0]; + } + else { + return null; + } + }; + /** + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions} [opt_options] Options. + * @return {import("../Feature.js").default} Feature. + */ + XMLFeature.prototype.readFeatureFromNode = function (node, opt_options) { + return null; // not implemented + }; + /** + * Read all features from a feature collection. + * + * @param {Document|Element|Object|string} source Source. + * @param {import("./Feature.js").ReadOptions} [opt_options] Options. + * @return {Array} Features. + * @api + */ + XMLFeature.prototype.readFeatures = function (source, opt_options) { + if (!source) { + return []; + } + else if (typeof source === 'string') { + var doc = parse(source); + return this.readFeaturesFromDocument(doc, opt_options); + } + else if (isDocument(source)) { + return this.readFeaturesFromDocument( + /** @type {Document} */ (source), opt_options); + } + else { + return this.readFeaturesFromNode( + /** @type {Element} */ (source), opt_options); + } + }; + /** + * @param {Document} doc Document. + * @param {import("./Feature.js").ReadOptions} [opt_options] Options. + * @protected + * @return {Array} Features. + */ + XMLFeature.prototype.readFeaturesFromDocument = function (doc, opt_options) { + /** @type {Array} */ + var features = []; + for (var n = doc.firstChild; n; n = n.nextSibling) { + if (n.nodeType == Node.ELEMENT_NODE) { + Object(ol_array["c" /* extend */])(features, this.readFeaturesFromNode(/** @type {Element} */ (n), opt_options)); + } + } + return features; + }; + /** + * @abstract + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions} [opt_options] Options. + * @protected + * @return {Array} Features. + */ + XMLFeature.prototype.readFeaturesFromNode = function (node, opt_options) { + return Object(util["b" /* abstract */])(); + }; + /** + * Read a single geometry from a source. + * + * @param {Document|Element|Object|string} source Source. + * @param {import("./Feature.js").ReadOptions} [opt_options] Read options. + * @return {import("../geom/Geometry.js").default} Geometry. + */ + XMLFeature.prototype.readGeometry = function (source, opt_options) { + if (!source) { + return null; + } + else if (typeof source === 'string') { + var doc = parse(source); + return this.readGeometryFromDocument(doc, opt_options); + } + else if (isDocument(source)) { + return this.readGeometryFromDocument( + /** @type {Document} */ (source), opt_options); + } + else { + return this.readGeometryFromNode( + /** @type {Element} */ (source), opt_options); + } + }; + /** + * @param {Document} doc Document. + * @param {import("./Feature.js").ReadOptions} [opt_options] Options. + * @protected + * @return {import("../geom/Geometry.js").default} Geometry. + */ + XMLFeature.prototype.readGeometryFromDocument = function (doc, opt_options) { + return null; // not implemented + }; + /** + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions} [opt_options] Options. + * @protected + * @return {import("../geom/Geometry.js").default} Geometry. + */ + XMLFeature.prototype.readGeometryFromNode = function (node, opt_options) { + return null; // not implemented + }; + /** + * Read the projection from the source. + * + * @param {Document|Element|Object|string} source Source. + * @return {import("../proj/Projection.js").default} Projection. + * @api + */ + XMLFeature.prototype.readProjection = function (source) { + if (!source) { + return null; + } + else if (typeof source === 'string') { + var doc = parse(source); + return this.readProjectionFromDocument(doc); + } + else if (isDocument(source)) { + return this.readProjectionFromDocument(/** @type {Document} */ (source)); + } + else { + return this.readProjectionFromNode(/** @type {Element} */ (source)); + } + }; + /** + * @param {Document} doc Document. + * @protected + * @return {import("../proj/Projection.js").default} Projection. + */ + XMLFeature.prototype.readProjectionFromDocument = function (doc) { + return this.dataProjection; + }; + /** + * @param {Element} node Node. + * @protected + * @return {import("../proj/Projection.js").default} Projection. + */ + XMLFeature.prototype.readProjectionFromNode = function (node) { + return this.dataProjection; + }; + /** + * Encode a feature as string. + * + * @param {import("../Feature.js").default} feature Feature. + * @param {import("./Feature.js").WriteOptions} [opt_options] Write options. + * @return {string} Encoded feature. + */ + XMLFeature.prototype.writeFeature = function (feature, opt_options) { + var node = this.writeFeatureNode(feature, opt_options); + return this.xmlSerializer_.serializeToString(node); + }; + /** + * @param {import("../Feature.js").default} feature Feature. + * @param {import("./Feature.js").WriteOptions} [opt_options] Options. + * @protected + * @return {Node} Node. + */ + XMLFeature.prototype.writeFeatureNode = function (feature, opt_options) { + return null; // not implemented + }; + /** + * Encode an array of features as string. + * + * @param {Array} features Features. + * @param {import("./Feature.js").WriteOptions} [opt_options] Write options. + * @return {string} Result. + * @api + */ + XMLFeature.prototype.writeFeatures = function (features, opt_options) { + var node = this.writeFeaturesNode(features, opt_options); + return this.xmlSerializer_.serializeToString(node); + }; + /** + * @param {Array} features Features. + * @param {import("./Feature.js").WriteOptions} [opt_options] Options. + * @return {Node} Node. + */ + XMLFeature.prototype.writeFeaturesNode = function (features, opt_options) { + return null; // not implemented + }; + /** + * Encode a geometry as string. + * + * @param {import("../geom/Geometry.js").default} geometry Geometry. + * @param {import("./Feature.js").WriteOptions} [opt_options] Write options. + * @return {string} Encoded geometry. + */ + XMLFeature.prototype.writeGeometry = function (geometry, opt_options) { + var node = this.writeGeometryNode(geometry, opt_options); + return this.xmlSerializer_.serializeToString(node); + }; + /** + * @param {import("../geom/Geometry.js").default} geometry Geometry. + * @param {import("./Feature.js").WriteOptions} [opt_options] Options. + * @return {Node} Node. + */ + XMLFeature.prototype.writeGeometryNode = function (geometry, opt_options) { + return null; // not implemented + }; + return XMLFeature; +}(format_Feature["a" /* default */])); +/* harmony default export */ var format_XMLFeature = (XMLFeature_XMLFeature); +//# sourceMappingURL=XMLFeature.js.map +// CONCATENATED MODULE: ./node_modules/ol/format/GMLBase.js +var GMLBase_extends = (undefined && undefined.__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/format/GMLBase + */ +// FIXME Envelopes should not be treated as geometries! readEnvelope_ is part +// of GEOMETRY_PARSERS_ and methods using GEOMETRY_PARSERS_ do not expect +// envelopes/extents, only geometries! + + + + + + + + + + + + + + + +/** + * @const + * @type {string} + */ +var GMLNS = 'http://www.opengis.net/gml'; +/** + * A regular expression that matches if a string only contains whitespace + * characters. It will e.g. match `''`, `' '`, `'\n'` etc. The non-breaking + * space (0xa0) is explicitly included as IE doesn't include it in its + * definition of `\s`. + * + * Information from `goog.string.isEmptyOrWhitespace`: https://github.com/google/closure-library/blob/e877b1e/closure/goog/string/string.js#L156-L160 + * + * @const + * @type {RegExp} + */ +var ONLY_WHITESPACE_RE = /^[\s\xa0]*$/; +/** + * @typedef {Object} Options + * @property {Object|string} [featureNS] Feature + * namespace. If not defined will be derived from GML. If multiple + * feature types have been configured which come from different feature + * namespaces, this will be an object with the keys being the prefixes used + * in the entries of featureType array. The values of the object will be the + * feature namespaces themselves. So for instance there might be a featureType + * item `topp:states` in the `featureType` array and then there will be a key + * `topp` in the featureNS object with value `http://www.openplans.org/topp`. + * @property {Array|string} [featureType] Feature type(s) to parse. + * If multiple feature types need to be configured + * which come from different feature namespaces, `featureNS` will be an object + * with the keys being the prefixes used in the entries of featureType array. + * The values of the object will be the feature namespaces themselves. + * So for instance there might be a featureType item `topp:states` and then + * there will be a key named `topp` in the featureNS object with value + * `http://www.openplans.org/topp`. + * @property {string} srsName srsName to use when writing geometries. + * @property {boolean} [surface=false] Write gml:Surface instead of gml:Polygon + * elements. This also affects the elements in multi-part geometries. + * @property {boolean} [curve=false] Write gml:Curve instead of gml:LineString + * elements. This also affects the elements in multi-part geometries. + * @property {boolean} [multiCurve=true] Write gml:MultiCurve instead of gml:MultiLineString. + * Since the latter is deprecated in GML 3. + * @property {boolean} [multiSurface=true] Write gml:multiSurface instead of + * gml:MultiPolygon. Since the latter is deprecated in GML 3. + * @property {string} [schemaLocation] Optional schemaLocation to use when + * writing out the GML, this will override the default provided. + * @property {boolean} [hasZ=false] If coordinates have a Z value. + */ +/** + * @classdesc + * Abstract base class; normally only used for creating subclasses and not + * instantiated in apps. + * Feature base format for reading and writing data in the GML format. + * This class cannot be instantiated, it contains only base content that + * is shared with versioned format classes GML2 and GML3. + * + * @abstract + * @api + */ +var GMLBase_GMLBase = /** @class */ (function (_super) { + GMLBase_extends(GMLBase, _super); + /** + * @param {Options} [opt_options] Optional configuration object. + */ + function GMLBase(opt_options) { + var _this = _super.call(this) || this; + var options = /** @type {Options} */ (opt_options ? opt_options : {}); + /** + * @protected + * @type {Array|string|undefined} + */ + _this.featureType = options.featureType; + /** + * @protected + * @type {Object|string|undefined} + */ + _this.featureNS = options.featureNS; + /** + * @protected + * @type {string} + */ + _this.srsName = options.srsName; + /** + * @protected + * @type {string} + */ + _this.schemaLocation = ''; + /** + * @type {Object>} + */ + _this.FEATURE_COLLECTION_PARSERS = {}; + _this.FEATURE_COLLECTION_PARSERS[_this.namespace] = { + 'featureMember': makeArrayPusher(_this.readFeaturesInternal), + 'featureMembers': makeReplacer(_this.readFeaturesInternal), + }; + _this.supportedMediaTypes = ['application/gml+xml']; + return _this; + } + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Array | undefined} Features. + */ + GMLBase.prototype.readFeaturesInternal = function (node, objectStack) { + var localName = node.localName; + var features = null; + if (localName == 'FeatureCollection') { + features = pushParseAndPop([], this.FEATURE_COLLECTION_PARSERS, node, objectStack, this); + } + else if (localName == 'featureMembers' || + localName == 'featureMember' || + localName == 'member') { + var context = objectStack[0]; + var featureType = context['featureType']; + var featureNS = context['featureNS']; + var prefix = 'p'; + var defaultPrefix = 'p0'; + if (!featureType && node.childNodes) { + (featureType = []), (featureNS = {}); + for (var i = 0, ii = node.childNodes.length; i < ii; ++i) { + var child = /** @type {Element} */ (node.childNodes[i]); + if (child.nodeType === 1) { + var ft = child.nodeName.split(':').pop(); + if (featureType.indexOf(ft) === -1) { + var key = ''; + var count = 0; + var uri = child.namespaceURI; + for (var candidate in featureNS) { + if (featureNS[candidate] === uri) { + key = candidate; + break; + } + ++count; + } + if (!key) { + key = prefix + count; + featureNS[key] = uri; + } + featureType.push(key + ':' + ft); + } + } + } + if (localName != 'featureMember') { + // recheck featureType for each featureMember + context['featureType'] = featureType; + context['featureNS'] = featureNS; + } + } + if (typeof featureNS === 'string') { + var ns = featureNS; + featureNS = {}; + featureNS[defaultPrefix] = ns; + } + /** @type {Object>} */ + var parsersNS = {}; + var featureTypes = Array.isArray(featureType) + ? featureType + : [featureType]; + for (var p in featureNS) { + /** @type {Object} */ + var parsers = {}; + for (var i = 0, ii = featureTypes.length; i < ii; ++i) { + var featurePrefix = featureTypes[i].indexOf(':') === -1 + ? defaultPrefix + : featureTypes[i].split(':')[0]; + if (featurePrefix === p) { + parsers[featureTypes[i].split(':').pop()] = + localName == 'featureMembers' + ? makeArrayPusher(this.readFeatureElement, this) + : makeReplacer(this.readFeatureElement, this); + } + } + parsersNS[featureNS[p]] = parsers; + } + if (localName == 'featureMember' || localName == 'member') { + features = pushParseAndPop(undefined, parsersNS, node, objectStack); + } + else { + features = pushParseAndPop([], parsersNS, node, objectStack); + } + } + if (features === null) { + features = []; + } + return features; + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {import("../geom/Geometry.js").default|import("../extent.js").Extent|undefined} Geometry. + */ + GMLBase.prototype.readGeometryOrExtent = function (node, objectStack) { + var context = /** @type {Object} */ (objectStack[0]); + context['srsName'] = node.firstElementChild.getAttribute('srsName'); + context['srsDimension'] = + node.firstElementChild.getAttribute('srsDimension'); + return pushParseAndPop(null, this.GEOMETRY_PARSERS, node, objectStack, this); + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {import("../extent.js").Extent|undefined} Geometry. + */ + GMLBase.prototype.readExtentElement = function (node, objectStack) { + var context = /** @type {Object} */ (objectStack[0]); + var extent = /** @type {import("../extent.js").Extent} */ (this.readGeometryOrExtent(node, objectStack)); + return extent ? Object(format_Feature["b" /* transformExtentWithOptions */])(extent, context) : undefined; + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {import("../geom/Geometry.js").default|undefined} Geometry. + */ + GMLBase.prototype.readGeometryElement = function (node, objectStack) { + var context = /** @type {Object} */ (objectStack[0]); + var geometry = /** @type {import("../geom/Geometry.js").default} */ (this.readGeometryOrExtent(node, objectStack)); + return geometry + ? Object(format_Feature["c" /* transformGeometryWithOptions */])(geometry, false, context) + : undefined; + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @param {boolean} asFeature whether result should be wrapped as a feature. + * @return {Feature|Object} Feature + */ + GMLBase.prototype.readFeatureElementInternal = function (node, objectStack, asFeature) { + var geometryName; + var values = {}; + for (var n = node.firstElementChild; n; n = n.nextElementSibling) { + var value = void 0; + var localName = n.localName; + // first, check if it is simple attribute + if (n.childNodes.length === 0 || + (n.childNodes.length === 1 && + (n.firstChild.nodeType === 3 || n.firstChild.nodeType === 4))) { + value = getAllTextContent(n, false); + if (ONLY_WHITESPACE_RE.test(value)) { + value = undefined; + } + } + else { + if (asFeature) { + //if feature, try it as a geometry or extent + value = + localName === 'boundedBy' + ? this.readExtentElement(n, objectStack) + : this.readGeometryElement(n, objectStack); + } + if (!value) { + //if not a geometry or not a feature, treat it as a complex attribute + value = this.readFeatureElementInternal(n, objectStack, false); + } + else if (localName !== 'boundedBy') { + // boundedBy is an extent and must not be considered as a geometry + geometryName = localName; + } + } + var len = n.attributes.length; + if (len > 0) { + value = { _content_: value }; + for (var i = 0; i < len; i++) { + var attName = n.attributes[i].name; + value[attName] = n.attributes[i].value; + } + } + if (values[localName]) { + if (!(values[localName] instanceof Array)) { + values[localName] = [values[localName]]; + } + values[localName].push(value); + } + else { + values[localName] = value; + } + } + if (!asFeature) { + return values; + } + else { + var feature = new Feature["a" /* default */](values); + if (geometryName) { + feature.setGeometryName(geometryName); + } + var fid = node.getAttribute('fid') || getAttributeNS(node, this.namespace, 'id'); + if (fid) { + feature.setId(fid); + } + return feature; + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Feature} Feature. + */ + GMLBase.prototype.readFeatureElement = function (node, objectStack) { + return this.readFeatureElementInternal(node, objectStack, true); + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Point|undefined} Point. + */ + GMLBase.prototype.readPoint = function (node, objectStack) { + var flatCoordinates = this.readFlatCoordinatesFromNode(node, objectStack); + if (flatCoordinates) { + return new Point["a" /* default */](flatCoordinates, GeometryLayout["a" /* default */].XYZ); + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {MultiPoint|undefined} MultiPoint. + */ + GMLBase.prototype.readMultiPoint = function (node, objectStack) { + /** @type {Array>} */ + var coordinates = pushParseAndPop([], this.MULTIPOINT_PARSERS, node, objectStack, this); + if (coordinates) { + return new MultiPoint["a" /* default */](coordinates); + } + else { + return undefined; + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {MultiLineString|undefined} MultiLineString. + */ + GMLBase.prototype.readMultiLineString = function (node, objectStack) { + /** @type {Array} */ + var lineStrings = pushParseAndPop([], this.MULTILINESTRING_PARSERS, node, objectStack, this); + if (lineStrings) { + return new MultiLineString["a" /* default */](lineStrings); + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {MultiPolygon|undefined} MultiPolygon. + */ + GMLBase.prototype.readMultiPolygon = function (node, objectStack) { + /** @type {Array} */ + var polygons = pushParseAndPop([], this.MULTIPOLYGON_PARSERS, node, objectStack, this); + if (polygons) { + return new MultiPolygon["a" /* default */](polygons); + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ + GMLBase.prototype.pointMemberParser = function (node, objectStack) { + parseNode(this.POINTMEMBER_PARSERS, node, objectStack, this); + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ + GMLBase.prototype.lineStringMemberParser = function (node, objectStack) { + parseNode(this.LINESTRINGMEMBER_PARSERS, node, objectStack, this); + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ + GMLBase.prototype.polygonMemberParser = function (node, objectStack) { + parseNode(this.POLYGONMEMBER_PARSERS, node, objectStack, this); + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {LineString|undefined} LineString. + */ + GMLBase.prototype.readLineString = function (node, objectStack) { + var flatCoordinates = this.readFlatCoordinatesFromNode(node, objectStack); + if (flatCoordinates) { + var lineString = new LineString["a" /* default */](flatCoordinates, GeometryLayout["a" /* default */].XYZ); + return lineString; + } + else { + return undefined; + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Array|undefined} LinearRing flat coordinates. + */ + GMLBase.prototype.readFlatLinearRing = function (node, objectStack) { + var ring = pushParseAndPop(null, this.GEOMETRY_FLAT_COORDINATES_PARSERS, node, objectStack, this); + if (ring) { + return ring; + } + else { + return undefined; + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {LinearRing|undefined} LinearRing. + */ + GMLBase.prototype.readLinearRing = function (node, objectStack) { + var flatCoordinates = this.readFlatCoordinatesFromNode(node, objectStack); + if (flatCoordinates) { + return new LinearRing["a" /* default */](flatCoordinates, GeometryLayout["a" /* default */].XYZ); + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Polygon|undefined} Polygon. + */ + GMLBase.prototype.readPolygon = function (node, objectStack) { + /** @type {Array>} */ + var flatLinearRings = pushParseAndPop([null], this.FLAT_LINEAR_RINGS_PARSERS, node, objectStack, this); + if (flatLinearRings && flatLinearRings[0]) { + var flatCoordinates = flatLinearRings[0]; + var ends = [flatCoordinates.length]; + var i = void 0, ii = void 0; + for (i = 1, ii = flatLinearRings.length; i < ii; ++i) { + Object(ol_array["c" /* extend */])(flatCoordinates, flatLinearRings[i]); + ends.push(flatCoordinates.length); + } + return new Polygon["a" /* default */](flatCoordinates, GeometryLayout["a" /* default */].XYZ, ends); + } + else { + return undefined; + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Array} Flat coordinates. + */ + GMLBase.prototype.readFlatCoordinatesFromNode = function (node, objectStack) { + return pushParseAndPop(null, this.GEOMETRY_FLAT_COORDINATES_PARSERS, node, objectStack, this); + }; + /** + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions} [opt_options] Options. + * @protected + * @return {import("../geom/Geometry.js").default} Geometry. + */ + GMLBase.prototype.readGeometryFromNode = function (node, opt_options) { + var geometry = this.readGeometryElement(node, [ + this.getReadOptions(node, opt_options ? opt_options : {}), + ]); + return geometry ? geometry : null; + }; + /** + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions} [opt_options] Options. + * @return {Array} Features. + */ + GMLBase.prototype.readFeaturesFromNode = function (node, opt_options) { + var options = { + featureType: this.featureType, + featureNS: this.featureNS, + }; + if (opt_options) { + Object(ol_obj["a" /* assign */])(options, this.getReadOptions(node, opt_options)); + } + var features = this.readFeaturesInternal(node, [options]); + return features || []; + }; + /** + * @param {Element} node Node. + * @return {import("../proj/Projection.js").default} Projection. + */ + GMLBase.prototype.readProjectionFromNode = function (node) { + return Object(ol_proj["h" /* get */])(this.srsName + ? this.srsName + : node.firstElementChild.getAttribute('srsName')); + }; + return GMLBase; +}(format_XMLFeature)); +GMLBase_GMLBase.prototype.namespace = GMLNS; +/** + * @const + * @type {Object>} + */ +GMLBase_GMLBase.prototype.FLAT_LINEAR_RINGS_PARSERS = { + 'http://www.opengis.net/gml': {}, +}; +/** + * @const + * @type {Object>} + */ +GMLBase_GMLBase.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = { + 'http://www.opengis.net/gml': {}, +}; +/** + * @const + * @type {Object>} + */ +GMLBase_GMLBase.prototype.GEOMETRY_PARSERS = { + 'http://www.opengis.net/gml': {}, +}; +/** + * @const + * @type {Object>} + */ +GMLBase_GMLBase.prototype.MULTIPOINT_PARSERS = { + 'http://www.opengis.net/gml': { + 'pointMember': makeArrayPusher(GMLBase_GMLBase.prototype.pointMemberParser), + 'pointMembers': makeArrayPusher(GMLBase_GMLBase.prototype.pointMemberParser), + }, +}; +/** + * @const + * @type {Object>} + */ +GMLBase_GMLBase.prototype.MULTILINESTRING_PARSERS = { + 'http://www.opengis.net/gml': { + 'lineStringMember': makeArrayPusher(GMLBase_GMLBase.prototype.lineStringMemberParser), + 'lineStringMembers': makeArrayPusher(GMLBase_GMLBase.prototype.lineStringMemberParser), + }, +}; +/** + * @const + * @type {Object>} + */ +GMLBase_GMLBase.prototype.MULTIPOLYGON_PARSERS = { + 'http://www.opengis.net/gml': { + 'polygonMember': makeArrayPusher(GMLBase_GMLBase.prototype.polygonMemberParser), + 'polygonMembers': makeArrayPusher(GMLBase_GMLBase.prototype.polygonMemberParser), + }, +}; +/** + * @const + * @type {Object>} + */ +GMLBase_GMLBase.prototype.POINTMEMBER_PARSERS = { + 'http://www.opengis.net/gml': { + 'Point': makeArrayPusher(GMLBase_GMLBase.prototype.readFlatCoordinatesFromNode), + }, +}; +/** + * @const + * @type {Object>} + */ +GMLBase_GMLBase.prototype.LINESTRINGMEMBER_PARSERS = { + 'http://www.opengis.net/gml': { + 'LineString': makeArrayPusher(GMLBase_GMLBase.prototype.readLineString), + }, +}; +/** + * @const + * @type {Object>} + */ +GMLBase_GMLBase.prototype.POLYGONMEMBER_PARSERS = { + 'http://www.opengis.net/gml': { + 'Polygon': makeArrayPusher(GMLBase_GMLBase.prototype.readPolygon), + }, +}; +/** + * @const + * @type {Object>} + */ +GMLBase_GMLBase.prototype.RING_PARSERS = { + 'http://www.opengis.net/gml': { + 'LinearRing': makeReplacer(GMLBase_GMLBase.prototype.readFlatLinearRing), + }, +}; +/* harmony default export */ var format_GMLBase = (GMLBase_GMLBase); +//# sourceMappingURL=GMLBase.js.map +// EXTERNAL MODULE: ./node_modules/ol/string.js +var ol_string = __webpack_require__("b0c1"); + +// CONCATENATED MODULE: ./node_modules/ol/format/xsd.js +/** + * @module ol/format/xsd + */ + + +/** + * @param {Node} node Node. + * @return {boolean|undefined} Boolean. + */ +function readBoolean(node) { + var s = getAllTextContent(node, false); + return readBooleanString(s); +} +/** + * @param {string} string String. + * @return {boolean|undefined} Boolean. + */ +function readBooleanString(string) { + var m = /^\s*(true|1)|(false|0)\s*$/.exec(string); + if (m) { + return m[1] !== undefined || false; + } + else { + return undefined; + } +} +/** + * @param {Node} node Node. + * @return {number|undefined} DateTime in seconds. + */ +function readDateTime(node) { + var s = getAllTextContent(node, false); + var dateTime = Date.parse(s); + return isNaN(dateTime) ? undefined : dateTime / 1000; +} +/** + * @param {Node} node Node. + * @return {number|undefined} Decimal. + */ +function readDecimal(node) { + var s = getAllTextContent(node, false); + return readDecimalString(s); +} +/** + * @param {string} string String. + * @return {number|undefined} Decimal. + */ +function readDecimalString(string) { + // FIXME check spec + var m = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(string); + if (m) { + return parseFloat(m[1]); + } + else { + return undefined; + } +} +/** + * @param {Node} node Node. + * @return {number|undefined} Non negative integer. + */ +function readPositiveInteger(node) { + var s = getAllTextContent(node, false); + return readNonNegativeIntegerString(s); +} +/** + * @param {string} string String. + * @return {number|undefined} Non negative integer. + */ +function readNonNegativeIntegerString(string) { + var m = /^\s*(\d+)\s*$/.exec(string); + if (m) { + return parseInt(m[1], 10); + } + else { + return undefined; + } +} +/** + * @param {Node} node Node. + * @return {string|undefined} String. + */ +function readString(node) { + return getAllTextContent(node, false).trim(); +} +/** + * @param {Node} node Node to append a TextNode with the boolean to. + * @param {boolean} bool Boolean. + */ +function writeBooleanTextNode(node, bool) { + writeStringTextNode(node, bool ? '1' : '0'); +} +/** + * @param {Node} node Node to append a CDATA Section with the string to. + * @param {string} string String. + */ +function writeCDATASection(node, string) { + node.appendChild(getDocument().createCDATASection(string)); +} +/** + * @param {Node} node Node to append a TextNode with the dateTime to. + * @param {number} dateTime DateTime in seconds. + */ +function writeDateTimeTextNode(node, dateTime) { + var date = new Date(dateTime * 1000); + var string = date.getUTCFullYear() + + '-' + + Object(ol_string["a" /* padNumber */])(date.getUTCMonth() + 1, 2) + + '-' + + Object(ol_string["a" /* padNumber */])(date.getUTCDate(), 2) + + 'T' + + Object(ol_string["a" /* padNumber */])(date.getUTCHours(), 2) + + ':' + + Object(ol_string["a" /* padNumber */])(date.getUTCMinutes(), 2) + + ':' + + Object(ol_string["a" /* padNumber */])(date.getUTCSeconds(), 2) + + 'Z'; + node.appendChild(getDocument().createTextNode(string)); +} +/** + * @param {Node} node Node to append a TextNode with the decimal to. + * @param {number} decimal Decimal. + */ +function writeDecimalTextNode(node, decimal) { + var string = decimal.toPrecision(); + node.appendChild(getDocument().createTextNode(string)); +} +/** + * @param {Node} node Node to append a TextNode with the decimal to. + * @param {number} nonNegativeInteger Non negative integer. + */ +function writeNonNegativeIntegerTextNode(node, nonNegativeInteger) { + var string = nonNegativeInteger.toString(); + node.appendChild(getDocument().createTextNode(string)); +} +/** + * @param {Node} node Node to append a TextNode with the string to. + * @param {string} string String. + */ +function writeStringTextNode(node, string) { + node.appendChild(getDocument().createTextNode(string)); +} +//# sourceMappingURL=xsd.js.map +// CONCATENATED MODULE: ./node_modules/ol/format/GML2.js +var GML2_extends = (undefined && undefined.__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/format/GML2 + */ + + + + + + + +/** + * @const + * @type {string} + */ +var schemaLocation = GMLNS + ' http://schemas.opengis.net/gml/2.1.2/feature.xsd'; +/** + * @const + * @type {Object} + */ +var MULTIGEOMETRY_TO_MEMBER_NODENAME = { + 'MultiLineString': 'lineStringMember', + 'MultiCurve': 'curveMember', + 'MultiPolygon': 'polygonMember', + 'MultiSurface': 'surfaceMember', +}; +/** + * @classdesc + * Feature format for reading and writing data in the GML format, + * version 2.1.2. + * + * @api + */ +var GML2_GML2 = /** @class */ (function (_super) { + GML2_extends(GML2, _super); + /** + * @param {import("./GMLBase.js").Options} [opt_options] Optional configuration object. + */ + function GML2(opt_options) { + var _this = this; + var options = + /** @type {import("./GMLBase.js").Options} */ + (opt_options ? opt_options : {}); + _this = _super.call(this, options) || this; + _this.FEATURE_COLLECTION_PARSERS[GMLNS]['featureMember'] = makeArrayPusher(_this.readFeaturesInternal); + /** + * @type {string} + */ + _this.schemaLocation = options.schemaLocation + ? options.schemaLocation + : schemaLocation; + return _this; + } + /** + * @param {Node} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Array|undefined} Flat coordinates. + */ + GML2.prototype.readFlatCoordinates = function (node, objectStack) { + var s = getAllTextContent(node, false).replace(/^\s*|\s*$/g, ''); + var context = /** @type {import("../xml.js").NodeStackItem} */ (objectStack[0]); + var containerSrs = context['srsName']; + var axisOrientation = 'enu'; + if (containerSrs) { + var proj = Object(ol_proj["h" /* get */])(containerSrs); + if (proj) { + axisOrientation = proj.getAxisOrientation(); + } + } + var coordsGroups = s.trim().split(/\s+/); + var flatCoordinates = []; + for (var i = 0, ii = coordsGroups.length; i < ii; i++) { + var coords = coordsGroups[i].split(/,+/); + var x = parseFloat(coords[0]); + var y = parseFloat(coords[1]); + var z = coords.length === 3 ? parseFloat(coords[2]) : 0; + if (axisOrientation.substr(0, 2) === 'en') { + flatCoordinates.push(x, y, z); + } + else { + flatCoordinates.push(y, x, z); + } + } + return flatCoordinates; + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {import("../extent.js").Extent|undefined} Envelope. + */ + GML2.prototype.readBox = function (node, objectStack) { + /** @type {Array} */ + var flatCoordinates = pushParseAndPop([null], this.BOX_PARSERS_, node, objectStack, this); + return Object(ol_extent["k" /* createOrUpdate */])(flatCoordinates[1][0], flatCoordinates[1][1], flatCoordinates[1][3], flatCoordinates[1][4]); + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ + GML2.prototype.innerBoundaryIsParser = function (node, objectStack) { + /** @type {Array|undefined} */ + var flatLinearRing = pushParseAndPop(undefined, this.RING_PARSERS, node, objectStack, this); + if (flatLinearRing) { + var flatLinearRings = + /** @type {Array>} */ + (objectStack[objectStack.length - 1]); + flatLinearRings.push(flatLinearRing); + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ + GML2.prototype.outerBoundaryIsParser = function (node, objectStack) { + /** @type {Array|undefined} */ + var flatLinearRing = pushParseAndPop(undefined, this.RING_PARSERS, node, objectStack, this); + if (flatLinearRing) { + var flatLinearRings = + /** @type {Array>} */ + (objectStack[objectStack.length - 1]); + flatLinearRings[0] = flatLinearRing; + } + }; + /** + * @const + * @param {*} value Value. + * @param {Array<*>} objectStack Object stack. + * @param {string} [opt_nodeName] Node name. + * @return {Element|undefined} Node. + * @private + */ + GML2.prototype.GEOMETRY_NODE_FACTORY_ = function (value, objectStack, opt_nodeName) { + var context = objectStack[objectStack.length - 1]; + var multiSurface = context['multiSurface']; + var surface = context['surface']; + var multiCurve = context['multiCurve']; + var nodeName; + if (!Array.isArray(value)) { + nodeName = /** @type {import("../geom/Geometry.js").default} */ (value).getType(); + if (nodeName === 'MultiPolygon' && multiSurface === true) { + nodeName = 'MultiSurface'; + } + else if (nodeName === 'Polygon' && surface === true) { + nodeName = 'Surface'; + } + else if (nodeName === 'MultiLineString' && multiCurve === true) { + nodeName = 'MultiCurve'; + } + } + else { + nodeName = 'Envelope'; + } + return createElementNS('http://www.opengis.net/gml', nodeName); + }; + /** + * @param {Element} node Node. + * @param {import("../Feature.js").default} feature Feature. + * @param {Array<*>} objectStack Node stack. + */ + GML2.prototype.writeFeatureElement = function (node, feature, objectStack) { + var fid = feature.getId(); + if (fid) { + node.setAttribute('fid', /** @type {string} */ (fid)); + } + var context = /** @type {Object} */ (objectStack[objectStack.length - 1]); + var featureNS = context['featureNS']; + var geometryName = feature.getGeometryName(); + if (!context.serializers) { + context.serializers = {}; + context.serializers[featureNS] = {}; + } + var keys = []; + var values = []; + if (feature.hasProperties()) { + var properties = feature.getProperties(); + for (var key in properties) { + var value = properties[key]; + if (value !== null) { + keys.push(key); + values.push(value); + if (key == geometryName || + typeof ( /** @type {?} */(value).getSimplifiedGeometry) === + 'function') { + if (!(key in context.serializers[featureNS])) { + context.serializers[featureNS][key] = makeChildAppender(this.writeGeometryElement, this); + } + } + else { + if (!(key in context.serializers[featureNS])) { + context.serializers[featureNS][key] = + makeChildAppender(writeStringTextNode); + } + } + } + } + } + var item = Object(ol_obj["a" /* assign */])({}, context); + item.node = node; + pushSerializeAndPop( + /** @type {import("../xml.js").NodeStackItem} */ + (item), context.serializers, makeSimpleNodeFactory(undefined, featureNS), values, objectStack, keys); + }; + /** + * @param {Element} node Node. + * @param {import("../geom/LineString.js").default} geometry LineString geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML2.prototype.writeCurveOrLineString = function (node, geometry, objectStack) { + var context = objectStack[objectStack.length - 1]; + var srsName = context['srsName']; + if (node.nodeName !== 'LineStringSegment' && srsName) { + node.setAttribute('srsName', srsName); + } + if (node.nodeName === 'LineString' || + node.nodeName === 'LineStringSegment') { + var coordinates = this.createCoordinatesNode_(node.namespaceURI); + node.appendChild(coordinates); + this.writeCoordinates_(coordinates, geometry, objectStack); + } + else if (node.nodeName === 'Curve') { + var segments = createElementNS(node.namespaceURI, 'segments'); + node.appendChild(segments); + this.writeCurveSegments_(segments, geometry, objectStack); + } + }; + /** + * @param {Element} node Node. + * @param {import("../geom/LineString.js").default} line LineString geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML2.prototype.writeLineStringOrCurveMember = function (node, line, objectStack) { + var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack); + if (child) { + node.appendChild(child); + this.writeCurveOrLineString(child, line, objectStack); + } + }; + /** + * @param {Element} node Node. + * @param {import("../geom/MultiLineString.js").default} geometry MultiLineString geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML2.prototype.writeMultiCurveOrLineString = function (node, geometry, objectStack) { + var context = objectStack[objectStack.length - 1]; + var hasZ = context['hasZ']; + var srsName = context['srsName']; + var curve = context['curve']; + if (srsName) { + node.setAttribute('srsName', srsName); + } + var lines = geometry.getLineStrings(); + pushSerializeAndPop({ node: node, hasZ: hasZ, srsName: srsName, curve: curve }, this.LINESTRINGORCURVEMEMBER_SERIALIZERS, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines, objectStack, undefined, this); + }; + /** + * @param {Node} node Node. + * @param {import("../geom/Geometry.js").default|import("../extent.js").Extent} geometry Geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML2.prototype.writeGeometryElement = function (node, geometry, objectStack) { + var context = /** @type {import("./Feature.js").WriteOptions} */ (objectStack[objectStack.length - 1]); + var item = Object(ol_obj["a" /* assign */])({}, context); + item['node'] = node; + var value; + if (Array.isArray(geometry)) { + value = Object(format_Feature["b" /* transformExtentWithOptions */])( + /** @type {import("../extent.js").Extent} */ (geometry), context); + } + else { + value = Object(format_Feature["c" /* transformGeometryWithOptions */])( + /** @type {import("../geom/Geometry.js").default} */ (geometry), true, context); + } + pushSerializeAndPop( + /** @type {import("../xml.js").NodeStackItem} */ + (item), this.GEOMETRY_SERIALIZERS, this.GEOMETRY_NODE_FACTORY_, [value], objectStack, undefined, this); + }; + /** + * @param {string} namespaceURI XML namespace. + * @return {Element} coordinates node. + * @private + */ + GML2.prototype.createCoordinatesNode_ = function (namespaceURI) { + var coordinates = createElementNS(namespaceURI, 'coordinates'); + coordinates.setAttribute('decimal', '.'); + coordinates.setAttribute('cs', ','); + coordinates.setAttribute('ts', ' '); + return coordinates; + }; + /** + * @param {Node} node Node. + * @param {import("../geom/LineString.js").default|import("../geom/LinearRing.js").default} value Geometry. + * @param {Array<*>} objectStack Node stack. + * @private + */ + GML2.prototype.writeCoordinates_ = function (node, value, objectStack) { + var context = objectStack[objectStack.length - 1]; + var hasZ = context['hasZ']; + var srsName = context['srsName']; + // only 2d for simple features profile + var points = value.getCoordinates(); + var len = points.length; + var parts = new Array(len); + for (var i = 0; i < len; ++i) { + var point = points[i]; + parts[i] = this.getCoords_(point, srsName, hasZ); + } + writeStringTextNode(node, parts.join(' ')); + }; + /** + * @param {Element} node Node. + * @param {import("../geom/LineString.js").default} line LineString geometry. + * @param {Array<*>} objectStack Node stack. + * @private + */ + GML2.prototype.writeCurveSegments_ = function (node, line, objectStack) { + var child = createElementNS(node.namespaceURI, 'LineStringSegment'); + node.appendChild(child); + this.writeCurveOrLineString(child, line, objectStack); + }; + /** + * @param {Element} node Node. + * @param {import("../geom/Polygon.js").default} geometry Polygon geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML2.prototype.writeSurfaceOrPolygon = function (node, geometry, objectStack) { + var context = objectStack[objectStack.length - 1]; + var hasZ = context['hasZ']; + var srsName = context['srsName']; + if (node.nodeName !== 'PolygonPatch' && srsName) { + node.setAttribute('srsName', srsName); + } + if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') { + var rings = geometry.getLinearRings(); + pushSerializeAndPop({ node: node, hasZ: hasZ, srsName: srsName }, this.RING_SERIALIZERS, this.RING_NODE_FACTORY_, rings, objectStack, undefined, this); + } + else if (node.nodeName === 'Surface') { + var patches = createElementNS(node.namespaceURI, 'patches'); + node.appendChild(patches); + this.writeSurfacePatches_(patches, geometry, objectStack); + } + }; + /** + * @param {*} value Value. + * @param {Array<*>} objectStack Object stack. + * @param {string} [opt_nodeName] Node name. + * @return {Node} Node. + * @private + */ + GML2.prototype.RING_NODE_FACTORY_ = function (value, objectStack, opt_nodeName) { + var context = objectStack[objectStack.length - 1]; + var parentNode = context.node; + var exteriorWritten = context['exteriorWritten']; + if (exteriorWritten === undefined) { + context['exteriorWritten'] = true; + } + return createElementNS(parentNode.namespaceURI, exteriorWritten !== undefined ? 'innerBoundaryIs' : 'outerBoundaryIs'); + }; + /** + * @param {Element} node Node. + * @param {import("../geom/Polygon.js").default} polygon Polygon geometry. + * @param {Array<*>} objectStack Node stack. + * @private + */ + GML2.prototype.writeSurfacePatches_ = function (node, polygon, objectStack) { + var child = createElementNS(node.namespaceURI, 'PolygonPatch'); + node.appendChild(child); + this.writeSurfaceOrPolygon(child, polygon, objectStack); + }; + /** + * @param {Element} node Node. + * @param {import("../geom/LinearRing.js").default} ring LinearRing geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML2.prototype.writeRing = function (node, ring, objectStack) { + var linearRing = createElementNS(node.namespaceURI, 'LinearRing'); + node.appendChild(linearRing); + this.writeLinearRing(linearRing, ring, objectStack); + }; + /** + * @param {Array} point Point geometry. + * @param {string} [opt_srsName] Optional srsName + * @param {boolean} [opt_hasZ] whether the geometry has a Z coordinate (is 3D) or not. + * @return {string} The coords string. + * @private + */ + GML2.prototype.getCoords_ = function (point, opt_srsName, opt_hasZ) { + var axisOrientation = 'enu'; + if (opt_srsName) { + axisOrientation = Object(ol_proj["h" /* get */])(opt_srsName).getAxisOrientation(); + } + var coords = axisOrientation.substr(0, 2) === 'en' + ? point[0] + ',' + point[1] + : point[1] + ',' + point[0]; + if (opt_hasZ) { + // For newly created points, Z can be undefined. + var z = point[2] || 0; + coords += ',' + z; + } + return coords; + }; + /** + * @param {Element} node Node. + * @param {import("../geom/Point.js").default} geometry Point geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML2.prototype.writePoint = function (node, geometry, objectStack) { + var context = objectStack[objectStack.length - 1]; + var hasZ = context['hasZ']; + var srsName = context['srsName']; + if (srsName) { + node.setAttribute('srsName', srsName); + } + var coordinates = this.createCoordinatesNode_(node.namespaceURI); + node.appendChild(coordinates); + var point = geometry.getCoordinates(); + var coord = this.getCoords_(point, srsName, hasZ); + writeStringTextNode(coordinates, coord); + }; + /** + * @param {Element} node Node. + * @param {import("../geom/MultiPoint.js").default} geometry MultiPoint geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML2.prototype.writeMultiPoint = function (node, geometry, objectStack) { + var context = objectStack[objectStack.length - 1]; + var hasZ = context['hasZ']; + var srsName = context['srsName']; + if (srsName) { + node.setAttribute('srsName', srsName); + } + var points = geometry.getPoints(); + pushSerializeAndPop({ node: node, hasZ: hasZ, srsName: srsName }, this.POINTMEMBER_SERIALIZERS, makeSimpleNodeFactory('pointMember'), points, objectStack, undefined, this); + }; + /** + * @param {Element} node Node. + * @param {import("../geom/Point.js").default} point Point geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML2.prototype.writePointMember = function (node, point, objectStack) { + var child = createElementNS(node.namespaceURI, 'Point'); + node.appendChild(child); + this.writePoint(child, point, objectStack); + }; + /** + * @param {Element} node Node. + * @param {import("../geom/LinearRing.js").default} geometry LinearRing geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML2.prototype.writeLinearRing = function (node, geometry, objectStack) { + var context = objectStack[objectStack.length - 1]; + var srsName = context['srsName']; + if (srsName) { + node.setAttribute('srsName', srsName); + } + var coordinates = this.createCoordinatesNode_(node.namespaceURI); + node.appendChild(coordinates); + this.writeCoordinates_(coordinates, geometry, objectStack); + }; + /** + * @param {Element} node Node. + * @param {import("../geom/MultiPolygon.js").default} geometry MultiPolygon geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML2.prototype.writeMultiSurfaceOrPolygon = function (node, geometry, objectStack) { + var context = objectStack[objectStack.length - 1]; + var hasZ = context['hasZ']; + var srsName = context['srsName']; + var surface = context['surface']; + if (srsName) { + node.setAttribute('srsName', srsName); + } + var polygons = geometry.getPolygons(); + pushSerializeAndPop({ node: node, hasZ: hasZ, srsName: srsName, surface: surface }, this.SURFACEORPOLYGONMEMBER_SERIALIZERS, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons, objectStack, undefined, this); + }; + /** + * @param {Node} node Node. + * @param {import("../geom/Polygon.js").default} polygon Polygon geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML2.prototype.writeSurfaceOrPolygonMember = function (node, polygon, objectStack) { + var child = this.GEOMETRY_NODE_FACTORY_(polygon, objectStack); + if (child) { + node.appendChild(child); + this.writeSurfaceOrPolygon(child, polygon, objectStack); + } + }; + /** + * @param {Element} node Node. + * @param {import("../extent.js").Extent} extent Extent. + * @param {Array<*>} objectStack Node stack. + */ + GML2.prototype.writeEnvelope = function (node, extent, objectStack) { + var context = objectStack[objectStack.length - 1]; + var srsName = context['srsName']; + if (srsName) { + node.setAttribute('srsName', srsName); + } + var keys = ['lowerCorner', 'upperCorner']; + var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]]; + pushSerializeAndPop( + /** @type {import("../xml.js").NodeStackItem} */ + ({ node: node }), this.ENVELOPE_SERIALIZERS, OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, keys, this); + }; + /** + * @const + * @param {*} value Value. + * @param {Array<*>} objectStack Object stack. + * @param {string} [opt_nodeName] Node name. + * @return {Node|undefined} Node. + * @private + */ + GML2.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function (value, objectStack, opt_nodeName) { + var parentNode = objectStack[objectStack.length - 1].node; + return createElementNS('http://www.opengis.net/gml', MULTIGEOMETRY_TO_MEMBER_NODENAME[parentNode.nodeName]); + }; + return GML2; +}(format_GMLBase)); +/** + * @const + * @type {Object>} + */ +GML2_GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = { + 'http://www.opengis.net/gml': { + 'coordinates': makeReplacer(GML2_GML2.prototype.readFlatCoordinates), + }, +}; +/** + * @const + * @type {Object>} + */ +GML2_GML2.prototype.FLAT_LINEAR_RINGS_PARSERS = { + 'http://www.opengis.net/gml': { + 'innerBoundaryIs': GML2_GML2.prototype.innerBoundaryIsParser, + 'outerBoundaryIs': GML2_GML2.prototype.outerBoundaryIsParser, + }, +}; +/** + * @const + * @type {Object>} + */ +GML2_GML2.prototype.BOX_PARSERS_ = { + 'http://www.opengis.net/gml': { + 'coordinates': makeArrayPusher(GML2_GML2.prototype.readFlatCoordinates), + }, +}; +/** + * @const + * @type {Object>} + */ +GML2_GML2.prototype.GEOMETRY_PARSERS = { + 'http://www.opengis.net/gml': { + 'Point': makeReplacer(format_GMLBase.prototype.readPoint), + 'MultiPoint': makeReplacer(format_GMLBase.prototype.readMultiPoint), + 'LineString': makeReplacer(format_GMLBase.prototype.readLineString), + 'MultiLineString': makeReplacer(format_GMLBase.prototype.readMultiLineString), + 'LinearRing': makeReplacer(format_GMLBase.prototype.readLinearRing), + 'Polygon': makeReplacer(format_GMLBase.prototype.readPolygon), + 'MultiPolygon': makeReplacer(format_GMLBase.prototype.readMultiPolygon), + 'Box': makeReplacer(GML2_GML2.prototype.readBox), + }, +}; +/** + * @const + * @type {Object>} + */ +GML2_GML2.prototype.GEOMETRY_SERIALIZERS = { + 'http://www.opengis.net/gml': { + 'Curve': makeChildAppender(GML2_GML2.prototype.writeCurveOrLineString), + 'MultiCurve': makeChildAppender(GML2_GML2.prototype.writeMultiCurveOrLineString), + 'Point': makeChildAppender(GML2_GML2.prototype.writePoint), + 'MultiPoint': makeChildAppender(GML2_GML2.prototype.writeMultiPoint), + 'LineString': makeChildAppender(GML2_GML2.prototype.writeCurveOrLineString), + 'MultiLineString': makeChildAppender(GML2_GML2.prototype.writeMultiCurveOrLineString), + 'LinearRing': makeChildAppender(GML2_GML2.prototype.writeLinearRing), + 'Polygon': makeChildAppender(GML2_GML2.prototype.writeSurfaceOrPolygon), + 'MultiPolygon': makeChildAppender(GML2_GML2.prototype.writeMultiSurfaceOrPolygon), + 'Surface': makeChildAppender(GML2_GML2.prototype.writeSurfaceOrPolygon), + 'MultiSurface': makeChildAppender(GML2_GML2.prototype.writeMultiSurfaceOrPolygon), + 'Envelope': makeChildAppender(GML2_GML2.prototype.writeEnvelope), + }, +}; +/** + * @type {Object>} + */ +GML2_GML2.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS = { + 'http://www.opengis.net/gml': { + 'lineStringMember': makeChildAppender(GML2_GML2.prototype.writeLineStringOrCurveMember), + 'curveMember': makeChildAppender(GML2_GML2.prototype.writeLineStringOrCurveMember), + }, +}; +/** + * @type {Object>} + */ +GML2_GML2.prototype.RING_SERIALIZERS = { + 'http://www.opengis.net/gml': { + 'outerBoundaryIs': makeChildAppender(GML2_GML2.prototype.writeRing), + 'innerBoundaryIs': makeChildAppender(GML2_GML2.prototype.writeRing), + }, +}; +/** + * @type {Object>} + */ +GML2_GML2.prototype.POINTMEMBER_SERIALIZERS = { + 'http://www.opengis.net/gml': { + 'pointMember': makeChildAppender(GML2_GML2.prototype.writePointMember), + }, +}; +/** + * @const + * @type {Object>} + */ +GML2_GML2.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS = { + 'http://www.opengis.net/gml': { + 'surfaceMember': makeChildAppender(GML2_GML2.prototype.writeSurfaceOrPolygonMember), + 'polygonMember': makeChildAppender(GML2_GML2.prototype.writeSurfaceOrPolygonMember), + }, +}; +/** + * @type {Object>} + */ +GML2_GML2.prototype.ENVELOPE_SERIALIZERS = { + 'http://www.opengis.net/gml': { + 'lowerCorner': makeChildAppender(writeStringTextNode), + 'upperCorner': makeChildAppender(writeStringTextNode), + }, +}; +/* harmony default export */ var format_GML2 = (GML2_GML2); +//# sourceMappingURL=GML2.js.map +// CONCATENATED MODULE: ./node_modules/ol/format/GML3.js +var GML3_extends = (undefined && undefined.__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/format/GML3 + */ + + + + + + + + + + + + + + +/** + * @const + * @type {string} + * @private + */ +var GML3_schemaLocation = GMLNS + + ' http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/' + + '1.0.0/gmlsf.xsd'; +/** + * @const + * @type {Object} + */ +var GML3_MULTIGEOMETRY_TO_MEMBER_NODENAME = { + 'MultiLineString': 'lineStringMember', + 'MultiCurve': 'curveMember', + 'MultiPolygon': 'polygonMember', + 'MultiSurface': 'surfaceMember', +}; +/** + * @classdesc + * Feature format for reading and writing data in the GML format + * version 3.1.1. + * Currently only supports GML 3.1.1 Simple Features profile. + * + * @api + */ +var GML3_GML3 = /** @class */ (function (_super) { + GML3_extends(GML3, _super); + /** + * @param {import("./GMLBase.js").Options} [opt_options] Optional configuration object. + */ + function GML3(opt_options) { + var _this = this; + var options = + /** @type {import("./GMLBase.js").Options} */ + (opt_options ? opt_options : {}); + _this = _super.call(this, options) || this; + /** + * @private + * @type {boolean} + */ + _this.surface_ = options.surface !== undefined ? options.surface : false; + /** + * @private + * @type {boolean} + */ + _this.curve_ = options.curve !== undefined ? options.curve : false; + /** + * @private + * @type {boolean} + */ + _this.multiCurve_ = + options.multiCurve !== undefined ? options.multiCurve : true; + /** + * @private + * @type {boolean} + */ + _this.multiSurface_ = + options.multiSurface !== undefined ? options.multiSurface : true; + /** + * @type {string} + */ + _this.schemaLocation = options.schemaLocation + ? options.schemaLocation + : GML3_schemaLocation; + /** + * @private + * @type {boolean} + */ + _this.hasZ = options.hasZ !== undefined ? options.hasZ : false; + return _this; + } + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {MultiLineString|undefined} MultiLineString. + */ + GML3.prototype.readMultiCurve = function (node, objectStack) { + /** @type {Array} */ + var lineStrings = pushParseAndPop([], this.MULTICURVE_PARSERS, node, objectStack, this); + if (lineStrings) { + var multiLineString = new MultiLineString["a" /* default */](lineStrings); + return multiLineString; + } + else { + return undefined; + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Array|undefined} Polygon. + */ + GML3.prototype.readFlatCurveRing = function (node, objectStack) { + /** @type {Array} */ + var lineStrings = pushParseAndPop([], this.MULTICURVE_PARSERS, node, objectStack, this); + var flatCoordinates = []; + for (var i = 0, ii = lineStrings.length; i < ii; ++i) { + Object(ol_array["c" /* extend */])(flatCoordinates, lineStrings[i].getFlatCoordinates()); + } + return flatCoordinates; + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {MultiPolygon|undefined} MultiPolygon. + */ + GML3.prototype.readMultiSurface = function (node, objectStack) { + /** @type {Array} */ + var polygons = pushParseAndPop([], this.MULTISURFACE_PARSERS, node, objectStack, this); + if (polygons) { + return new MultiPolygon["a" /* default */](polygons); + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ + GML3.prototype.curveMemberParser = function (node, objectStack) { + parseNode(this.CURVEMEMBER_PARSERS, node, objectStack, this); + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ + GML3.prototype.surfaceMemberParser = function (node, objectStack) { + parseNode(this.SURFACEMEMBER_PARSERS, node, objectStack, this); + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Array<(Array)>|undefined} flat coordinates. + */ + GML3.prototype.readPatch = function (node, objectStack) { + return pushParseAndPop([null], this.PATCHES_PARSERS, node, objectStack, this); + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Array|undefined} flat coordinates. + */ + GML3.prototype.readSegment = function (node, objectStack) { + return pushParseAndPop([], this.SEGMENTS_PARSERS, node, objectStack, this); + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Array<(Array)>|undefined} flat coordinates. + */ + GML3.prototype.readPolygonPatch = function (node, objectStack) { + return pushParseAndPop([null], this.FLAT_LINEAR_RINGS_PARSERS, node, objectStack, this); + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Array|undefined} flat coordinates. + */ + GML3.prototype.readLineStringSegment = function (node, objectStack) { + return pushParseAndPop([null], this.GEOMETRY_FLAT_COORDINATES_PARSERS, node, objectStack, this); + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ + GML3.prototype.interiorParser = function (node, objectStack) { + /** @type {Array|undefined} */ + var flatLinearRing = pushParseAndPop(undefined, this.RING_PARSERS, node, objectStack, this); + if (flatLinearRing) { + var flatLinearRings = + /** @type {Array>} */ + (objectStack[objectStack.length - 1]); + flatLinearRings.push(flatLinearRing); + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ + GML3.prototype.exteriorParser = function (node, objectStack) { + /** @type {Array|undefined} */ + var flatLinearRing = pushParseAndPop(undefined, this.RING_PARSERS, node, objectStack, this); + if (flatLinearRing) { + var flatLinearRings = + /** @type {Array>} */ + (objectStack[objectStack.length - 1]); + flatLinearRings[0] = flatLinearRing; + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Polygon|undefined} Polygon. + */ + GML3.prototype.readSurface = function (node, objectStack) { + /** @type {Array>} */ + var flatLinearRings = pushParseAndPop([null], this.SURFACE_PARSERS, node, objectStack, this); + if (flatLinearRings && flatLinearRings[0]) { + var flatCoordinates = flatLinearRings[0]; + var ends = [flatCoordinates.length]; + var i = void 0, ii = void 0; + for (i = 1, ii = flatLinearRings.length; i < ii; ++i) { + Object(ol_array["c" /* extend */])(flatCoordinates, flatLinearRings[i]); + ends.push(flatCoordinates.length); + } + return new Polygon["a" /* default */](flatCoordinates, GeometryLayout["a" /* default */].XYZ, ends); + } + else { + return undefined; + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {LineString|undefined} LineString. + */ + GML3.prototype.readCurve = function (node, objectStack) { + /** @type {Array} */ + var flatCoordinates = pushParseAndPop([null], this.CURVE_PARSERS, node, objectStack, this); + if (flatCoordinates) { + var lineString = new LineString["a" /* default */](flatCoordinates, GeometryLayout["a" /* default */].XYZ); + return lineString; + } + else { + return undefined; + } + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {import("../extent.js").Extent|undefined} Envelope. + */ + GML3.prototype.readEnvelope = function (node, objectStack) { + /** @type {Array} */ + var flatCoordinates = pushParseAndPop([null], this.ENVELOPE_PARSERS, node, objectStack, this); + return Object(ol_extent["k" /* createOrUpdate */])(flatCoordinates[1][0], flatCoordinates[1][1], flatCoordinates[2][0], flatCoordinates[2][1]); + }; + /** + * @param {Node} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Array|undefined} Flat coordinates. + */ + GML3.prototype.readFlatPos = function (node, objectStack) { + var s = getAllTextContent(node, false); + var re = /^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/; + /** @type {Array} */ + var flatCoordinates = []; + var m; + while ((m = re.exec(s))) { + flatCoordinates.push(parseFloat(m[1])); + s = s.substr(m[0].length); + } + if (s !== '') { + return undefined; + } + var context = objectStack[0]; + var containerSrs = context['srsName']; + var axisOrientation = 'enu'; + if (containerSrs) { + var proj = Object(ol_proj["h" /* get */])(containerSrs); + axisOrientation = proj.getAxisOrientation(); + } + if (axisOrientation === 'neu') { + var i = void 0, ii = void 0; + for (i = 0, ii = flatCoordinates.length; i < ii; i += 3) { + var y = flatCoordinates[i]; + var x = flatCoordinates[i + 1]; + flatCoordinates[i] = x; + flatCoordinates[i + 1] = y; + } + } + var len = flatCoordinates.length; + if (len == 2) { + flatCoordinates.push(0); + } + if (len === 0) { + return undefined; + } + return flatCoordinates; + }; + /** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Array|undefined} Flat coordinates. + */ + GML3.prototype.readFlatPosList = function (node, objectStack) { + var s = getAllTextContent(node, false).replace(/^\s*|\s*$/g, ''); + var context = objectStack[0]; + var containerSrs = context['srsName']; + var contextDimension = context['srsDimension']; + var axisOrientation = 'enu'; + if (containerSrs) { + var proj = Object(ol_proj["h" /* get */])(containerSrs); + axisOrientation = proj.getAxisOrientation(); + } + var coords = s.split(/\s+/); + // The "dimension" attribute is from the GML 3.0.1 spec. + var dim = 2; + if (node.getAttribute('srsDimension')) { + dim = readNonNegativeIntegerString(node.getAttribute('srsDimension')); + } + else if (node.getAttribute('dimension')) { + dim = readNonNegativeIntegerString(node.getAttribute('dimension')); + } + else if ( + /** @type {Element} */ (node.parentNode).getAttribute('srsDimension')) { + dim = readNonNegativeIntegerString( + /** @type {Element} */ (node.parentNode).getAttribute('srsDimension')); + } + else if (contextDimension) { + dim = readNonNegativeIntegerString(contextDimension); + } + var x, y, z; + var flatCoordinates = []; + for (var i = 0, ii = coords.length; i < ii; i += dim) { + x = parseFloat(coords[i]); + y = parseFloat(coords[i + 1]); + z = dim === 3 ? parseFloat(coords[i + 2]) : 0; + if (axisOrientation.substr(0, 2) === 'en') { + flatCoordinates.push(x, y, z); + } + else { + flatCoordinates.push(y, x, z); + } + } + return flatCoordinates; + }; + /** + * @param {Element} node Node. + * @param {import("../geom/Point.js").default} value Point geometry. + * @param {Array<*>} objectStack Node stack. + * @private + */ + GML3.prototype.writePos_ = function (node, value, objectStack) { + var context = objectStack[objectStack.length - 1]; + var hasZ = context['hasZ']; + var srsDimension = hasZ ? '3' : '2'; + node.setAttribute('srsDimension', srsDimension); + var srsName = context['srsName']; + var axisOrientation = 'enu'; + if (srsName) { + axisOrientation = Object(ol_proj["h" /* get */])(srsName).getAxisOrientation(); + } + var point = value.getCoordinates(); + var coords; + // only 2d for simple features profile + if (axisOrientation.substr(0, 2) === 'en') { + coords = point[0] + ' ' + point[1]; + } + else { + coords = point[1] + ' ' + point[0]; + } + if (hasZ) { + // For newly created points, Z can be undefined. + var z = point[2] || 0; + coords += ' ' + z; + } + writeStringTextNode(node, coords); + }; + /** + * @param {Array} point Point geometry. + * @param {string} [opt_srsName] Optional srsName + * @param {boolean} [opt_hasZ] whether the geometry has a Z coordinate (is 3D) or not. + * @return {string} The coords string. + * @private + */ + GML3.prototype.getCoords_ = function (point, opt_srsName, opt_hasZ) { + var axisOrientation = 'enu'; + if (opt_srsName) { + axisOrientation = Object(ol_proj["h" /* get */])(opt_srsName).getAxisOrientation(); + } + var coords = axisOrientation.substr(0, 2) === 'en' + ? point[0] + ' ' + point[1] + : point[1] + ' ' + point[0]; + if (opt_hasZ) { + // For newly created points, Z can be undefined. + var z = point[2] || 0; + coords += ' ' + z; + } + return coords; + }; + /** + * @param {Element} node Node. + * @param {LineString|import("../geom/LinearRing.js").default} value Geometry. + * @param {Array<*>} objectStack Node stack. + * @private + */ + GML3.prototype.writePosList_ = function (node, value, objectStack) { + var context = objectStack[objectStack.length - 1]; + var hasZ = context['hasZ']; + var srsDimension = hasZ ? '3' : '2'; + node.setAttribute('srsDimension', srsDimension); + var srsName = context['srsName']; + // only 2d for simple features profile + var points = value.getCoordinates(); + var len = points.length; + var parts = new Array(len); + var point; + for (var i = 0; i < len; ++i) { + point = points[i]; + parts[i] = this.getCoords_(point, srsName, hasZ); + } + writeStringTextNode(node, parts.join(' ')); + }; + /** + * @param {Element} node Node. + * @param {import("../geom/Point.js").default} geometry Point geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML3.prototype.writePoint = function (node, geometry, objectStack) { + var context = objectStack[objectStack.length - 1]; + var srsName = context['srsName']; + if (srsName) { + node.setAttribute('srsName', srsName); + } + var pos = createElementNS(node.namespaceURI, 'pos'); + node.appendChild(pos); + this.writePos_(pos, geometry, objectStack); + }; + /** + * @param {Element} node Node. + * @param {import("../extent.js").Extent} extent Extent. + * @param {Array<*>} objectStack Node stack. + */ + GML3.prototype.writeEnvelope = function (node, extent, objectStack) { + var context = objectStack[objectStack.length - 1]; + var srsName = context['srsName']; + if (srsName) { + node.setAttribute('srsName', srsName); + } + var keys = ['lowerCorner', 'upperCorner']; + var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]]; + pushSerializeAndPop( + /** @type {import("../xml.js").NodeStackItem} */ + ({ node: node }), this.ENVELOPE_SERIALIZERS, OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, keys, this); + }; + /** + * @param {Element} node Node. + * @param {import("../geom/LinearRing.js").default} geometry LinearRing geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML3.prototype.writeLinearRing = function (node, geometry, objectStack) { + var context = objectStack[objectStack.length - 1]; + var srsName = context['srsName']; + if (srsName) { + node.setAttribute('srsName', srsName); + } + var posList = createElementNS(node.namespaceURI, 'posList'); + node.appendChild(posList); + this.writePosList_(posList, geometry, objectStack); + }; + /** + * @param {*} value Value. + * @param {Array<*>} objectStack Object stack. + * @param {string} [opt_nodeName] Node name. + * @return {Node} Node. + * @private + */ + GML3.prototype.RING_NODE_FACTORY_ = function (value, objectStack, opt_nodeName) { + var context = objectStack[objectStack.length - 1]; + var parentNode = context.node; + var exteriorWritten = context['exteriorWritten']; + if (exteriorWritten === undefined) { + context['exteriorWritten'] = true; + } + return createElementNS(parentNode.namespaceURI, exteriorWritten !== undefined ? 'interior' : 'exterior'); + }; + /** + * @param {Element} node Node. + * @param {Polygon} geometry Polygon geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML3.prototype.writeSurfaceOrPolygon = function (node, geometry, objectStack) { + var context = objectStack[objectStack.length - 1]; + var hasZ = context['hasZ']; + var srsName = context['srsName']; + if (node.nodeName !== 'PolygonPatch' && srsName) { + node.setAttribute('srsName', srsName); + } + if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') { + var rings = geometry.getLinearRings(); + pushSerializeAndPop({ node: node, hasZ: hasZ, srsName: srsName }, this.RING_SERIALIZERS, this.RING_NODE_FACTORY_, rings, objectStack, undefined, this); + } + else if (node.nodeName === 'Surface') { + var patches = createElementNS(node.namespaceURI, 'patches'); + node.appendChild(patches); + this.writeSurfacePatches_(patches, geometry, objectStack); + } + }; + /** + * @param {Element} node Node. + * @param {LineString} geometry LineString geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML3.prototype.writeCurveOrLineString = function (node, geometry, objectStack) { + var context = objectStack[objectStack.length - 1]; + var srsName = context['srsName']; + if (node.nodeName !== 'LineStringSegment' && srsName) { + node.setAttribute('srsName', srsName); + } + if (node.nodeName === 'LineString' || + node.nodeName === 'LineStringSegment') { + var posList = createElementNS(node.namespaceURI, 'posList'); + node.appendChild(posList); + this.writePosList_(posList, geometry, objectStack); + } + else if (node.nodeName === 'Curve') { + var segments = createElementNS(node.namespaceURI, 'segments'); + node.appendChild(segments); + this.writeCurveSegments_(segments, geometry, objectStack); + } + }; + /** + * @param {Element} node Node. + * @param {MultiPolygon} geometry MultiPolygon geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML3.prototype.writeMultiSurfaceOrPolygon = function (node, geometry, objectStack) { + var context = objectStack[objectStack.length - 1]; + var hasZ = context['hasZ']; + var srsName = context['srsName']; + var surface = context['surface']; + if (srsName) { + node.setAttribute('srsName', srsName); + } + var polygons = geometry.getPolygons(); + pushSerializeAndPop({ node: node, hasZ: hasZ, srsName: srsName, surface: surface }, this.SURFACEORPOLYGONMEMBER_SERIALIZERS, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons, objectStack, undefined, this); + }; + /** + * @param {Element} node Node. + * @param {import("../geom/MultiPoint.js").default} geometry MultiPoint geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML3.prototype.writeMultiPoint = function (node, geometry, objectStack) { + var context = objectStack[objectStack.length - 1]; + var srsName = context['srsName']; + var hasZ = context['hasZ']; + if (srsName) { + node.setAttribute('srsName', srsName); + } + var points = geometry.getPoints(); + pushSerializeAndPop({ node: node, hasZ: hasZ, srsName: srsName }, this.POINTMEMBER_SERIALIZERS, makeSimpleNodeFactory('pointMember'), points, objectStack, undefined, this); + }; + /** + * @param {Element} node Node. + * @param {MultiLineString} geometry MultiLineString geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML3.prototype.writeMultiCurveOrLineString = function (node, geometry, objectStack) { + var context = objectStack[objectStack.length - 1]; + var hasZ = context['hasZ']; + var srsName = context['srsName']; + var curve = context['curve']; + if (srsName) { + node.setAttribute('srsName', srsName); + } + var lines = geometry.getLineStrings(); + pushSerializeAndPop({ node: node, hasZ: hasZ, srsName: srsName, curve: curve }, this.LINESTRINGORCURVEMEMBER_SERIALIZERS, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines, objectStack, undefined, this); + }; + /** + * @param {Element} node Node. + * @param {import("../geom/LinearRing.js").default} ring LinearRing geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML3.prototype.writeRing = function (node, ring, objectStack) { + var linearRing = createElementNS(node.namespaceURI, 'LinearRing'); + node.appendChild(linearRing); + this.writeLinearRing(linearRing, ring, objectStack); + }; + /** + * @param {Node} node Node. + * @param {Polygon} polygon Polygon geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML3.prototype.writeSurfaceOrPolygonMember = function (node, polygon, objectStack) { + var child = this.GEOMETRY_NODE_FACTORY_(polygon, objectStack); + if (child) { + node.appendChild(child); + this.writeSurfaceOrPolygon(child, polygon, objectStack); + } + }; + /** + * @param {Element} node Node. + * @param {import("../geom/Point.js").default} point Point geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML3.prototype.writePointMember = function (node, point, objectStack) { + var child = createElementNS(node.namespaceURI, 'Point'); + node.appendChild(child); + this.writePoint(child, point, objectStack); + }; + /** + * @param {Node} node Node. + * @param {LineString} line LineString geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML3.prototype.writeLineStringOrCurveMember = function (node, line, objectStack) { + var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack); + if (child) { + node.appendChild(child); + this.writeCurveOrLineString(child, line, objectStack); + } + }; + /** + * @param {Element} node Node. + * @param {Polygon} polygon Polygon geometry. + * @param {Array<*>} objectStack Node stack. + * @private + */ + GML3.prototype.writeSurfacePatches_ = function (node, polygon, objectStack) { + var child = createElementNS(node.namespaceURI, 'PolygonPatch'); + node.appendChild(child); + this.writeSurfaceOrPolygon(child, polygon, objectStack); + }; + /** + * @param {Element} node Node. + * @param {LineString} line LineString geometry. + * @param {Array<*>} objectStack Node stack. + * @private + */ + GML3.prototype.writeCurveSegments_ = function (node, line, objectStack) { + var child = createElementNS(node.namespaceURI, 'LineStringSegment'); + node.appendChild(child); + this.writeCurveOrLineString(child, line, objectStack); + }; + /** + * @param {Node} node Node. + * @param {import("../geom/Geometry.js").default|import("../extent.js").Extent} geometry Geometry. + * @param {Array<*>} objectStack Node stack. + */ + GML3.prototype.writeGeometryElement = function (node, geometry, objectStack) { + var context = /** @type {import("./Feature.js").WriteOptions} */ (objectStack[objectStack.length - 1]); + var item = Object(ol_obj["a" /* assign */])({}, context); + item['node'] = node; + var value; + if (Array.isArray(geometry)) { + value = Object(format_Feature["b" /* transformExtentWithOptions */])( + /** @type {import("../extent.js").Extent} */ (geometry), context); + } + else { + value = Object(format_Feature["c" /* transformGeometryWithOptions */])( + /** @type {import("../geom/Geometry.js").default} */ (geometry), true, context); + } + pushSerializeAndPop( + /** @type {import("../xml.js").NodeStackItem} */ + (item), this.GEOMETRY_SERIALIZERS, this.GEOMETRY_NODE_FACTORY_, [value], objectStack, undefined, this); + }; + /** + * @param {Element} node Node. + * @param {import("../Feature.js").default} feature Feature. + * @param {Array<*>} objectStack Node stack. + */ + GML3.prototype.writeFeatureElement = function (node, feature, objectStack) { + var fid = feature.getId(); + if (fid) { + node.setAttribute('fid', /** @type {string} */ (fid)); + } + var context = /** @type {Object} */ (objectStack[objectStack.length - 1]); + var featureNS = context['featureNS']; + var geometryName = feature.getGeometryName(); + if (!context.serializers) { + context.serializers = {}; + context.serializers[featureNS] = {}; + } + var keys = []; + var values = []; + if (feature.hasProperties()) { + var properties = feature.getProperties(); + for (var key in properties) { + var value = properties[key]; + if (value !== null) { + keys.push(key); + values.push(value); + if (key == geometryName || + typeof ( /** @type {?} */(value).getSimplifiedGeometry) === + 'function') { + if (!(key in context.serializers[featureNS])) { + context.serializers[featureNS][key] = makeChildAppender(this.writeGeometryElement, this); + } + } + else { + if (!(key in context.serializers[featureNS])) { + context.serializers[featureNS][key] = + makeChildAppender(writeStringTextNode); + } + } + } + } + } + var item = Object(ol_obj["a" /* assign */])({}, context); + item.node = node; + pushSerializeAndPop( + /** @type {import("../xml.js").NodeStackItem} */ + (item), context.serializers, makeSimpleNodeFactory(undefined, featureNS), values, objectStack, keys); + }; + /** + * @param {Node} node Node. + * @param {Array} features Features. + * @param {Array<*>} objectStack Node stack. + * @private + */ + GML3.prototype.writeFeatureMembers_ = function (node, features, objectStack) { + var context = /** @type {Object} */ (objectStack[objectStack.length - 1]); + var featureType = context['featureType']; + var featureNS = context['featureNS']; + /** @type {Object>} */ + var serializers = {}; + serializers[featureNS] = {}; + serializers[featureNS][featureType] = makeChildAppender(this.writeFeatureElement, this); + var item = Object(ol_obj["a" /* assign */])({}, context); + item.node = node; + pushSerializeAndPop( + /** @type {import("../xml.js").NodeStackItem} */ + (item), serializers, makeSimpleNodeFactory(featureType, featureNS), features, objectStack); + }; + /** + * @const + * @param {*} value Value. + * @param {Array<*>} objectStack Object stack. + * @param {string} [opt_nodeName] Node name. + * @return {Node|undefined} Node. + * @private + */ + GML3.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function (value, objectStack, opt_nodeName) { + var parentNode = objectStack[objectStack.length - 1].node; + return createElementNS(this.namespace, GML3_MULTIGEOMETRY_TO_MEMBER_NODENAME[parentNode.nodeName]); + }; + /** + * @const + * @param {*} value Value. + * @param {Array<*>} objectStack Object stack. + * @param {string} [opt_nodeName] Node name. + * @return {Element|undefined} Node. + * @private + */ + GML3.prototype.GEOMETRY_NODE_FACTORY_ = function (value, objectStack, opt_nodeName) { + var context = objectStack[objectStack.length - 1]; + var multiSurface = context['multiSurface']; + var surface = context['surface']; + var curve = context['curve']; + var multiCurve = context['multiCurve']; + var nodeName; + if (!Array.isArray(value)) { + nodeName = /** @type {import("../geom/Geometry.js").default} */ (value).getType(); + if (nodeName === 'MultiPolygon' && multiSurface === true) { + nodeName = 'MultiSurface'; + } + else if (nodeName === 'Polygon' && surface === true) { + nodeName = 'Surface'; + } + else if (nodeName === 'LineString' && curve === true) { + nodeName = 'Curve'; + } + else if (nodeName === 'MultiLineString' && multiCurve === true) { + nodeName = 'MultiCurve'; + } + } + else { + nodeName = 'Envelope'; + } + return createElementNS(this.namespace, nodeName); + }; + /** + * Encode a geometry in GML 3.1.1 Simple Features. + * + * @param {import("../geom/Geometry.js").default} geometry Geometry. + * @param {import("./Feature.js").WriteOptions} [opt_options] Options. + * @return {Node} Node. + * @api + */ + GML3.prototype.writeGeometryNode = function (geometry, opt_options) { + opt_options = this.adaptOptions(opt_options); + var geom = createElementNS(this.namespace, 'geom'); + var context = { + node: geom, + hasZ: this.hasZ, + srsName: this.srsName, + curve: this.curve_, + surface: this.surface_, + multiSurface: this.multiSurface_, + multiCurve: this.multiCurve_, + }; + if (opt_options) { + Object(ol_obj["a" /* assign */])(context, opt_options); + } + this.writeGeometryElement(geom, geometry, [context]); + return geom; + }; + /** + * Encode an array of features in the GML 3.1.1 format as an XML node. + * + * @param {Array} features Features. + * @param {import("./Feature.js").WriteOptions} [opt_options] Options. + * @return {Element} Node. + * @api + */ + GML3.prototype.writeFeaturesNode = function (features, opt_options) { + opt_options = this.adaptOptions(opt_options); + var node = createElementNS(this.namespace, 'featureMembers'); + node.setAttributeNS(XML_SCHEMA_INSTANCE_URI, 'xsi:schemaLocation', this.schemaLocation); + var context = { + srsName: this.srsName, + hasZ: this.hasZ, + curve: this.curve_, + surface: this.surface_, + multiSurface: this.multiSurface_, + multiCurve: this.multiCurve_, + featureNS: this.featureNS, + featureType: this.featureType, + }; + if (opt_options) { + Object(ol_obj["a" /* assign */])(context, opt_options); + } + this.writeFeatureMembers_(node, features, [context]); + return node; + }; + return GML3; +}(format_GMLBase)); +/** + * @const + * @type {Object>} + */ +GML3_GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = { + 'http://www.opengis.net/gml': { + 'pos': makeReplacer(GML3_GML3.prototype.readFlatPos), + 'posList': makeReplacer(GML3_GML3.prototype.readFlatPosList), + 'coordinates': makeReplacer(format_GML2.prototype.readFlatCoordinates), + }, +}; +/** + * @const + * @type {Object>} + */ +GML3_GML3.prototype.FLAT_LINEAR_RINGS_PARSERS = { + 'http://www.opengis.net/gml': { + 'interior': GML3_GML3.prototype.interiorParser, + 'exterior': GML3_GML3.prototype.exteriorParser, + }, +}; +/** + * @const + * @type {Object>} + */ +GML3_GML3.prototype.GEOMETRY_PARSERS = { + 'http://www.opengis.net/gml': { + 'Point': makeReplacer(format_GMLBase.prototype.readPoint), + 'MultiPoint': makeReplacer(format_GMLBase.prototype.readMultiPoint), + 'LineString': makeReplacer(format_GMLBase.prototype.readLineString), + 'MultiLineString': makeReplacer(format_GMLBase.prototype.readMultiLineString), + 'LinearRing': makeReplacer(format_GMLBase.prototype.readLinearRing), + 'Polygon': makeReplacer(format_GMLBase.prototype.readPolygon), + 'MultiPolygon': makeReplacer(format_GMLBase.prototype.readMultiPolygon), + 'Surface': makeReplacer(GML3_GML3.prototype.readSurface), + 'MultiSurface': makeReplacer(GML3_GML3.prototype.readMultiSurface), + 'Curve': makeReplacer(GML3_GML3.prototype.readCurve), + 'MultiCurve': makeReplacer(GML3_GML3.prototype.readMultiCurve), + 'Envelope': makeReplacer(GML3_GML3.prototype.readEnvelope), + }, +}; +/** + * @const + * @type {Object>} + */ +GML3_GML3.prototype.MULTICURVE_PARSERS = { + 'http://www.opengis.net/gml': { + 'curveMember': makeArrayPusher(GML3_GML3.prototype.curveMemberParser), + 'curveMembers': makeArrayPusher(GML3_GML3.prototype.curveMemberParser), + }, +}; +/** + * @const + * @type {Object>} + */ +GML3_GML3.prototype.MULTISURFACE_PARSERS = { + 'http://www.opengis.net/gml': { + 'surfaceMember': makeArrayPusher(GML3_GML3.prototype.surfaceMemberParser), + 'surfaceMembers': makeArrayPusher(GML3_GML3.prototype.surfaceMemberParser), + }, +}; +/** + * @const + * @type {Object>} + */ +GML3_GML3.prototype.CURVEMEMBER_PARSERS = { + 'http://www.opengis.net/gml': { + 'LineString': makeArrayPusher(format_GMLBase.prototype.readLineString), + 'Curve': makeArrayPusher(GML3_GML3.prototype.readCurve), + }, +}; +/** + * @const + * @type {Object>} + */ +GML3_GML3.prototype.SURFACEMEMBER_PARSERS = { + 'http://www.opengis.net/gml': { + 'Polygon': makeArrayPusher(format_GMLBase.prototype.readPolygon), + 'Surface': makeArrayPusher(GML3_GML3.prototype.readSurface), + }, +}; +/** + * @const + * @type {Object>} + */ +GML3_GML3.prototype.SURFACE_PARSERS = { + 'http://www.opengis.net/gml': { + 'patches': makeReplacer(GML3_GML3.prototype.readPatch), + }, +}; +/** + * @const + * @type {Object>} + */ +GML3_GML3.prototype.CURVE_PARSERS = { + 'http://www.opengis.net/gml': { + 'segments': makeReplacer(GML3_GML3.prototype.readSegment), + }, +}; +/** + * @const + * @type {Object>} + */ +GML3_GML3.prototype.ENVELOPE_PARSERS = { + 'http://www.opengis.net/gml': { + 'lowerCorner': makeArrayPusher(GML3_GML3.prototype.readFlatPosList), + 'upperCorner': makeArrayPusher(GML3_GML3.prototype.readFlatPosList), + }, +}; +/** + * @const + * @type {Object>} + */ +GML3_GML3.prototype.PATCHES_PARSERS = { + 'http://www.opengis.net/gml': { + 'PolygonPatch': makeReplacer(GML3_GML3.prototype.readPolygonPatch), + }, +}; +/** + * @const + * @type {Object>} + */ +GML3_GML3.prototype.SEGMENTS_PARSERS = { + 'http://www.opengis.net/gml': { + 'LineStringSegment': makeArrayExtender(GML3_GML3.prototype.readLineStringSegment), + }, +}; +/** + * @const + * @type {Object>} + */ +format_GMLBase.prototype.RING_PARSERS = { + 'http://www.opengis.net/gml': { + 'LinearRing': makeReplacer(format_GMLBase.prototype.readFlatLinearRing), + 'Ring': makeReplacer(GML3_GML3.prototype.readFlatCurveRing), + }, +}; +/** + * Encode an array of features in GML 3.1.1 Simple Features. + * + * @function + * @param {Array} features Features. + * @param {import("./Feature.js").WriteOptions} [opt_options] Options. + * @return {string} Result. + * @api + */ +GML3_GML3.prototype.writeFeatures; +/** + * @type {Object>} + */ +GML3_GML3.prototype.RING_SERIALIZERS = { + 'http://www.opengis.net/gml': { + 'exterior': makeChildAppender(GML3_GML3.prototype.writeRing), + 'interior': makeChildAppender(GML3_GML3.prototype.writeRing), + }, +}; +/** + * @type {Object>} + */ +GML3_GML3.prototype.ENVELOPE_SERIALIZERS = { + 'http://www.opengis.net/gml': { + 'lowerCorner': makeChildAppender(writeStringTextNode), + 'upperCorner': makeChildAppender(writeStringTextNode), + }, +}; +/** + * @type {Object>} + */ +GML3_GML3.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS = { + 'http://www.opengis.net/gml': { + 'surfaceMember': makeChildAppender(GML3_GML3.prototype.writeSurfaceOrPolygonMember), + 'polygonMember': makeChildAppender(GML3_GML3.prototype.writeSurfaceOrPolygonMember), + }, +}; +/** + * @type {Object>} + */ +GML3_GML3.prototype.POINTMEMBER_SERIALIZERS = { + 'http://www.opengis.net/gml': { + 'pointMember': makeChildAppender(GML3_GML3.prototype.writePointMember), + }, +}; +/** + * @type {Object>} + */ +GML3_GML3.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS = { + 'http://www.opengis.net/gml': { + 'lineStringMember': makeChildAppender(GML3_GML3.prototype.writeLineStringOrCurveMember), + 'curveMember': makeChildAppender(GML3_GML3.prototype.writeLineStringOrCurveMember), + }, +}; +/** + * @type {Object>} + */ +GML3_GML3.prototype.GEOMETRY_SERIALIZERS = { + 'http://www.opengis.net/gml': { + 'Curve': makeChildAppender(GML3_GML3.prototype.writeCurveOrLineString), + 'MultiCurve': makeChildAppender(GML3_GML3.prototype.writeMultiCurveOrLineString), + 'Point': makeChildAppender(GML3_GML3.prototype.writePoint), + 'MultiPoint': makeChildAppender(GML3_GML3.prototype.writeMultiPoint), + 'LineString': makeChildAppender(GML3_GML3.prototype.writeCurveOrLineString), + 'MultiLineString': makeChildAppender(GML3_GML3.prototype.writeMultiCurveOrLineString), + 'LinearRing': makeChildAppender(GML3_GML3.prototype.writeLinearRing), + 'Polygon': makeChildAppender(GML3_GML3.prototype.writeSurfaceOrPolygon), + 'MultiPolygon': makeChildAppender(GML3_GML3.prototype.writeMultiSurfaceOrPolygon), + 'Surface': makeChildAppender(GML3_GML3.prototype.writeSurfaceOrPolygon), + 'MultiSurface': makeChildAppender(GML3_GML3.prototype.writeMultiSurfaceOrPolygon), + 'Envelope': makeChildAppender(GML3_GML3.prototype.writeEnvelope), + }, +}; +/* harmony default export */ var format_GML3 = (GML3_GML3); +//# sourceMappingURL=GML3.js.map +// CONCATENATED MODULE: ./node_modules/ol/format/GML.js +/** + * @module ol/format/GML + */ + +/** + * Feature format for reading and writing data in the GML format + * version 3.1.1. + * Currently only supports GML 3.1.1 Simple Features profile. + * + * @class + * @param {import("./GMLBase.js").Options} [opt_options] + * Optional configuration object. + * @api + */ +var GML = format_GML3; +/** + * Encode an array of features in GML 3.1.1 Simple Features. + * + * @function + * @param {Array} features Features. + * @param {import("./Feature.js").WriteOptions} [opt_options] Options. + * @return {string} Result. + * @api + */ +GML.prototype.writeFeatures; +/** + * Encode an array of features in the GML 3.1.1 format as an XML node. + * + * @function + * @param {Array} features Features. + * @param {import("./Feature.js").WriteOptions} [opt_options] Options. + * @return {Node} Node. + * @api + */ +GML.prototype.writeFeaturesNode; +/* harmony default export */ var format_GML = (GML); +//# sourceMappingURL=GML.js.map +// CONCATENATED MODULE: ./node_modules/ol/format/GPX.js +var GPX_extends = (undefined && undefined.__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/format/GPX + */ + + + + + + + + + + + +/** + * @const + * @type {Array} + */ +var NAMESPACE_URIS = [ + null, + 'http://www.topografix.com/GPX/1/0', + 'http://www.topografix.com/GPX/1/1', +]; +/** + * @const + * @type {string} + */ +var SCHEMA_LOCATION = 'http://www.topografix.com/GPX/1/1 ' + + 'http://www.topografix.com/GPX/1/1/gpx.xsd'; +/** + * @const + * @type {Object): (Feature|undefined)>} + */ +var FEATURE_READER = { + 'rte': readRte, + 'trk': readTrk, + 'wpt': readWpt, +}; +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var GPX_PARSERS = makeStructureNS(NAMESPACE_URIS, { + 'rte': makeArrayPusher(readRte), + 'trk': makeArrayPusher(readTrk), + 'wpt': makeArrayPusher(readWpt), +}); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var LINK_PARSERS = makeStructureNS(NAMESPACE_URIS, { + 'text': makeObjectPropertySetter(readString, 'linkText'), + 'type': makeObjectPropertySetter(readString, 'linkType'), +}); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var GPX_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, { + 'rte': makeChildAppender(writeRte), + 'trk': makeChildAppender(writeTrk), + 'wpt': makeChildAppender(writeWpt), +}); +/** + * @typedef {Object} Options + * @property {function(Feature, Node):void} [readExtensions] Callback function + * to process `extensions` nodes. To prevent memory leaks, this callback function must + * not store any references to the node. Note that the `extensions` + * node is not allowed in GPX 1.0. Moreover, only `extensions` + * nodes from `wpt`, `rte` and `trk` can be processed, as those are + * directly mapped to a feature. + */ +/** + * @typedef {Object} LayoutOptions + * @property {boolean} [hasZ] HasZ. + * @property {boolean} [hasM] HasM. + */ +/** + * @classdesc + * Feature format for reading and writing data in the GPX format. + * + * Note that {@link module:ol/format/GPX~GPX#readFeature} only reads the first + * feature of the source. + * + * When reading, routes (``) are converted into LineString geometries, and + * tracks (``) into MultiLineString. Any properties on route and track + * waypoints are ignored. + * + * When writing, LineString geometries are output as routes (``), and + * MultiLineString as tracks (``). + * + * @api + */ +var GPX_GPX = /** @class */ (function (_super) { + GPX_extends(GPX, _super); + /** + * @param {Options} [opt_options] Options. + */ + function GPX(opt_options) { + var _this = _super.call(this) || this; + var options = opt_options ? opt_options : {}; + /** + * @type {import("../proj/Projection.js").default} + */ + _this.dataProjection = Object(ol_proj["h" /* get */])('EPSG:4326'); + /** + * @type {function(Feature, Node): void|undefined} + * @private + */ + _this.readExtensions_ = options.readExtensions; + return _this; + } + /** + * @param {Array} features List of features. + * @private + */ + GPX.prototype.handleReadExtensions_ = function (features) { + if (!features) { + features = []; + } + for (var i = 0, ii = features.length; i < ii; ++i) { + var feature = features[i]; + if (this.readExtensions_) { + var extensionsNode = feature.get('extensionsNode_') || null; + this.readExtensions_(feature, extensionsNode); + } + feature.set('extensionsNode_', undefined); + } + }; + /** + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions} [opt_options] Options. + * @return {import("../Feature.js").default} Feature. + */ + GPX.prototype.readFeatureFromNode = function (node, opt_options) { + if (!Object(ol_array["f" /* includes */])(NAMESPACE_URIS, node.namespaceURI)) { + return null; + } + var featureReader = FEATURE_READER[node.localName]; + if (!featureReader) { + return null; + } + var feature = featureReader(node, [ + this.getReadOptions(node, opt_options), + ]); + if (!feature) { + return null; + } + this.handleReadExtensions_([feature]); + return feature; + }; + /** + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions} [opt_options] Options. + * @return {Array} Features. + */ + GPX.prototype.readFeaturesFromNode = function (node, opt_options) { + if (!Object(ol_array["f" /* includes */])(NAMESPACE_URIS, node.namespaceURI)) { + return []; + } + if (node.localName == 'gpx') { + /** @type {Array} */ + var features = pushParseAndPop([], GPX_PARSERS, node, [ + this.getReadOptions(node, opt_options), + ]); + if (features) { + this.handleReadExtensions_(features); + return features; + } + else { + return []; + } + } + return []; + }; + /** + * Encode an array of features in the GPX format as an XML node. + * LineString geometries are output as routes (``), and MultiLineString + * as tracks (``). + * + * @param {Array} features Features. + * @param {import("./Feature.js").WriteOptions} [opt_options] Options. + * @return {Node} Node. + * @api + */ + GPX.prototype.writeFeaturesNode = function (features, opt_options) { + opt_options = this.adaptOptions(opt_options); + //FIXME Serialize metadata + var gpx = createElementNS('http://www.topografix.com/GPX/1/1', 'gpx'); + var xmlnsUri = 'http://www.w3.org/2000/xmlns/'; + gpx.setAttributeNS(xmlnsUri, 'xmlns:xsi', XML_SCHEMA_INSTANCE_URI); + gpx.setAttributeNS(XML_SCHEMA_INSTANCE_URI, 'xsi:schemaLocation', SCHEMA_LOCATION); + gpx.setAttribute('version', '1.1'); + gpx.setAttribute('creator', 'OpenLayers'); + pushSerializeAndPop( + /** @type {import("../xml.js").NodeStackItem} */ + ({ node: gpx }), GPX_SERIALIZERS, GPX_NODE_FACTORY, features, [opt_options]); + return gpx; + }; + return GPX; +}(format_XMLFeature)); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var RTE_PARSERS = makeStructureNS(NAMESPACE_URIS, { + 'name': makeObjectPropertySetter(readString), + 'cmt': makeObjectPropertySetter(readString), + 'desc': makeObjectPropertySetter(readString), + 'src': makeObjectPropertySetter(readString), + 'link': parseLink, + 'number': makeObjectPropertySetter(readPositiveInteger), + 'extensions': parseExtensions, + 'type': makeObjectPropertySetter(readString), + 'rtept': parseRtePt, +}); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var RTEPT_PARSERS = makeStructureNS(NAMESPACE_URIS, { + 'ele': makeObjectPropertySetter(readDecimal), + 'time': makeObjectPropertySetter(readDateTime), +}); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var TRK_PARSERS = makeStructureNS(NAMESPACE_URIS, { + 'name': makeObjectPropertySetter(readString), + 'cmt': makeObjectPropertySetter(readString), + 'desc': makeObjectPropertySetter(readString), + 'src': makeObjectPropertySetter(readString), + 'link': parseLink, + 'number': makeObjectPropertySetter(readPositiveInteger), + 'type': makeObjectPropertySetter(readString), + 'extensions': parseExtensions, + 'trkseg': parseTrkSeg, +}); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var TRKSEG_PARSERS = makeStructureNS(NAMESPACE_URIS, { + 'trkpt': parseTrkPt, +}); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var TRKPT_PARSERS = makeStructureNS(NAMESPACE_URIS, { + 'ele': makeObjectPropertySetter(readDecimal), + 'time': makeObjectPropertySetter(readDateTime), +}); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var WPT_PARSERS = makeStructureNS(NAMESPACE_URIS, { + 'ele': makeObjectPropertySetter(readDecimal), + 'time': makeObjectPropertySetter(readDateTime), + 'magvar': makeObjectPropertySetter(readDecimal), + 'geoidheight': makeObjectPropertySetter(readDecimal), + 'name': makeObjectPropertySetter(readString), + 'cmt': makeObjectPropertySetter(readString), + 'desc': makeObjectPropertySetter(readString), + 'src': makeObjectPropertySetter(readString), + 'link': parseLink, + 'sym': makeObjectPropertySetter(readString), + 'type': makeObjectPropertySetter(readString), + 'fix': makeObjectPropertySetter(readString), + 'sat': makeObjectPropertySetter(readPositiveInteger), + 'hdop': makeObjectPropertySetter(readDecimal), + 'vdop': makeObjectPropertySetter(readDecimal), + 'pdop': makeObjectPropertySetter(readDecimal), + 'ageofdgpsdata': makeObjectPropertySetter(readDecimal), + 'dgpsid': makeObjectPropertySetter(readPositiveInteger), + 'extensions': parseExtensions, +}); +/** + * @const + * @type {Array} + */ +var LINK_SEQUENCE = ['text', 'type']; +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var LINK_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, { + 'text': makeChildAppender(writeStringTextNode), + 'type': makeChildAppender(writeStringTextNode), +}); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var RTE_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [ + 'name', + 'cmt', + 'desc', + 'src', + 'link', + 'number', + 'type', + 'rtept', +]); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var RTE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, { + 'name': makeChildAppender(writeStringTextNode), + 'cmt': makeChildAppender(writeStringTextNode), + 'desc': makeChildAppender(writeStringTextNode), + 'src': makeChildAppender(writeStringTextNode), + 'link': makeChildAppender(writeLink), + 'number': makeChildAppender(writeNonNegativeIntegerTextNode), + 'type': makeChildAppender(writeStringTextNode), + 'rtept': makeArraySerializer(makeChildAppender(writeWptType)), +}); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var RTEPT_TYPE_SEQUENCE = makeStructureNS(NAMESPACE_URIS, ['ele', 'time']); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var TRK_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [ + 'name', + 'cmt', + 'desc', + 'src', + 'link', + 'number', + 'type', + 'trkseg', +]); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var TRK_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, { + 'name': makeChildAppender(writeStringTextNode), + 'cmt': makeChildAppender(writeStringTextNode), + 'desc': makeChildAppender(writeStringTextNode), + 'src': makeChildAppender(writeStringTextNode), + 'link': makeChildAppender(writeLink), + 'number': makeChildAppender(writeNonNegativeIntegerTextNode), + 'type': makeChildAppender(writeStringTextNode), + 'trkseg': makeArraySerializer(makeChildAppender(writeTrkSeg)), +}); +/** + * @const + * @type {function(*, Array<*>, string=): (Node|undefined)} + */ +var TRKSEG_NODE_FACTORY = makeSimpleNodeFactory('trkpt'); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var TRKSEG_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, { + 'trkpt': makeChildAppender(writeWptType), +}); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var WPT_TYPE_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [ + 'ele', + 'time', + 'magvar', + 'geoidheight', + 'name', + 'cmt', + 'desc', + 'src', + 'link', + 'sym', + 'type', + 'fix', + 'sat', + 'hdop', + 'vdop', + 'pdop', + 'ageofdgpsdata', + 'dgpsid', +]); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var WPT_TYPE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, { + 'ele': makeChildAppender(writeDecimalTextNode), + 'time': makeChildAppender(writeDateTimeTextNode), + 'magvar': makeChildAppender(writeDecimalTextNode), + 'geoidheight': makeChildAppender(writeDecimalTextNode), + 'name': makeChildAppender(writeStringTextNode), + 'cmt': makeChildAppender(writeStringTextNode), + 'desc': makeChildAppender(writeStringTextNode), + 'src': makeChildAppender(writeStringTextNode), + 'link': makeChildAppender(writeLink), + 'sym': makeChildAppender(writeStringTextNode), + 'type': makeChildAppender(writeStringTextNode), + 'fix': makeChildAppender(writeStringTextNode), + 'sat': makeChildAppender(writeNonNegativeIntegerTextNode), + 'hdop': makeChildAppender(writeDecimalTextNode), + 'vdop': makeChildAppender(writeDecimalTextNode), + 'pdop': makeChildAppender(writeDecimalTextNode), + 'ageofdgpsdata': makeChildAppender(writeDecimalTextNode), + 'dgpsid': makeChildAppender(writeNonNegativeIntegerTextNode), +}); +/** + * @const + * @type {Object} + */ +var GEOMETRY_TYPE_TO_NODENAME = { + 'Point': 'wpt', + 'LineString': 'rte', + 'MultiLineString': 'trk', +}; +/** + * @param {*} value Value. + * @param {Array<*>} objectStack Object stack. + * @param {string} [opt_nodeName] Node name. + * @return {Node|undefined} Node. + */ +function GPX_NODE_FACTORY(value, objectStack, opt_nodeName) { + var geometry = /** @type {Feature} */ (value).getGeometry(); + if (geometry) { + var nodeName = GEOMETRY_TYPE_TO_NODENAME[geometry.getType()]; + if (nodeName) { + var parentNode = objectStack[objectStack.length - 1].node; + return createElementNS(parentNode.namespaceURI, nodeName); + } + } +} +/** + * @param {Array} flatCoordinates Flat coordinates. + * @param {LayoutOptions} layoutOptions Layout options. + * @param {Element} node Node. + * @param {!Object} values Values. + * @return {Array} Flat coordinates. + */ +function appendCoordinate(flatCoordinates, layoutOptions, node, values) { + flatCoordinates.push(parseFloat(node.getAttribute('lon')), parseFloat(node.getAttribute('lat'))); + if ('ele' in values) { + flatCoordinates.push(/** @type {number} */ (values['ele'])); + delete values['ele']; + layoutOptions.hasZ = true; + } + else { + flatCoordinates.push(0); + } + if ('time' in values) { + flatCoordinates.push(/** @type {number} */ (values['time'])); + delete values['time']; + layoutOptions.hasM = true; + } + else { + flatCoordinates.push(0); + } + return flatCoordinates; +} +/** + * Choose GeometryLayout based on flags in layoutOptions and adjust flatCoordinates + * and ends arrays by shrinking them accordingly (removing unused zero entries). + * + * @param {LayoutOptions} layoutOptions Layout options. + * @param {Array} flatCoordinates Flat coordinates. + * @param {Array} [ends] Ends. + * @return {import("../geom/GeometryLayout.js").default} Layout. + */ +function applyLayoutOptions(layoutOptions, flatCoordinates, ends) { + var layout = GeometryLayout["a" /* default */].XY; + var stride = 2; + if (layoutOptions.hasZ && layoutOptions.hasM) { + layout = GeometryLayout["a" /* default */].XYZM; + stride = 4; + } + else if (layoutOptions.hasZ) { + layout = GeometryLayout["a" /* default */].XYZ; + stride = 3; + } + else if (layoutOptions.hasM) { + layout = GeometryLayout["a" /* default */].XYM; + stride = 3; + } + if (stride !== 4) { + for (var i = 0, ii = flatCoordinates.length / 4; i < ii; i++) { + flatCoordinates[i * stride] = flatCoordinates[i * 4]; + flatCoordinates[i * stride + 1] = flatCoordinates[i * 4 + 1]; + if (layoutOptions.hasZ) { + flatCoordinates[i * stride + 2] = flatCoordinates[i * 4 + 2]; + } + if (layoutOptions.hasM) { + flatCoordinates[i * stride + 2] = flatCoordinates[i * 4 + 3]; + } + } + flatCoordinates.length = (flatCoordinates.length / 4) * stride; + if (ends) { + for (var i = 0, ii = ends.length; i < ii; i++) { + ends[i] = (ends[i] / 4) * stride; + } + } + } + return layout; +} +/** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ +function parseLink(node, objectStack) { + var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); + var href = node.getAttribute('href'); + if (href !== null) { + values['link'] = href; + } + parseNode(LINK_PARSERS, node, objectStack); +} +/** + * @param {Node} node Node. + * @param {Array<*>} objectStack Object stack. + */ +function parseExtensions(node, objectStack) { + var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); + values['extensionsNode_'] = node; +} +/** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ +function parseRtePt(node, objectStack) { + var values = pushParseAndPop({}, RTEPT_PARSERS, node, objectStack); + if (values) { + var rteValues = /** @type {!Object} */ (objectStack[objectStack.length - 1]); + var flatCoordinates = /** @type {Array} */ (rteValues['flatCoordinates']); + var layoutOptions = /** @type {LayoutOptions} */ (rteValues['layoutOptions']); + appendCoordinate(flatCoordinates, layoutOptions, node, values); + } +} +/** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ +function parseTrkPt(node, objectStack) { + var values = pushParseAndPop({}, TRKPT_PARSERS, node, objectStack); + if (values) { + var trkValues = /** @type {!Object} */ (objectStack[objectStack.length - 1]); + var flatCoordinates = /** @type {Array} */ (trkValues['flatCoordinates']); + var layoutOptions = /** @type {LayoutOptions} */ (trkValues['layoutOptions']); + appendCoordinate(flatCoordinates, layoutOptions, node, values); + } +} +/** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + */ +function parseTrkSeg(node, objectStack) { + var values = /** @type {Object} */ (objectStack[objectStack.length - 1]); + parseNode(TRKSEG_PARSERS, node, objectStack); + var flatCoordinates = + /** @type {Array} */ + (values['flatCoordinates']); + var ends = /** @type {Array} */ (values['ends']); + ends.push(flatCoordinates.length); +} +/** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Feature|undefined} Track. + */ +function readRte(node, objectStack) { + var options = /** @type {import("./Feature.js").ReadOptions} */ (objectStack[0]); + var values = pushParseAndPop({ + 'flatCoordinates': [], + 'layoutOptions': {}, + }, RTE_PARSERS, node, objectStack); + if (!values) { + return undefined; + } + var flatCoordinates = + /** @type {Array} */ + (values['flatCoordinates']); + delete values['flatCoordinates']; + var layoutOptions = /** @type {LayoutOptions} */ (values['layoutOptions']); + delete values['layoutOptions']; + var layout = applyLayoutOptions(layoutOptions, flatCoordinates); + var geometry = new LineString["a" /* default */](flatCoordinates, layout); + Object(format_Feature["c" /* transformGeometryWithOptions */])(geometry, false, options); + var feature = new Feature["a" /* default */](geometry); + feature.setProperties(values, true); + return feature; +} +/** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Feature|undefined} Track. + */ +function readTrk(node, objectStack) { + var options = /** @type {import("./Feature.js").ReadOptions} */ (objectStack[0]); + var values = pushParseAndPop({ + 'flatCoordinates': [], + 'ends': [], + 'layoutOptions': {}, + }, TRK_PARSERS, node, objectStack); + if (!values) { + return undefined; + } + var flatCoordinates = + /** @type {Array} */ + (values['flatCoordinates']); + delete values['flatCoordinates']; + var ends = /** @type {Array} */ (values['ends']); + delete values['ends']; + var layoutOptions = /** @type {LayoutOptions} */ (values['layoutOptions']); + delete values['layoutOptions']; + var layout = applyLayoutOptions(layoutOptions, flatCoordinates, ends); + var geometry = new MultiLineString["a" /* default */](flatCoordinates, layout, ends); + Object(format_Feature["c" /* transformGeometryWithOptions */])(geometry, false, options); + var feature = new Feature["a" /* default */](geometry); + feature.setProperties(values, true); + return feature; +} +/** + * @param {Element} node Node. + * @param {Array<*>} objectStack Object stack. + * @return {Feature|undefined} Waypoint. + */ +function readWpt(node, objectStack) { + var options = /** @type {import("./Feature.js").ReadOptions} */ (objectStack[0]); + var values = pushParseAndPop({}, WPT_PARSERS, node, objectStack); + if (!values) { + return undefined; + } + var layoutOptions = /** @type {LayoutOptions} */ ({}); + var coordinates = appendCoordinate([], layoutOptions, node, values); + var layout = applyLayoutOptions(layoutOptions, coordinates); + var geometry = new Point["a" /* default */](coordinates, layout); + Object(format_Feature["c" /* transformGeometryWithOptions */])(geometry, false, options); + var feature = new Feature["a" /* default */](geometry); + feature.setProperties(values, true); + return feature; +} +/** + * @param {Element} node Node. + * @param {string} value Value for the link's `href` attribute. + * @param {Array<*>} objectStack Node stack. + */ +function writeLink(node, value, objectStack) { + node.setAttribute('href', value); + var context = objectStack[objectStack.length - 1]; + var properties = context['properties']; + var link = [properties['linkText'], properties['linkType']]; + pushSerializeAndPop( + /** @type {import("../xml.js").NodeStackItem} */ ({ node: node }), LINK_SERIALIZERS, OBJECT_PROPERTY_NODE_FACTORY, link, objectStack, LINK_SEQUENCE); +} +/** + * @param {Element} node Node. + * @param {import("../coordinate.js").Coordinate} coordinate Coordinate. + * @param {Array<*>} objectStack Object stack. + */ +function writeWptType(node, coordinate, objectStack) { + var context = objectStack[objectStack.length - 1]; + var parentNode = context.node; + var namespaceURI = parentNode.namespaceURI; + var properties = context['properties']; + //FIXME Projection handling + node.setAttributeNS(null, 'lat', String(coordinate[1])); + node.setAttributeNS(null, 'lon', String(coordinate[0])); + var geometryLayout = context['geometryLayout']; + switch (geometryLayout) { + case GeometryLayout["a" /* default */].XYZM: + if (coordinate[3] !== 0) { + properties['time'] = coordinate[3]; + } + // fall through + case GeometryLayout["a" /* default */].XYZ: + if (coordinate[2] !== 0) { + properties['ele'] = coordinate[2]; + } + break; + case GeometryLayout["a" /* default */].XYM: + if (coordinate[2] !== 0) { + properties['time'] = coordinate[2]; + } + break; + default: + // pass + } + var orderedKeys = node.nodeName == 'rtept' + ? RTEPT_TYPE_SEQUENCE[namespaceURI] + : WPT_TYPE_SEQUENCE[namespaceURI]; + var values = makeSequence(properties, orderedKeys); + pushSerializeAndPop( + /** @type {import("../xml.js").NodeStackItem} */ + ({ node: node, 'properties': properties }), WPT_TYPE_SERIALIZERS, OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); +} +/** + * @param {Node} node Node. + * @param {Feature} feature Feature. + * @param {Array<*>} objectStack Object stack. + */ +function writeRte(node, feature, objectStack) { + var options = /** @type {import("./Feature.js").WriteOptions} */ (objectStack[0]); + var properties = feature.getProperties(); + var context = { node: node }; + context['properties'] = properties; + var geometry = feature.getGeometry(); + if (geometry.getType() == 'LineString') { + var lineString = /** @type {LineString} */ (Object(format_Feature["c" /* transformGeometryWithOptions */])(geometry, true, options)); + context['geometryLayout'] = lineString.getLayout(); + properties['rtept'] = lineString.getCoordinates(); + } + var parentNode = objectStack[objectStack.length - 1].node; + var orderedKeys = RTE_SEQUENCE[parentNode.namespaceURI]; + var values = makeSequence(properties, orderedKeys); + pushSerializeAndPop(context, RTE_SERIALIZERS, OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); +} +/** + * @param {Element} node Node. + * @param {Feature} feature Feature. + * @param {Array<*>} objectStack Object stack. + */ +function writeTrk(node, feature, objectStack) { + var options = /** @type {import("./Feature.js").WriteOptions} */ (objectStack[0]); + var properties = feature.getProperties(); + /** @type {import("../xml.js").NodeStackItem} */ + var context = { node: node }; + context['properties'] = properties; + var geometry = feature.getGeometry(); + if (geometry.getType() == 'MultiLineString') { + var multiLineString = /** @type {MultiLineString} */ (Object(format_Feature["c" /* transformGeometryWithOptions */])(geometry, true, options)); + properties['trkseg'] = multiLineString.getLineStrings(); + } + var parentNode = objectStack[objectStack.length - 1].node; + var orderedKeys = TRK_SEQUENCE[parentNode.namespaceURI]; + var values = makeSequence(properties, orderedKeys); + pushSerializeAndPop(context, TRK_SERIALIZERS, OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); +} +/** + * @param {Element} node Node. + * @param {LineString} lineString LineString. + * @param {Array<*>} objectStack Object stack. + */ +function writeTrkSeg(node, lineString, objectStack) { + /** @type {import("../xml.js").NodeStackItem} */ + var context = { node: node }; + context['geometryLayout'] = lineString.getLayout(); + context['properties'] = {}; + pushSerializeAndPop(context, TRKSEG_SERIALIZERS, TRKSEG_NODE_FACTORY, lineString.getCoordinates(), objectStack); +} +/** + * @param {Element} node Node. + * @param {Feature} feature Feature. + * @param {Array<*>} objectStack Object stack. + */ +function writeWpt(node, feature, objectStack) { + var options = /** @type {import("./Feature.js").WriteOptions} */ (objectStack[0]); + var context = objectStack[objectStack.length - 1]; + context['properties'] = feature.getProperties(); + var geometry = feature.getGeometry(); + if (geometry.getType() == 'Point') { + var point = /** @type {Point} */ (Object(format_Feature["c" /* transformGeometryWithOptions */])(geometry, true, options)); + context['geometryLayout'] = point.getLayout(); + writeWptType(node, point.getCoordinates(), objectStack); + } +} +/* harmony default export */ var format_GPX = (GPX_GPX); +//# sourceMappingURL=GPX.js.map +// EXTERNAL MODULE: ./node_modules/ol/format/TextFeature.js +var TextFeature = __webpack_require__("8da7"); + +// CONCATENATED MODULE: ./node_modules/ol/format/IGC.js +var IGC_extends = (undefined && undefined.__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/format/IGC + */ + + + + + + +/** + * IGC altitude/z. One of 'barometric', 'gps', 'none'. + * @enum {string} + */ +var IGCZ = { + BAROMETRIC: 'barometric', + GPS: 'gps', + NONE: 'none', +}; +/** + * @const + * @type {RegExp} + */ +var B_RECORD_RE = /^B(\d{2})(\d{2})(\d{2})(\d{2})(\d{5})([NS])(\d{3})(\d{5})([EW])([AV])(\d{5})(\d{5})/; +/** + * @const + * @type {RegExp} + */ +var H_RECORD_RE = /^H.([A-Z]{3}).*?:(.*)/; +/** + * @const + * @type {RegExp} + */ +var HFDTE_RECORD_RE = /^HFDTE(\d{2})(\d{2})(\d{2})/; +/** + * A regular expression matching the newline characters `\r\n`, `\r` and `\n`. + * + * @const + * @type {RegExp} + */ +var NEWLINE_RE = /\r\n|\r|\n/; +/** + * @typedef {Object} Options + * @property {IGCZ|string} [altitudeMode='none'] Altitude mode. Possible + * values are `'barometric'`, `'gps'`, and `'none'`. + */ +/** + * @classdesc + * Feature format for `*.igc` flight recording files. + * + * As IGC sources contain a single feature, + * {@link module:ol/format/IGC~IGC#readFeatures} will return the feature in an + * array + * + * @api + */ +var IGC_IGC = /** @class */ (function (_super) { + IGC_extends(IGC, _super); + /** + * @param {Options} [opt_options] Options. + */ + function IGC(opt_options) { + var _this = _super.call(this) || this; + var options = opt_options ? opt_options : {}; + /** + * @type {import("../proj/Projection.js").default} + */ + _this.dataProjection = Object(ol_proj["h" /* get */])('EPSG:4326'); + /** + * @private + * @type {IGCZ} + */ + _this.altitudeMode_ = options.altitudeMode + ? options.altitudeMode + : IGCZ.NONE; + return _this; + } + /** + * @protected + * @param {string} text Text. + * @param {import("./Feature.js").ReadOptions} [opt_options] Read options. + * @return {import("../Feature.js").default} Feature. + */ + IGC.prototype.readFeatureFromText = function (text, opt_options) { + var altitudeMode = this.altitudeMode_; + var lines = text.split(NEWLINE_RE); + /** @type {Object} */ + var properties = {}; + var flatCoordinates = []; + var year = 2000; + var month = 0; + var day = 1; + var lastDateTime = -1; + var i, ii; + for (i = 0, ii = lines.length; i < ii; ++i) { + var line = lines[i]; + var m = void 0; + if (line.charAt(0) == 'B') { + m = B_RECORD_RE.exec(line); + if (m) { + var hour = parseInt(m[1], 10); + var minute = parseInt(m[2], 10); + var second = parseInt(m[3], 10); + var y = parseInt(m[4], 10) + parseInt(m[5], 10) / 60000; + if (m[6] == 'S') { + y = -y; + } + var x = parseInt(m[7], 10) + parseInt(m[8], 10) / 60000; + if (m[9] == 'W') { + x = -x; + } + flatCoordinates.push(x, y); + if (altitudeMode != IGCZ.NONE) { + var z = void 0; + if (altitudeMode == IGCZ.GPS) { + z = parseInt(m[11], 10); + } + else if (altitudeMode == IGCZ.BAROMETRIC) { + z = parseInt(m[12], 10); + } + else { + z = 0; + } + flatCoordinates.push(z); + } + var dateTime = Date.UTC(year, month, day, hour, minute, second); + // Detect UTC midnight wrap around. + if (dateTime < lastDateTime) { + dateTime = Date.UTC(year, month, day + 1, hour, minute, second); + } + flatCoordinates.push(dateTime / 1000); + lastDateTime = dateTime; + } + } + else if (line.charAt(0) == 'H') { + m = HFDTE_RECORD_RE.exec(line); + if (m) { + day = parseInt(m[1], 10); + month = parseInt(m[2], 10) - 1; + year = 2000 + parseInt(m[3], 10); + } + else { + m = H_RECORD_RE.exec(line); + if (m) { + properties[m[1]] = m[2].trim(); + } + } + } + } + if (flatCoordinates.length === 0) { + return null; + } + var layout = altitudeMode == IGCZ.NONE ? GeometryLayout["a" /* default */].XYM : GeometryLayout["a" /* default */].XYZM; + var lineString = new LineString["a" /* default */](flatCoordinates, layout); + var feature = new Feature["a" /* default */](Object(format_Feature["c" /* transformGeometryWithOptions */])(lineString, false, opt_options)); + feature.setProperties(properties, true); + return feature; + }; + /** + * @param {string} text Text. + * @param {import("./Feature.js").ReadOptions} [opt_options] Read options. + * @protected + * @return {Array} Features. + */ + IGC.prototype.readFeaturesFromText = function (text, opt_options) { + var feature = this.readFeatureFromText(text, opt_options); + if (feature) { + return [feature]; + } + else { + return []; + } + }; + return IGC; +}(TextFeature["a" /* default */])); +/* harmony default export */ var format_IGC = (IGC_IGC); +//# sourceMappingURL=IGC.js.map +// CONCATENATED MODULE: ./node_modules/ol/format/IIIFInfo.js +/** + * @module ol/format/IIIFInfo + */ +var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; + + +/** + * @typedef {Object} PreferredOptions + * @property {string} [format] Preferred image format. Will be used if the image information + * indicates support for that format. + * @property {string} [quality] IIIF image qualitiy. Will be used if the image information + * indicates support for that quality. + */ +/** + * @typedef {Object} SupportedFeatures + * @property {Array} [supports] Supported IIIF image size and region + * calculation features. + * @property {Array} [formats] Supported image formats. + * @property {Array} [qualities] Supported IIIF image qualities. + */ +/** + * @typedef {Object} TileInfo + * @property {Array} scaleFactors Supported resolution scaling factors. + * @property {number} width Tile width in pixels. + * @property {number} [height] Tile height in pixels. Same as tile width if height is + * not given. + */ +/** + * @typedef {Object} IiifProfile + * @property {Array} [formats] Supported image formats for the image service. + * @property {Array} [qualities] Supported IIIF image qualities. + * @property {Array} [supports] Supported features. + * @property {number} [maxArea] Maximum area (pixels) available for this image service. + * @property {number} [maxHeight] Maximum height. + * @property {number} [maxWidth] Maximum width. + */ +/** + * @typedef {Object|TileInfo>>} + * ImageInformationResponse + */ +/** + * Enum representing the major IIIF Image API versions + * @enum {string} + */ +var Versions = { + VERSION1: 'version1', + VERSION2: 'version2', + VERSION3: 'version3', +}; +/** + * Supported image formats, qualities and supported region / size calculation features + * for different image API versions and compliance levels + * @const + * @type {Object>} + */ +var IIIF_PROFILE_VALUES = {}; +IIIF_PROFILE_VALUES[Versions.VERSION1] = { + 'level0': { + supports: [], + formats: [], + qualities: ['native'], + }, + 'level1': { + supports: ['regionByPx', 'sizeByW', 'sizeByH', 'sizeByPct'], + formats: ['jpg'], + qualities: ['native'], + }, + 'level2': { + supports: [ + 'regionByPx', + 'regionByPct', + 'sizeByW', + 'sizeByH', + 'sizeByPct', + 'sizeByConfinedWh', + 'sizeByWh', + ], + formats: ['jpg', 'png'], + qualities: ['native', 'color', 'grey', 'bitonal'], + }, +}; +IIIF_PROFILE_VALUES[Versions.VERSION2] = { + 'level0': { + supports: [], + formats: ['jpg'], + qualities: ['default'], + }, + 'level1': { + supports: ['regionByPx', 'sizeByW', 'sizeByH', 'sizeByPct'], + formats: ['jpg'], + qualities: ['default'], + }, + 'level2': { + supports: [ + 'regionByPx', + 'regionByPct', + 'sizeByW', + 'sizeByH', + 'sizeByPct', + 'sizeByConfinedWh', + 'sizeByDistortedWh', + 'sizeByWh', + ], + formats: ['jpg', 'png'], + qualities: ['default', 'bitonal'], + }, +}; +IIIF_PROFILE_VALUES[Versions.VERSION3] = { + 'level0': { + supports: [], + formats: ['jpg'], + qualities: ['default'], + }, + 'level1': { + supports: ['regionByPx', 'regionSquare', 'sizeByW', 'sizeByH', 'sizeByWh'], + formats: ['jpg'], + qualities: ['default'], + }, + 'level2': { + supports: [ + 'regionByPx', + 'regionSquare', + 'regionByPct', + 'sizeByW', + 'sizeByH', + 'sizeByPct', + 'sizeByConfinedWh', + 'sizeByWh', + ], + formats: ['jpg', 'png'], + qualities: ['default'], + }, +}; +IIIF_PROFILE_VALUES['none'] = { + 'none': { + supports: [], + formats: [], + qualities: [], + }, +}; +var COMPLIANCE_VERSION1 = /^https?:\/\/library\.stanford\.edu\/iiif\/image-api\/(?:1\.1\/)?compliance\.html#level[0-2]$/; +var COMPLIANCE_VERSION2 = /^https?:\/\/iiif\.io\/api\/image\/2\/level[0-2](?:\.json)?$/; +var COMPLIANCE_VERSION3 = /(^https?:\/\/iiif\.io\/api\/image\/3\/level[0-2](?:\.json)?$)|(^level[0-2]$)/; +function generateVersion1Options(iiifInfo) { + var levelProfile = iiifInfo.getComplianceLevelSupportedFeatures(); + // Version 1.0 and 1.1 do not require a profile. + if (levelProfile === undefined) { + levelProfile = IIIF_PROFILE_VALUES[Versions.VERSION1]['level0']; + } + return { + url: iiifInfo.imageInfo['@id'] === undefined + ? undefined + : iiifInfo.imageInfo['@id'].replace(/\/?(?:info\.json)?$/g, ''), + supports: levelProfile.supports, + formats: __spreadArray(__spreadArray([], levelProfile.formats, true), [ + iiifInfo.imageInfo.formats === undefined + ? [] + : iiifInfo.imageInfo.formats, + ], false), + qualities: __spreadArray(__spreadArray([], levelProfile.qualities, true), [ + iiifInfo.imageInfo.qualities === undefined + ? [] + : iiifInfo.imageInfo.qualities, + ], false), + resolutions: iiifInfo.imageInfo.scale_factors, + tileSize: iiifInfo.imageInfo.tile_width !== undefined + ? iiifInfo.imageInfo.tile_height !== undefined + ? [iiifInfo.imageInfo.tile_width, iiifInfo.imageInfo.tile_height] + : [iiifInfo.imageInfo.tile_width, iiifInfo.imageInfo.tile_width] + : iiifInfo.imageInfo.tile_height != undefined + ? [iiifInfo.imageInfo.tile_height, iiifInfo.imageInfo.tile_height] + : undefined, + }; +} +function generateVersion2Options(iiifInfo) { + var levelProfile = iiifInfo.getComplianceLevelSupportedFeatures(), additionalProfile = Array.isArray(iiifInfo.imageInfo.profile) && + iiifInfo.imageInfo.profile.length > 1, profileSupports = additionalProfile && iiifInfo.imageInfo.profile[1].supports + ? iiifInfo.imageInfo.profile[1].supports + : [], profileFormats = additionalProfile && iiifInfo.imageInfo.profile[1].formats + ? iiifInfo.imageInfo.profile[1].formats + : [], profileQualities = additionalProfile && iiifInfo.imageInfo.profile[1].qualities + ? iiifInfo.imageInfo.profile[1].qualities + : []; + return { + url: iiifInfo.imageInfo['@id'].replace(/\/?(?:info\.json)?$/g, ''), + sizes: iiifInfo.imageInfo.sizes === undefined + ? undefined + : iiifInfo.imageInfo.sizes.map(function (size) { + return [size.width, size.height]; + }), + tileSize: iiifInfo.imageInfo.tiles === undefined + ? undefined + : [ + iiifInfo.imageInfo.tiles.map(function (tile) { + return tile.width; + })[0], + iiifInfo.imageInfo.tiles.map(function (tile) { + return tile.height === undefined ? tile.width : tile.height; + })[0], + ], + resolutions: iiifInfo.imageInfo.tiles === undefined + ? undefined + : iiifInfo.imageInfo.tiles.map(function (tile) { + return tile.scaleFactors; + })[0], + supports: __spreadArray(__spreadArray([], levelProfile.supports, true), profileSupports, true), + formats: __spreadArray(__spreadArray([], levelProfile.formats, true), profileFormats, true), + qualities: __spreadArray(__spreadArray([], levelProfile.qualities, true), profileQualities, true), + }; +} +function generateVersion3Options(iiifInfo) { + var levelProfile = iiifInfo.getComplianceLevelSupportedFeatures(), formats = iiifInfo.imageInfo.extraFormats === undefined + ? levelProfile.formats + : __spreadArray(__spreadArray([], levelProfile.formats, true), iiifInfo.imageInfo.extraFormats, true), preferredFormat = iiifInfo.imageInfo.preferredFormats !== undefined && + Array.isArray(iiifInfo.imageInfo.preferredFormats) && + iiifInfo.imageInfo.preferredFormats.length > 0 + ? iiifInfo.imageInfo.preferredFormats + .filter(function (format) { + return Object(ol_array["f" /* includes */])(['jpg', 'png', 'gif'], format); + }) + .reduce(function (acc, format) { + return acc === undefined && Object(ol_array["f" /* includes */])(formats, format) + ? format + : acc; + }, undefined) + : undefined; + return { + url: iiifInfo.imageInfo['id'], + sizes: iiifInfo.imageInfo.sizes === undefined + ? undefined + : iiifInfo.imageInfo.sizes.map(function (size) { + return [size.width, size.height]; + }), + tileSize: iiifInfo.imageInfo.tiles === undefined + ? undefined + : [ + iiifInfo.imageInfo.tiles.map(function (tile) { + return tile.width; + })[0], + iiifInfo.imageInfo.tiles.map(function (tile) { + return tile.height; + })[0], + ], + resolutions: iiifInfo.imageInfo.tiles === undefined + ? undefined + : iiifInfo.imageInfo.tiles.map(function (tile) { + return tile.scaleFactors; + })[0], + supports: iiifInfo.imageInfo.extraFeatures === undefined + ? levelProfile.supports + : __spreadArray(__spreadArray([], levelProfile.supports, true), iiifInfo.imageInfo.extraFeatures, true), + formats: formats, + qualities: iiifInfo.imageInfo.extraQualities === undefined + ? levelProfile.qualities + : __spreadArray(__spreadArray([], levelProfile.qualities, true), iiifInfo.imageInfo.extraQualities, true), + preferredFormat: preferredFormat, + }; +} +var versionFunctions = {}; +versionFunctions[Versions.VERSION1] = generateVersion1Options; +versionFunctions[Versions.VERSION2] = generateVersion2Options; +versionFunctions[Versions.VERSION3] = generateVersion3Options; +/** + * @classdesc + * Format for transforming IIIF Image API image information responses into + * IIIF tile source ready options + * + * @api + */ +var IIIFInfo_IIIFInfo = /** @class */ (function () { + /** + * @param {string|ImageInformationResponse} imageInfo + * Deserialized image information JSON response object or JSON response as string + */ + function IIIFInfo(imageInfo) { + this.setImageInfo(imageInfo); + } + /** + * @param {string|ImageInformationResponse} imageInfo + * Deserialized image information JSON response object or JSON response as string + * @api + */ + IIIFInfo.prototype.setImageInfo = function (imageInfo) { + if (typeof imageInfo == 'string') { + this.imageInfo = JSON.parse(imageInfo); + } + else { + this.imageInfo = imageInfo; + } + }; + /** + * @return {Versions} Major IIIF version. + * @api + */ + IIIFInfo.prototype.getImageApiVersion = function () { + if (this.imageInfo === undefined) { + return; + } + var context = this.imageInfo['@context'] || 'ol-no-context'; + if (typeof context == 'string') { + context = [context]; + } + for (var i = 0; i < context.length; i++) { + switch (context[i]) { + case 'http://library.stanford.edu/iiif/image-api/1.1/context.json': + case 'http://iiif.io/api/image/1/context.json': + return Versions.VERSION1; + case 'http://iiif.io/api/image/2/context.json': + return Versions.VERSION2; + case 'http://iiif.io/api/image/3/context.json': + return Versions.VERSION3; + case 'ol-no-context': + // Image API 1.0 has no '@context' + if (this.getComplianceLevelEntryFromProfile(Versions.VERSION1) && + this.imageInfo.identifier) { + return Versions.VERSION1; + } + break; + default: + } + } + Object(asserts["a" /* assert */])(false, 61); + }; + /** + * @param {Versions} version Optional IIIF image API version + * @return {string} Compliance level as it appears in the IIIF image information + * response. + */ + IIIFInfo.prototype.getComplianceLevelEntryFromProfile = function (version) { + if (this.imageInfo === undefined || this.imageInfo.profile === undefined) { + return; + } + if (version === undefined) { + version = this.getImageApiVersion(); + } + switch (version) { + case Versions.VERSION1: + if (COMPLIANCE_VERSION1.test(this.imageInfo.profile)) { + return this.imageInfo.profile; + } + break; + case Versions.VERSION3: + if (COMPLIANCE_VERSION3.test(this.imageInfo.profile)) { + return this.imageInfo.profile; + } + break; + case Versions.VERSION2: + if (typeof this.imageInfo.profile === 'string' && + COMPLIANCE_VERSION2.test(this.imageInfo.profile)) { + return this.imageInfo.profile; + } + if (Array.isArray(this.imageInfo.profile) && + this.imageInfo.profile.length > 0 && + typeof this.imageInfo.profile[0] === 'string' && + COMPLIANCE_VERSION2.test(this.imageInfo.profile[0])) { + return this.imageInfo.profile[0]; + } + break; + default: + } + }; + /** + * @param {Versions} version Optional IIIF image API version + * @return {string} Compliance level, on of 'level0', 'level1' or 'level2' or undefined + */ + IIIFInfo.prototype.getComplianceLevelFromProfile = function (version) { + var complianceLevel = this.getComplianceLevelEntryFromProfile(version); + if (complianceLevel === undefined) { + return undefined; + } + var level = complianceLevel.match(/level[0-2](?:\.json)?$/g); + return Array.isArray(level) ? level[0].replace('.json', '') : undefined; + }; + /** + * @return {SupportedFeatures} Image formats, qualities and region / size calculation + * methods that are supported by the IIIF service. + */ + IIIFInfo.prototype.getComplianceLevelSupportedFeatures = function () { + if (this.imageInfo === undefined) { + return; + } + var version = this.getImageApiVersion(); + var level = this.getComplianceLevelFromProfile(version); + if (level === undefined) { + return IIIF_PROFILE_VALUES['none']['none']; + } + return IIIF_PROFILE_VALUES[version][level]; + }; + /** + * @param {PreferredOptions} [opt_preferredOptions] Optional options for preferred format and quality. + * @return {import("../source/IIIF.js").Options} IIIF tile source ready constructor options. + * @api + */ + IIIFInfo.prototype.getTileSourceOptions = function (opt_preferredOptions) { + var options = opt_preferredOptions || {}, version = this.getImageApiVersion(); + if (version === undefined) { + return; + } + var imageOptions = version === undefined ? undefined : versionFunctions[version](this); + if (imageOptions === undefined) { + return; + } + return { + url: imageOptions.url, + version: version, + size: [this.imageInfo.width, this.imageInfo.height], + sizes: imageOptions.sizes, + format: options.format !== undefined && + Object(ol_array["f" /* includes */])(imageOptions.formats, options.format) + ? options.format + : imageOptions.preferredFormat !== undefined + ? imageOptions.preferredFormat + : 'jpg', + supports: imageOptions.supports, + quality: options.quality && Object(ol_array["f" /* includes */])(imageOptions.qualities, options.quality) + ? options.quality + : Object(ol_array["f" /* includes */])(imageOptions.qualities, 'native') + ? 'native' + : 'default', + resolutions: Array.isArray(imageOptions.resolutions) + ? imageOptions.resolutions.sort(function (a, b) { + return b - a; + }) + : undefined, + tileSize: imageOptions.tileSize, + }; + }; + return IIIFInfo; +}()); +/* harmony default export */ var format_IIIFInfo = (IIIFInfo_IIIFInfo); +//# sourceMappingURL=IIIFInfo.js.map +// EXTERNAL MODULE: ./node_modules/ol/style/Fill.js +var Fill = __webpack_require__("83a6"); + +// EXTERNAL MODULE: ./node_modules/ol/geom/GeometryCollection.js +var GeometryCollection = __webpack_require__("d352"); + +// EXTERNAL MODULE: ./node_modules/ol/style/Icon.js + 1 modules +var Icon = __webpack_require__("6cbf"); + +// EXTERNAL MODULE: ./node_modules/ol/style/IconAnchorUnits.js +var IconAnchorUnits = __webpack_require__("82b0"); + +// EXTERNAL MODULE: ./node_modules/ol/style/IconOrigin.js +var IconOrigin = __webpack_require__("d202"); + +// EXTERNAL MODULE: ./node_modules/ol/ImageState.js +var ImageState = __webpack_require__("869f"); + +// EXTERNAL MODULE: ./node_modules/ol/style/Stroke.js +var Stroke = __webpack_require__("8682"); + +// EXTERNAL MODULE: ./node_modules/ol/style/Style.js +var Style = __webpack_require__("6c77"); + +// EXTERNAL MODULE: ./node_modules/ol/style/Text.js +var Text = __webpack_require__("8295"); + +// EXTERNAL MODULE: ./node_modules/ol/color.js +var ol_color = __webpack_require__("5c38"); + +// EXTERNAL MODULE: ./node_modules/ol/math.js +var math = __webpack_require__("7fc9"); + +// CONCATENATED MODULE: ./node_modules/ol/format/KML.js +var KML_extends = (undefined && undefined.__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/format/KML + */ + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + * @typedef {Object} Vec2 + * @property {number} x X coordinate. + * @property {import("../style/IconAnchorUnits").default} xunits Units of x. + * @property {number} y Y coordinate. + * @property {import("../style/IconAnchorUnits").default} yunits Units of Y. + * @property {import("../style/IconOrigin.js").default} [origin] Origin. + */ +/** + * @typedef {Object} GxTrackObject + * @property {Array>} coordinates Coordinates. + * @property {Array} whens Whens. + */ +/** + * @const + * @type {Array} + */ +var GX_NAMESPACE_URIS = ['http://www.google.com/kml/ext/2.2']; +/** + * @const + * @type {Array} + */ +var KML_NAMESPACE_URIS = [ + null, + 'http://earth.google.com/kml/2.0', + 'http://earth.google.com/kml/2.1', + 'http://earth.google.com/kml/2.2', + 'http://www.opengis.net/kml/2.2', +]; +/** + * @const + * @type {string} + */ +var KML_SCHEMA_LOCATION = 'http://www.opengis.net/kml/2.2 ' + + 'https://developers.google.com/kml/schema/kml22gx.xsd'; +/** + * @type {Object} + */ +var ICON_ANCHOR_UNITS_MAP = { + 'fraction': IconAnchorUnits["a" /* default */].FRACTION, + 'pixels': IconAnchorUnits["a" /* default */].PIXELS, + 'insetPixels': IconAnchorUnits["a" /* default */].PIXELS, +}; +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var PLACEMARK_PARSERS = makeStructureNS(KML_NAMESPACE_URIS, { + 'ExtendedData': extendedDataParser, + 'Region': regionParser, + 'MultiGeometry': makeObjectPropertySetter(readMultiGeometry, 'geometry'), + 'LineString': makeObjectPropertySetter(readLineString, 'geometry'), + 'LinearRing': makeObjectPropertySetter(readLinearRing, 'geometry'), + 'Point': makeObjectPropertySetter(readPoint, 'geometry'), + 'Polygon': makeObjectPropertySetter(readPolygon, 'geometry'), + 'Style': makeObjectPropertySetter(readStyle), + 'StyleMap': placemarkStyleMapParser, + 'address': makeObjectPropertySetter(readString), + 'description': makeObjectPropertySetter(readString), + 'name': makeObjectPropertySetter(readString), + 'open': makeObjectPropertySetter(readBoolean), + 'phoneNumber': makeObjectPropertySetter(readString), + 'styleUrl': makeObjectPropertySetter(readStyleURL), + 'visibility': makeObjectPropertySetter(readBoolean), +}, makeStructureNS(GX_NAMESPACE_URIS, { + 'MultiTrack': makeObjectPropertySetter(readGxMultiTrack, 'geometry'), + 'Track': makeObjectPropertySetter(readGxTrack, 'geometry'), +})); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var NETWORK_LINK_PARSERS = makeStructureNS(KML_NAMESPACE_URIS, { + 'ExtendedData': extendedDataParser, + 'Region': regionParser, + 'Link': linkParser, + 'address': makeObjectPropertySetter(readString), + 'description': makeObjectPropertySetter(readString), + 'name': makeObjectPropertySetter(readString), + 'open': makeObjectPropertySetter(readBoolean), + 'phoneNumber': makeObjectPropertySetter(readString), + 'visibility': makeObjectPropertySetter(readBoolean), +}); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var KML_LINK_PARSERS = makeStructureNS(KML_NAMESPACE_URIS, { + 'href': makeObjectPropertySetter(readURI), +}); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var REGION_PARSERS = makeStructureNS(KML_NAMESPACE_URIS, { + 'LatLonAltBox': latLonAltBoxParser, + 'Lod': lodParser, +}); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var KML_SEQUENCE = makeStructureNS(KML_NAMESPACE_URIS, ['Document', 'Placemark']); +/** + * @const + * @type {Object>} + */ +// @ts-ignore +var KML_SERIALIZERS = makeStructureNS(KML_NAMESPACE_URIS, { + 'Document': makeChildAppender(writeDocument), + 'Placemark': makeChildAppender(writePlacemark), +}); +/** + * @type {import("../color.js").Color} + */ +var DEFAULT_COLOR; +/** + * @type {Fill|null} + */ +var DEFAULT_FILL_STYLE = null; +/** + * Get the default fill style (or null if not yet set). + * @return {Fill|null} The default fill style. + */ +function getDefaultFillStyle() { + return DEFAULT_FILL_STYLE; +} +/** + * @type {import("../size.js").Size} + */ +var DEFAULT_IMAGE_STYLE_ANCHOR; +/** + * @type {import("../style/IconAnchorUnits").default} + */ +var DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS; +/** + * @type {import("../style/IconAnchorUnits").default} + */ +var DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS; +/** + * @type {import("../size.js").Size} + */ +var DEFAULT_IMAGE_STYLE_SIZE; +/** + * @type {string} + */ +var DEFAULT_IMAGE_STYLE_SRC; +/** + * @type {import("../style/Image.js").default|null} + */ +var DEFAULT_IMAGE_STYLE = null; +/** + * Get the default image style (or null if not yet set). + * @return {import("../style/Image.js").default|null} The default image style. + */ +function getDefaultImageStyle() { + return DEFAULT_IMAGE_STYLE; +} +/** + * @type {string} + */ +var DEFAULT_NO_IMAGE_STYLE; +/** + * @type {Stroke|null} + */ +var DEFAULT_STROKE_STYLE = null; +/** + * Get the default stroke style (or null if not yet set). + * @return {Stroke|null} The default stroke style. + */ +function getDefaultStrokeStyle() { + return DEFAULT_STROKE_STYLE; +} +/** + * @type {Stroke} + */ +var DEFAULT_TEXT_STROKE_STYLE; +/** + * @type {Text|null} + */ +var DEFAULT_TEXT_STYLE = null; +/** + * Get the default text style (or null if not yet set). + * @return {Text|null} The default text style. + */ +function getDefaultTextStyle() { + return DEFAULT_TEXT_STYLE; +} +/** + * @type {Style|null} + */ +var DEFAULT_STYLE = null; +/** + * Get the default style (or null if not yet set). + * @return {Style|null} The default style. + */ +function getDefaultStyle() { + return DEFAULT_STYLE; +} +/** + * @type {Array